1 | ;
|
2 |
|
3 | const astUtils = require('../util/ast');
|
4 |
|
5 | module.exports = function (context) {
|
6 | function isGlobalScope(scope) {
|
7 | return scope.type === 'global' || scope.type === 'module';
|
8 | }
|
9 |
|
10 | return {
|
11 | CallExpression(node) {
|
12 | const callee = node.callee;
|
13 | const scope = context.getScope();
|
14 |
|
15 | if (astUtils.isTestCase(node) && isGlobalScope(scope)) {
|
16 | context.report(callee, 'Unexpected global mocha test.');
|
17 | }
|
18 | }
|
19 | };
|
20 | };
|