diff --git a/packages/@vue/cli-plugin-pwa/__tests__/pwaPlugin.spec.js b/packages/@vue/cli-plugin-pwa/__tests__/pwaPlugin.spec.js index a5f77e3de..0f866e8c8 100644 --- a/packages/@vue/cli-plugin-pwa/__tests__/pwaPlugin.spec.js +++ b/packages/@vue/cli-plugin-pwa/__tests__/pwaPlugin.spec.js @@ -30,10 +30,10 @@ test('pwa', async () => { const index = await project.read('dist/index.html') // should split and preload app.js & vendor.js - expect(index).toMatch(/]+js\/app[^>]+\.js rel=preload>/) - expect(index).toMatch(/]+js\/chunk-vendors[^>]+\.js rel=preload>/) + expect(index).toMatch(/]+js\/app[^>]+\.js rel=preload as=script>/) + expect(index).toMatch(/]+js\/chunk-vendors[^>]+\.js rel=preload as=script>/) // should preload css - expect(index).toMatch(/]+app[^>]+\.css rel=preload>/) + expect(index).toMatch(/]+app[^>]+\.css rel=preload as=style>/) // PWA specific directives expect(index).toMatch(``) @@ -66,6 +66,10 @@ test('pwa', async () => { }) afterAll(async () => { - await browser.close() - server.close() + if (browser) { + await browser.close() + } + if (server) { + server.close() + } })