forked from webpack/webpack-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default-js-config.test.js
22 lines (21 loc) · 938 Bytes
/
default-js-config.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const fs = require('fs');
const path = require('path');
const { run } = require('../../../utils/test-utils');
describe('Zero Config', () => {
it('runs when config is present but not supplied via flag', () => {
const { stdout, stderr, exitCode } = run(__dirname, [], false);
// default entry should be used
expect(stdout).toContain('./index.js');
// should pick up the output path from config
expect(stdout).toContain('Entrypoint main = test-output');
expect(stdout).toContain('Hash');
expect(stdout).toContain('Version');
expect(stdout).toContain('Built at');
expect(stdout).toContain('Time');
// Should return the correct exit code
expect(exitCode).toEqual(0);
// check that the output file exists
expect(fs.existsSync(path.join(__dirname, '/dist/test-output.js'))).toBeTruthy();
expect(stderr).toBeFalsy();
});
});