mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
test: build.transpile
This commit is contained in:
parent
8b0c2f1a67
commit
63520aa337
1
test/fixtures/with-config/nuxt.config.js
vendored
1
test/fixtures/with-config/nuxt.config.js
vendored
@ -62,6 +62,7 @@ export default {
|
||||
return null // Coverage: Return null, so defaults will be used.
|
||||
}
|
||||
},
|
||||
transpile: 'vue-test',
|
||||
extend(config, options) {
|
||||
return Object.assign({}, config, {
|
||||
devtool: 'nosources-source-map'
|
||||
|
@ -4,6 +4,7 @@ let port
|
||||
const url = route => 'http://localhost:' + port + route
|
||||
|
||||
let nuxt = null
|
||||
let transpile = null
|
||||
|
||||
describe('basic dev', () => {
|
||||
beforeAll(async () => {
|
||||
@ -12,23 +13,31 @@ describe('basic dev', () => {
|
||||
debug: true,
|
||||
buildDir: '.nuxt-dev',
|
||||
build: {
|
||||
stats: 'none'
|
||||
stats: 'none',
|
||||
transpile: [
|
||||
'\\vue.test\\.js',
|
||||
/vue-test/
|
||||
],
|
||||
extend({ module: { rules } }, { isClient }) {
|
||||
if (isClient) {
|
||||
const babelLoader = rules.find(loader => loader.test.test('.jsx'))
|
||||
transpile = babelLoader.exclude
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
nuxt = new Nuxt(config)
|
||||
new Builder(nuxt).build()
|
||||
await new Builder(nuxt).build()
|
||||
port = await getPort()
|
||||
await nuxt.listen(port, 'localhost')
|
||||
})
|
||||
|
||||
// TODO: enable test when style-loader.js:60 was resolved
|
||||
// test.serial('/extractCSS', async t => {
|
||||
// const window = await nuxt.renderAndGetWindow(url('/extractCSS'))
|
||||
// const html = window.document.head.innerHTML
|
||||
// t.true(html.includes('vendor.css'))
|
||||
// t.true(!html.includes('30px'))
|
||||
// t.is(window.getComputedStyle(window.document.body).getPropertyValue('font-size'), '30px')
|
||||
// })
|
||||
test('Config: build.transpile', async () => {
|
||||
expect(transpile('vue-test')).toBeUndefined()
|
||||
expect(transpile('node_modules/test.js')).toBe(true)
|
||||
expect(transpile('node_modules/vue-test')).toBe(false)
|
||||
expect(transpile('node_modules/test.vue.js')).toBe(false)
|
||||
})
|
||||
|
||||
test('/stateless', async () => {
|
||||
const window = await nuxt.renderAndGetWindow(url('/stateless'))
|
||||
|
Loading…
Reference in New Issue
Block a user