fix(tests): make assets in test consistent with build

This commit is contained in:
Clark Du 2018-11-14 19:35:00 +00:00 committed by Pooya Parsa
parent 68523b95bc
commit 660ab37bff
6 changed files with 16 additions and 47 deletions

View File

@ -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', {

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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