Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: warn about merge config resolution cases (#1674)
* fix: show warning about merge config resolution cases * fix: do not fallback to base config in merge * fix: do not fallback to base config in merge * fix: remove fallback to base config * fix: do not fallback to base config * feat: add MergeError calss * feat: add MergeError class * tests: add tests for merge * tests: add more merge tests
- Loading branch information
Showing
14 changed files
with
63 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class MergeError extends Error { | ||
constructor(message) { | ||
super(message); | ||
this.name = 'MergeError'; | ||
// No need to show stack trace for known errors | ||
this.stack = ''; | ||
} | ||
} | ||
|
||
module.exports = MergeError; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const { join } = require('path'); | ||
|
||
const { run } = require('../../utils/test-utils'); | ||
|
||
describe('merge flag configuration', () => { | ||
it('Show warning message when the merge config is absent', () => { | ||
// 2.js doesn't exist, let's try merging with it | ||
const { stdout, stderr } = run(__dirname, ['--config', './1.js', '--merge', './2.js'], false); | ||
|
||
// Since the process will exit, nothing on stdout | ||
expect(stdout).toBeFalsy(); | ||
// Confirm that the user is notified | ||
expect(stderr).toContain(`MergeError: The supplied merge config doesn't exist.`); | ||
// Default config would be used | ||
expect(fs.existsSync(join(__dirname, './dist/merged.js'))).toBeFalsy(); | ||
// Since the process will exit so no compilation will be done | ||
expect(fs.existsSync(join(__dirname, './dist/main.js'))).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('Oikawa'); |
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,3 +1,6 @@ | ||
module.exports = { | ||
entry: './some_entry.js', | ||
entry: './old_entry.js', | ||
output: { | ||
filename: 'badfile.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
module.exports = { | ||
entry: './some_entry.js', | ||
output: { | ||
filename: 'merged.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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.