-
-
Notifications
You must be signed in to change notification settings - Fork 751
Expand file tree
/
Copy pathbefore_failure_test.js
More file actions
49 lines (45 loc) · 1.71 KB
/
before_failure_test.js
File metadata and controls
49 lines (45 loc) · 1.71 KB
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
import * as chai from 'chai';
chai.should();
import path from 'path';
import { exec } from 'child_process';
import debugFactory from 'debug';
const debug = debugFactory('codeceptjs:test');
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const runner = path.join(__dirname, '/../../bin/codecept.js')
const codecept_dir = path.join(__dirname, '/../data/sandbox')
const codecept_run = `${runner} run --config ${codecept_dir}/codecept.beforetest.failure.js `
describe('Failure in before', function () {
this.timeout(40000)
it('should skip tests that are skipped because of failure in before hook', done => {
exec(`${codecept_run}`, (err, stdout) => {
debug(stdout)
stdout.should.include('First test will be passed @grep')
stdout.should.include('Third test will be skipped @grep')
stdout.should.include('Fourth test will be skipped')
stdout.should.include('1 passed, 1 failed, 1 failedHooks, 2 skipped')
err.code.should.eql(1)
done()
})
})
it('should skip tests correctly with grep options', done => {
exec(`${codecept_run} --grep @grep`, (err, stdout) => {
debug(stdout)
stdout.should.include('First test will be passed @grep')
stdout.should.include('Third test will be skipped @grep')
stdout.should.include('1 passed, 1 failed, 1 failedHooks, 1 skipped')
err.code.should.eql(1)
done()
})
})
it('should trigger skipped events', done => {
exec(`DEBUG=codeceptjs:* ${codecept_run} --verbose`, (err, stdout, stderr) => {
if (err) {
err.code.should.eql(1)
}
stderr.should.include('Emitted | test.skipped')
done()
})
})
})