mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-12 00:53:55 +00:00
24 lines
689 B
JavaScript
24 lines
689 B
JavaScript
|
import WebpackBaseConfig from '../src/config/base'
|
||
|
|
||
|
describe('webpack: babel', () => {
|
||
|
const getConfigWithPlugins = plugins =>
|
||
|
new WebpackBaseConfig({
|
||
|
buildContext: {
|
||
|
options: {
|
||
|
dev: false
|
||
|
},
|
||
|
buildOptions: {
|
||
|
babel: {
|
||
|
plugins
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
test('should allow defining plugins with an array', () => {
|
||
|
expect(getConfigWithPlugins(['myPlugin']).getBabelOptions().plugins).toEqual(['myPlugin'])
|
||
|
})
|
||
|
test('should allow defining plugins with a function', () => {
|
||
|
expect(getConfigWithPlugins(({ isDev }) => [`myPlugin-${isDev}`]).getBabelOptions().plugins).toEqual(['myPlugin-false'])
|
||
|
})
|
||
|
})
|