-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathbefore_all_after_all_throws_spec.ts
More file actions
39 lines (32 loc) · 1.12 KB
/
before_all_after_all_throws_spec.ts
File metadata and controls
39 lines (32 loc) · 1.12 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
import systemTests from '../lib/system-tests'
describe('before all and after all throw', () => {
const getAfterRunCounts = (stderr: string) => {
const afterRunCount = (stderr.match(/test:after:run(?!:async)/g) || []).length
const afterRunAsyncCount = (stderr.match(/test:after:run:async/g) || []).length
return {
afterRunCount,
afterRunAsyncCount,
}
}
systemTests.setup()
systemTests.it('events still fire after before all and after all throw', {
project: 'before-all-after-all-throws',
spec: 'test.cy.js',
snapshot: true,
expectedExitCode: 1,
browser: 'electron',
processEnv: {
ELECTRON_ENABLE_LOGGING: 1,
},
onStderr: (stderr) => {
expect(stderr).to.include('before all')
expect(stderr).to.not.include('test body 1')
expect(stderr).to.not.include('test body 2')
expect(stderr).to.include('after all')
const { afterRunCount, afterRunAsyncCount } = getAfterRunCounts(stderr)
expect(afterRunCount, 'afterRunCount').to.equal(1)
expect(afterRunAsyncCount, 'afterRunAsyncCount').to.equal(1)
return stderr
},
})
})