mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +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.
|
return null // Coverage: Return null, so defaults will be used.
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
transpile: 'vue-test',
|
||||||
extend(config, options) {
|
extend(config, options) {
|
||||||
return Object.assign({}, config, {
|
return Object.assign({}, config, {
|
||||||
devtool: 'nosources-source-map'
|
devtool: 'nosources-source-map'
|
||||||
|
@ -4,6 +4,7 @@ let port
|
|||||||
const url = route => 'http://localhost:' + port + route
|
const url = route => 'http://localhost:' + port + route
|
||||||
|
|
||||||
let nuxt = null
|
let nuxt = null
|
||||||
|
let transpile = null
|
||||||
|
|
||||||
describe('basic dev', () => {
|
describe('basic dev', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
@ -12,23 +13,31 @@ describe('basic dev', () => {
|
|||||||
debug: true,
|
debug: true,
|
||||||
buildDir: '.nuxt-dev',
|
buildDir: '.nuxt-dev',
|
||||||
build: {
|
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)
|
nuxt = new Nuxt(config)
|
||||||
new Builder(nuxt).build()
|
await new Builder(nuxt).build()
|
||||||
port = await getPort()
|
port = await getPort()
|
||||||
await nuxt.listen(port, 'localhost')
|
await nuxt.listen(port, 'localhost')
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO: enable test when style-loader.js:60 was resolved
|
test('Config: build.transpile', async () => {
|
||||||
// test.serial('/extractCSS', async t => {
|
expect(transpile('vue-test')).toBeUndefined()
|
||||||
// const window = await nuxt.renderAndGetWindow(url('/extractCSS'))
|
expect(transpile('node_modules/test.js')).toBe(true)
|
||||||
// const html = window.document.head.innerHTML
|
expect(transpile('node_modules/vue-test')).toBe(false)
|
||||||
// t.true(html.includes('vendor.css'))
|
expect(transpile('node_modules/test.vue.js')).toBe(false)
|
||||||
// t.true(!html.includes('30px'))
|
})
|
||||||
// t.is(window.getComputedStyle(window.document.body).getPropertyValue('font-size'), '30px')
|
|
||||||
// })
|
|
||||||
|
|
||||||
test('/stateless', async () => {
|
test('/stateless', async () => {
|
||||||
const window = await nuxt.renderAndGetWindow(url('/stateless'))
|
const window = await nuxt.renderAndGetWindow(url('/stateless'))
|
||||||
|
Loading…
Reference in New Issue
Block a user