-
-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
configtest
validate default configuration (#2354)
- Loading branch information
1 parent
38869d2
commit 487691a
Showing
18 changed files
with
139 additions
and
21 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
5 changes: 5 additions & 0 deletions
5
test/configtest/without-config-path-custom-extension/webpack.config.json
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,5 @@ | ||
{ | ||
"mode": "development", | ||
"target": "node", | ||
"stats": "verbose" | ||
} |
16 changes: 16 additions & 0 deletions
16
test/configtest/without-config-path-custom-extension/without-config-path.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,16 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
const { run } = require('../../utils/test-utils'); | ||
|
||
describe("'configtest' command without the configuration path option", () => { | ||
it.only('should validate default configuration', () => { | ||
const { exitCode, stderr, stdout } = run(__dirname, ['configtest'], false); | ||
|
||
expect(exitCode).toBe(0); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toContain(`Validate '${path.resolve(__dirname, 'webpack.config.json')}'.`); | ||
expect(stdout).toContain('There are no validation errors in the given webpack configuration.'); | ||
}); | ||
}); |
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,5 @@ | ||
module.exports = { | ||
mode: 'invalid', | ||
target: 'node', | ||
stats: 'verbose', | ||
}; |
16 changes: 16 additions & 0 deletions
16
test/configtest/without-config-path-error/without-config-path-error.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,16 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
const { run } = require('../../utils/test-utils'); | ||
|
||
describe("'configtest' command without the configuration path option", () => { | ||
it.only('should validate default configuration', () => { | ||
const { exitCode, stderr, stdout } = run(__dirname, ['configtest'], false); | ||
|
||
expect(exitCode).toBe(2); | ||
expect(stderr).toContain('Invalid configuration object.'); | ||
expect(stderr).toContain('configuration.mode should be one of these:'); | ||
expect(stdout).toContain(`Validate '${path.resolve(__dirname, 'webpack.config.js')}'.`); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
test/configtest/without-config-path-multi-compiler-mode/webpack.config.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,12 @@ | ||
module.exports = [ | ||
{ | ||
mode: 'development', | ||
target: 'node', | ||
stats: 'verbose', | ||
}, | ||
{ | ||
mode: 'development', | ||
target: 'node', | ||
stats: 'verbose', | ||
}, | ||
]; |
16 changes: 16 additions & 0 deletions
16
...t/without-config-path-multi-compiler-mode/without-config-path-multi-compiler-mode.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,16 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
const { run } = require('../../utils/test-utils'); | ||
|
||
describe("'configtest' command without the configuration path option", () => { | ||
it.only('should validate default configuration', () => { | ||
const { exitCode, stderr, stdout } = run(__dirname, ['configtest'], false); | ||
|
||
expect(exitCode).toBe(0); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toContain(`Validate '${path.resolve(__dirname, 'webpack.config.js')}'.`); | ||
expect(stdout).toContain('There are no validation errors in the given webpack configuration.'); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
...figtest/without-config-path-no-configuration/without-config-path-no-configuration.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,13 @@ | ||
'use strict'; | ||
|
||
const { run } = require('../../utils/test-utils'); | ||
|
||
describe("'configtest' command without the configuration path option", () => { | ||
it.only('should validate default configuration', () => { | ||
const { exitCode, stderr, stdout } = run(__dirname, ['configtest'], false); | ||
|
||
expect(exitCode).toBe(2); | ||
expect(stderr).toContain('No configuration found.'); | ||
expect(stdout).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,5 @@ | ||
module.exports = { | ||
mode: 'development', | ||
target: 'node', | ||
stats: 'verbose', | ||
}; |
16 changes: 16 additions & 0 deletions
16
test/configtest/without-config-path/without-config-path.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,16 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
const { run } = require('../../utils/test-utils'); | ||
|
||
describe("'configtest' command without the configuration path option", () => { | ||
it.only('should validate default configuration', () => { | ||
const { exitCode, stderr, stdout } = run(__dirname, ['configtest'], false); | ||
|
||
expect(exitCode).toBe(0); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toContain(`Validate '${path.resolve(__dirname, 'webpack.config.js')}'.`); | ||
expect(stdout).toContain('There are no validation errors in the given webpack configuration.'); | ||
}); | ||
}); |