(name, testEnvironment, modifiers)
| 1313 | }); |
| 1314 | } |
| 1315 | function createModule(name, testEnvironment, modifiers) { |
| 1316 | var parentModule = moduleStack.length ? moduleStack.slice(-1)[0] : null; |
| 1317 | var moduleName = parentModule !== null ? [parentModule.name, name].join(' > ') : name; |
| 1318 | var parentSuite = parentModule ? parentModule.suiteReport : runSuite; |
| 1319 | var skip = parentModule !== null && parentModule.skip || modifiers.skip; |
| 1320 | var todo = parentModule !== null && parentModule.todo || modifiers.todo; |
| 1321 | var env = {}; |
| 1322 | if (parentModule) { |
| 1323 | extend(env, parentModule.testEnvironment); |
| 1324 | } |
| 1325 | extend(env, testEnvironment); |
| 1326 | var module = { |
| 1327 | name: moduleName, |
| 1328 | parentModule: parentModule, |
| 1329 | hooks: { |
| 1330 | before: [], |
| 1331 | beforeEach: [], |
| 1332 | afterEach: [], |
| 1333 | after: [] |
| 1334 | }, |
| 1335 | testEnvironment: env, |
| 1336 | tests: [], |
| 1337 | moduleId: generateHash(moduleName), |
| 1338 | testsRun: 0, |
| 1339 | testsIgnored: 0, |
| 1340 | childModules: [], |
| 1341 | suiteReport: new SuiteReport(name, parentSuite), |
| 1342 | // Initialised by test.js when the module start executing, |
| 1343 | // i.e. before the first test in this module (or a child). |
| 1344 | stats: null, |
| 1345 | // Pass along `skip` and `todo` properties from parent module, in case |
| 1346 | // there is one, to childs. And use own otherwise. |
| 1347 | // This property will be used to mark own tests and tests of child suites |
| 1348 | // as either `skipped` or `todo`. |
| 1349 | skip: skip, |
| 1350 | todo: skip ? false : todo, |
| 1351 | ignored: modifiers.ignored || false |
| 1352 | }; |
| 1353 | if (parentModule) { |
| 1354 | parentModule.childModules.push(module); |
| 1355 | } |
| 1356 | config.modules.push(module); |
| 1357 | return module; |
| 1358 | } |
| 1359 | function setHookFromEnvironment(hooks, environment, name) { |
| 1360 | var potentialHook = environment[name]; |
| 1361 | if (typeof potentialHook === 'function') { |
no test coverage detected