/
test.js
25 lines (20 loc) 路 947 Bytes
/
test.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
const test = require('@ava/test');
const exec = require('../helpers/exec');
test('node assertion failures are reported to the console when running in a terminal', async t => {
const options = {
env: {
// The AssertionError constructor in Node.js 10 depends on the TTY interface, so opt-in
// to it being simulated.
AVA_SIMULATE_TTY: true,
AVA_TTY_COLOR_DEPTH: 8
}
};
const result = await t.throwsAsync(exec.fixture(['assert-failure.js'], options));
const error = result.stats.getError(result.stats.failed[0]);
t.true(error.values.every(value => value.formatted.includes('AssertionError')));
});
test('node assertion failures are reported to the console when not running in a terminal', async t => {
const result = await t.throwsAsync(exec.fixture(['assert-failure.js']));
const error = result.stats.getError(result.stats.failed[0]);
t.true(error.values.every(value => value.formatted.includes('AssertionError')));
});