UNPKG

512 BJavaScriptView Raw
1'use strict';
2
3const astUtils = require('../util/ast');
4
5module.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};