-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
no-test-and-then.js
40 lines (34 loc) · 947 Bytes
/
no-test-and-then.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict';
const utils = require('../utils/utils');
const emberUtils = require('../utils/ember');
const ERROR_MESSAGE = 'Use `await` instead of `andThen` test wait helper.';
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
docs: {
description: 'Disallow use of `andThen` test wait helper.',
category: 'Testing',
recommended: false
},
fixable: null,
ERROR_MESSAGE
},
create(context) {
if (!emberUtils.isTestFile(context.getFilename())) {
return {};
}
return {
CallExpression(node) {
const callee = node.callee;
if (utils.isIdentifier(callee) && callee.name === 'andThen') {
context.report({
node,
message: ERROR_MESSAGE
});
}
}
};
}
};