/
error.test.js
32 lines (25 loc) · 1.04 KB
/
error.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
26
27
28
29
30
31
32
'use strict';
const { run } = require('../../utils/test-utils');
describe('error', () => {
it('should log error with stacktrace', async () => {
const { exitCode, stderr, stdout } = await run(__dirname);
expect(exitCode).toBe(2);
expect(stderr).toContain('Error: test');
expect(stderr).toMatch(/at .+ (.+)/);
expect(stdout).toBeFalsy();
});
it('should log error with stacktrace using the "bundle" command', async () => {
const { exitCode, stderr, stdout } = await run(__dirname, ['bundle']);
expect(exitCode).toBe(2);
expect(stderr).toContain('Error: test');
expect(stderr).toMatch(/at .+ (.+)/);
expect(stdout).toBeFalsy();
});
it('should log error with stacktrace using the "serve" command', async () => {
const { exitCode, stderr, stdout } = await run(__dirname, ['serve']);
expect(exitCode).toBe(2);
expect(stderr).toContain('Error: test');
expect(stderr).toMatch(/at .+ (.+)/);
expect(stdout).toBeFalsy();
});
});