Add test for offline-plugin

This commit is contained in:
Sébastien Chopin 2017-04-17 15:58:18 +02:00
parent e69aa7c401
commit cce71ce8d5
3 changed files with 7 additions and 1 deletions

View File

@ -10,8 +10,10 @@ module.exports = {
} }
}, },
cache: true, cache: true,
offline: true,
plugins: [ plugins: [
'~plugins/test.js', '~plugins/test.js',
{ src: '~plugins/offline.js', ssr: false },
{ src: '~plugins/only-client.js', ssr: false } { src: '~plugins/only-client.js', ssr: false }
], ],
loading: '~components/loading', loading: '~components/loading',

View File

@ -0,0 +1,4 @@
if (process.env.NODE_ENV === 'production') {
var OfflinePlugin = require('offline-plugin/runtime')
OfflinePlugin.install()
}

View File

@ -82,7 +82,7 @@ test('/test/about-bis (added with extendRoutes)', async t => {
test('Check stats.json generated by build.analyze', t => { test('Check stats.json generated by build.analyze', t => {
const stats = require(resolve(__dirname, 'fixtures/with-config/.nuxt/dist/stats.json')) const stats = require(resolve(__dirname, 'fixtures/with-config/.nuxt/dist/stats.json'))
t.is(stats.assets.length, 23) t.is(stats.assets.length, 26)
}) })
// Close server and ask nuxt to stop listening to file changes // Close server and ask nuxt to stop listening to file changes