-
-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set mode=production by default (#1688)
- Loading branch information
Showing
9 changed files
with
64 additions
and
14 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
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
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 |
---|---|---|
@@ -1,27 +1,39 @@ | ||
'use strict'; | ||
|
||
const { stat } = require('fs'); | ||
const { stat, readFile } = require('fs'); | ||
const { resolve } = require('path'); | ||
|
||
const { run } = require('../../utils/test-utils'); | ||
|
||
describe('merge flag defaults', () => { | ||
it('merges a default webpack.base.config with default config lookup', (done) => { | ||
const { stdout } = run(__dirname, ['-m', './'], false); | ||
expect(stdout).toContain('option has not been set, webpack will fallback to'); | ||
expect(stdout).not.toContain('option has not been set, webpack will fallback to'); | ||
|
||
stat(resolve(__dirname, './dist/default.js'), (err, stats) => { | ||
expect(err).toBe(null); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
readFile(resolve(__dirname, './dist/default.js'), 'utf-8', (err, data) => { | ||
expect(err).toBe(null); | ||
expect(data).toContain('some_entry'); | ||
done(); | ||
}); | ||
}); | ||
it('merges a configuration file with default base config', (done) => { | ||
const { stdout } = run(__dirname, ['-c', './1.js'], false); | ||
expect(stdout).toContain('option has not been set, webpack will fallback to'); | ||
|
||
expect(stdout).not.toContain('option has not been set, webpack will fallback to'); | ||
stat(resolve(__dirname, './dist/default.js'), (err, stats) => { | ||
expect(err).toBe(null); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
readFile(resolve(__dirname, './dist/default.js'), 'utf-8', (err, data) => { | ||
expect(err).toBe(null); | ||
expect(data).toContain('some_entry'); | ||
done(); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1 +1 @@ | ||
console.log('<3'); | ||
console.log('some_entry'); |
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 |
---|---|---|
@@ -1 +1 @@ | ||
console.log('moo'); | ||
console.log('some_other_entry'); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// eslint-disable-next-line node/no-unpublished-require | ||
const WebpackCLITestPlugin = require('../../utils/webpack-cli-test-plugin'); | ||
|
||
module.exports = { | ||
entry: './src/index.js', | ||
plugins: [new WebpackCLITestPlugin()], | ||
}; |