Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow using cjs as default config (#1775)
- Loading branch information
Showing
7 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
test/config/defaults/cjs-config/default-cjs-config.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { run } = require('../../../utils/test-utils'); | ||
|
||
describe('Default Config:', () => { | ||
it('Should be able to pick cjs config by default', () => { | ||
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("Jotaro Kujo") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
mode: 'development', | ||
output: { | ||
filename: 'test-output.js', | ||
}, | ||
}; |