-
Notifications
You must be signed in to change notification settings - Fork 922
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't let deepmerge merge instantiated objects (#1534)
* feat: don't deepmerge non-plain objects Fixes #1416 * test: add new tests/snapshots One for js config files, and one for instantiated objects
- Loading branch information
Showing
11 changed files
with
94 additions
and
2 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,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`snowpack build config-instantiated-object: allFiles 1`] = ` | ||
Array [ | ||
"__snowpack__/env.js", | ||
"_dist_/index.js", | ||
] | ||
`; | ||
|
||
exports[`snowpack build config-instantiated-object: build/__snowpack__/env.js 1`] = `"export default {\\"MODE\\":\\"production\\",\\"NODE_ENV\\":\\"production\\",\\"SSR\\":false};"`; | ||
|
||
exports[`snowpack build config-instantiated-object: build/_dist_/index.js 1`] = `"console.log('fooey');"`; |
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,11 @@ | ||
module.exports = (snowpackConfig, { instance }) => { | ||
if(!instance.prop) { | ||
throw new Error("simple prop value didn't make it"); | ||
} | ||
|
||
if(!instance.method) { | ||
throw new Error("method value didn't make it"); | ||
} | ||
|
||
return { name : "dummy-plugin" }; | ||
}; |
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 @@ | ||
{ | ||
"private": true, | ||
"version": "1.0.1", | ||
"name": "@snowpack/test-config-instantiated-object", | ||
"description": "Test for plugin options using instantiated objects", | ||
"scripts": { | ||
"testbuild": "snowpack build" | ||
}, | ||
"devDependencies": { | ||
"cross-env": "^7.0.2", | ||
"snowpack": "^2.14.3" | ||
} | ||
} |
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,18 @@ | ||
class Instantiable { | ||
constructor() { | ||
this.prop = true; | ||
} | ||
|
||
method() {} | ||
} | ||
|
||
const instance = new Instantiable(); | ||
|
||
module.exports = { | ||
mount: { | ||
'./src': '/_dist_', | ||
}, | ||
plugins: [ | ||
[ "./dummy-plugin.js", { instance } ] | ||
] | ||
}; |
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('fooey'); |
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 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`snowpack build config-js-file: allFiles 1`] = ` | ||
Array [ | ||
"__snowpack__/env.js", | ||
"_dist_/index.js", | ||
] | ||
`; | ||
|
||
exports[`snowpack build config-js-file: build/__snowpack__/env.js 1`] = `"export default {\\"MODE\\":\\"production\\",\\"NODE_ENV\\":\\"production\\",\\"SSR\\":false};"`; | ||
|
||
exports[`snowpack build config-js-file: build/_dist_/index.js 1`] = `"console.log('fooey');"`; |
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 @@ | ||
{ | ||
"private": true, | ||
"version": "1.0.1", | ||
"name": "@snowpack/test-config-js-file", | ||
"description": "Test for a js config file", | ||
"scripts": { | ||
"testbuild": "snowpack build" | ||
}, | ||
"devDependencies": { | ||
"cross-env": "^7.0.2", | ||
"snowpack": "^2.14.3" | ||
} | ||
} |
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 = { | ||
mount: { | ||
'./src': '/_dist_', | ||
}, | ||
}; |
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('fooey'); |
0b3813f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: