mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
fix(tests): make assets in test consistent with build
This commit is contained in:
parent
68523b95bc
commit
660ab37bff
@ -1,5 +1,9 @@
|
|||||||
|
function isBabelLoader(caller) {
|
||||||
|
return caller && caller.name === 'babel-loader'
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = function (api) {
|
module.exports = function (api) {
|
||||||
if (api.env('test')) {
|
if (api.env('test') && !api.caller(isBabelLoader)) {
|
||||||
return {
|
return {
|
||||||
presets: [
|
presets: [
|
||||||
['@babel/env', {
|
['@babel/env', {
|
||||||
|
14
test/fixtures/with-config/layouts/default.vue
vendored
14
test/fixtures/with-config/layouts/default.vue
vendored
@ -4,17 +4,3 @@
|
|||||||
<nuxt />
|
<nuxt />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Roboto';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: local('Roboto'), local('Roboto-Regular'), url(~assets/roboto.woff2) format('woff2');
|
|
||||||
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: 'Roboto';
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -4,17 +4,3 @@
|
|||||||
<nuxt />
|
<nuxt />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Roboto';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: local('Roboto'), local('Roboto-Regular'), url(~assets/roboto.woff2) format('woff2');
|
|
||||||
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: 'Roboto';
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -4,17 +4,3 @@
|
|||||||
<nuxt />
|
<nuxt />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Roboto';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: local('Roboto'), local('Roboto-Regular'), url(~assets/roboto.woff2) format('woff2');
|
|
||||||
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: 'Roboto';
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
7
test/fixtures/with-config/pages/index.vue
vendored
7
test/fixtures/with-config/pages/index.vue
vendored
@ -9,4 +9,11 @@
|
|||||||
::placeholder {
|
::placeholder {
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Roboto';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Roboto'), local('Roboto-Regular'), url(~assets/roboto.woff2) format('woff2');
|
||||||
|
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { loadFixture, getPort, Nuxt, rp } from '../utils'
|
import { loadFixture, getPort, Nuxt, rp, wChunk } from '../utils'
|
||||||
|
|
||||||
let nuxt, port
|
let nuxt, port
|
||||||
const url = route => 'http://localhost:' + port + route
|
const url = route => 'http://localhost:' + port + route
|
||||||
@ -28,13 +28,13 @@ describe('modern server mode', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('should include es6 syntax in modern resources', async () => {
|
test('should include es6 syntax in modern resources', async () => {
|
||||||
const response = await rp(url('/_nuxt/modern-app.js'))
|
const response = await rp(url(`/_nuxt/modern-${wChunk('pages/index.js')}`))
|
||||||
expect(response).toContain('arrow:()=>"build test"')
|
expect(response).toContain('arrow:()=>"build test"')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('should not include es6 syntax in normal resources', async () => {
|
test('should not include es6 syntax in normal resources', async () => {
|
||||||
const response = await rp(url('/_nuxt/app.js'))
|
const response = await rp(url(`/_nuxt/${wChunk('pages/index.js')}`))
|
||||||
expect(response).not.toContain('arrow:()=>"build test"')
|
expect(response).toContain('arrow:function(){return"build test"}')
|
||||||
})
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
|
Loading…
Reference in New Issue
Block a user