-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
testRunWithExternalGlobals.js
54 lines (45 loc) · 1.49 KB
/
testRunWithExternalGlobals.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const path = require('path');
const assert = require('assert');
const common = require('../../common.js');
const CommandGlobals = require('../../lib/globals/commands.js');
const MockServer = require('../../lib/mockserver.js');
const {settings} = common;
const {runTests} = common.require('index.js');
describe('testRunWithExternalGlobals', function() {
beforeEach(function(done) {
this.server = MockServer.init();
this.server.on('listening', () => {
done();
});
});
afterEach(function(done) {
CommandGlobals.afterEach.call(this, done);
});
beforeEach(function() {
process.removeAllListeners('exit');
process.removeAllListeners('uncaughtException');
process.removeAllListeners('unhandledRejection');
});
it('testRun with external globals', function() {
let testsPath = path.join(__dirname, '../../sampletests/before-after/sampleSingleTest.js');
const globals = {
reporterCount: 0
};
return runTests(testsPath, settings({
globals,
globals_path: path.join(__dirname, '../../extra/external-globals.js'),
output_folder: false
}));
});
it('testRun with async external globals', function() {
let testsPath = path.join(__dirname, '../../sampletests/before-after/sampleSingleTest.js');
const globals = {
reporterCount: 0
};
return runTests(testsPath, settings({
globals,
globals_path: path.join(__dirname, '../../extra/external-globals-async.js'),
output_folder: false
}));
});
});