Skip to content

Commit 226e2e5

Browse files
authored
fix: stabilitze UTs (#4180)
1 parent ced73e8 commit 226e2e5

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

test/runner/timeout_test.js

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,89 +9,80 @@ const config_run_config = (config, grep, verbose = false) => `${codecept_run} ${
99
describe('CodeceptJS Timeouts', function () {
1010
this.timeout(10000);
1111

12-
it('should stop test when timeout exceeded', (done) => {
12+
it('should stop test when timeout exceeded', () => {
1313
exec(config_run_config('codecept.conf.js', 'timed out'), (err, stdout) => {
1414
console.log(stdout);
1515
expect(stdout).toContain('Timeout 2s exceeded');
1616
expect(stdout).toContain('Timeout 1s exceeded');
1717
expect(err).toBeTruthy();
18-
done();
1918
});
2019
});
2120

22-
it('should take --no-timeouts option', (done) => {
21+
it('should take --no-timeouts option', () => {
2322
exec(`${config_run_config('codecept.conf.js', 'timed out')} --no-timeouts`, (err, stdout) => {
2423
debug_this_test && console.log(stdout);
2524
expect(stdout).toContain('Timeouts were disabled');
2625
expect(stdout).not.toContain('Timeout 2s exceeded');
2726
expect(stdout).not.toContain('Timeout 1s exceeded');
2827
expect(err).toBeFalsy();
29-
done();
3028
});
3129
});
3230

33-
it('should ignore timeouts if no timeout', (done) => {
31+
it('should ignore timeouts if no timeout', () => {
3432
exec(config_run_config('codecept.conf.js', 'no timeout test'), (err, stdout) => {
3533
debug_this_test && console.log(stdout);
3634
expect(stdout).not.toContain('Timeout');
3735
expect(err).toBeFalsy();
38-
done();
3936
});
4037
});
4138

42-
it('should use global timeouts if timeout is set', (done) => {
39+
it('should use global timeouts if timeout is set', () => {
4340
exec(config_run_config('codecept.timeout.conf.js', 'no timeout test'), (err, stdout) => {
4441
debug_this_test && console.log(stdout);
4542
expect(stdout).toContain('Timeout 0.1');
4643
expect(err).toBeTruthy();
47-
done();
4844
});
4945
});
5046

51-
it('should prefer step timeout', (done) => {
47+
it('should prefer step timeout', () => {
5248
exec(config_run_config('codecept.conf.js', 'timeout step', true), (err, stdout) => {
5349
debug_this_test && console.log(stdout);
5450
expect(stdout).toContain('was interrupted on step timeout 100ms');
5551
expect(err).toBeTruthy();
56-
done();
5752
});
5853
});
5954

60-
it('should keep timeout with steps', (done) => {
55+
it('should keep timeout with steps', () => {
6156
exec(config_run_config('codecept.timeout.conf.js', 'timeout step', true), (err, stdout) => {
6257
debug_this_test && console.log(stdout);
6358
expect(stdout).toContain('was interrupted on step timeout 100ms');
6459
expect(err).toBeTruthy();
65-
done();
6660
});
6761
});
6862

69-
it('should override timeout config from global object', (done) => {
63+
it('should override timeout config from global object', () => {
7064
exec(config_run_config('codecept.timeout.obj.conf.js', '#first', false), (err, stdout) => {
7165
debug_this_test && console.log(stdout);
7266
expect(stdout).toContain('Timeout 0.3s exceeded');
7367
expect(err).toBeTruthy();
74-
done();
7568
});
7669
});
7770

78-
it('should override timeout config from global object but respect local value', (done) => {
71+
it('should override timeout config from global object but respect local value', () => {
7972
exec(config_run_config('codecept.timeout.obj.conf.js', '#second'), (err, stdout) => {
8073
debug_this_test && console.log(stdout);
8174
expect(stdout).not.toContain('Timeout 0.3s exceeded');
8275
expect(stdout).toContain('Timeout 0.5s exceeded');
8376
expect(err).toBeTruthy();
84-
done();
8577
});
8678
});
8779

88-
it('should respect grep when overriding config from global config', (done) => {
80+
it('should respect grep when overriding config from global config', () => {
8981
exec(config_run_config('codecept.timeout.obj.conf.js', '#fourth'), (err, stdout) => {
9082
debug_this_test && console.log(stdout);
9183
expect(stdout).not.toContain('Timeout 0.3s exceeded');
9284
expect(stdout).toContain('Timeout 1s exceeded');
9385
expect(err).toBeTruthy();
94-
done();
9586
});
9687
});
9788
});

0 commit comments

Comments
 (0)