This repository has been archived by the owner on Mar 17, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new options flag to output ES2015 modules (#340)
- Loading branch information
1 parent
ba0fd4c
commit 9b9cd8d
Showing
4 changed files
with
112 additions
and
1 deletion.
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,28 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`when applied with \`esModules\` option matches snapshot for \`false\` value 1`] = ` | ||
Object { | ||
"assets": Array [ | ||
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png", | ||
], | ||
"source": "module.exports = __webpack_public_path__ + \\"9c87cbf3ba33126ffd25ae7f2f6bbafb.png\\";", | ||
} | ||
`; | ||
|
||
exports[`when applied with \`esModules\` option matches snapshot for \`true\` value 1`] = ` | ||
Object { | ||
"assets": Array [ | ||
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png", | ||
], | ||
"source": "export default __webpack_public_path__ + \\"9c87cbf3ba33126ffd25ae7f2f6bbafb.png\\";", | ||
} | ||
`; | ||
|
||
exports[`when applied with \`esModules\` option matches snapshot without value 1`] = ` | ||
Object { | ||
"assets": Array [ | ||
"9c87cbf3ba33126ffd25ae7f2f6bbafb.png", | ||
], | ||
"source": "module.exports = __webpack_public_path__ + \\"9c87cbf3ba33126ffd25ae7f2f6bbafb.png\\";", | ||
} | ||
`; |
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,51 @@ | ||
import webpack from './helpers/compiler'; | ||
|
||
describe('when applied with `esModules` option', () => { | ||
it('matches snapshot without value', async () => { | ||
const config = { | ||
loader: { | ||
test: /(png|jpg|svg)/, | ||
}, | ||
}; | ||
|
||
const stats = await webpack('fixture.js', config); | ||
const [module] = stats.toJson().modules; | ||
const { assets, source } = module; | ||
|
||
expect({ assets, source }).toMatchSnapshot(); | ||
}); | ||
|
||
it('matches snapshot for `true` value', async () => { | ||
const config = { | ||
loader: { | ||
test: /(png|jpg|svg)/, | ||
options: { | ||
esModules: true, | ||
}, | ||
}, | ||
}; | ||
|
||
const stats = await webpack('fixture.js', config); | ||
const [module] = stats.toJson().modules; | ||
const { assets, source } = module; | ||
|
||
expect({ assets, source }).toMatchSnapshot(); | ||
}); | ||
|
||
it('matches snapshot for `false` value', async () => { | ||
const config = { | ||
loader: { | ||
test: /(png|jpg|svg)/, | ||
options: { | ||
esModules: false, | ||
}, | ||
}, | ||
}; | ||
|
||
const stats = await webpack('fixture.js', config); | ||
const [module] = stats.toJson().modules; | ||
const { assets, source } = module; | ||
|
||
expect({ assets, source }).toMatchSnapshot(); | ||
}); | ||
}); |