mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 16:43:55 +00:00
0337932115
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com> Co-authored-by: Alexander Lichter <manniL@gmx.net>
27 lines
896 B
JavaScript
27 lines
896 B
JavaScript
import { resolve } from 'path'
|
|
import { getResourcesSize } from '../utils'
|
|
|
|
const distDir = resolve(__dirname, '../fixtures/unicode-base/.nuxt/dist')
|
|
|
|
describe('nuxt minimal vue-app bundle size limit', () => {
|
|
expect.extend({
|
|
toBeWithinSize (received, size) {
|
|
const maxSize = size * 1.02
|
|
const minSize = size * 0.98
|
|
const pass = received >= minSize && received <= maxSize
|
|
return {
|
|
pass,
|
|
message: () =>
|
|
`expected ${received} to be within range ${minSize} - ${maxSize}`
|
|
}
|
|
}
|
|
})
|
|
|
|
it('should stay within the size limit range', async () => {
|
|
const filter = filename => filename === 'vue-app.nuxt.js'
|
|
const legacyResourcesSize = await getResourcesSize(distDir, 'client', { filter })
|
|
const LEGACY_JS_RESOURCES_KB_SIZE = 16.5
|
|
expect(legacyResourcesSize.uncompressed).toBeWithinSize(LEGACY_JS_RESOURCES_KB_SIZE)
|
|
})
|
|
})
|