From 880d64daae05c8b905e338cc08cbf2a08fafdd20 Mon Sep 17 00:00:00 2001 From: Jeffrey Posnick Date: Tue, 3 Mar 2020 15:00:51 -0500 Subject: [PATCH] Enable Windows tests on GH Actions (#2391) * Enable Windows CI * WIP * Move to chaiMatchPattern * Linting * More Windows tweaks * globby changes * Just run test-node * gulp build --- .github/workflows/pull-request.yml | 34 +- .../validator/service-worker-runtime.js | 46 +-- package-lock.json | 53 ++++ package.json | 1 + test/workbox-build/node/generate-sw.js | 293 ++++++++++-------- test/workbox-build/node/get-manifest.js | 110 ++++--- test/workbox-build/node/inject-manifest.js | 88 +++--- .../node/generate-sw.js | 236 +++++++------- .../node/inject-manifest.js | 188 +++++------ 9 files changed, 555 insertions(+), 494 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b1fec1d7e..6b50f5474 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -3,25 +3,29 @@ name: Test Suite on: [pull_request] jobs: - # Node_Tests_Windows: - # runs-on: windows-latest + Node_Tests_Windows: + runs-on: windows-latest - # steps: - # - uses: actions/checkout@v2 + steps: + - uses: actions/checkout@v2 - # - uses: actions/cache@v1 - # with: - # path: ~/.npm - # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - # restore-keys: | - # ${{ runner.os }}-node- + - uses: actions/cache@v1 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - # - uses: actions/setup-node@v1 - # with: - # node-version: 13.x + - uses: actions/setup-node@v1 + with: + node-version: 13.x + + - name: Setup + run: | + npm ci + gulp build - # - run: npm ci - # - run: npx gulp test + - run: npx gulp test-node Full_Suite_Mac: runs-on: macos-latest diff --git a/infra/testing/validator/service-worker-runtime.js b/infra/testing/validator/service-worker-runtime.js index 478599cf4..a18201d0c 100644 --- a/infra/testing/validator/service-worker-runtime.js +++ b/infra/testing/validator/service-worker-runtime.js @@ -7,42 +7,21 @@ */ const assert = require('assert'); -const expect = require('chai').expect; +const chai = require('chai'); +const chaiMatchPattern = require('chai-match-pattern'); const fse = require('fs-extra'); const makeServiceWorkerEnv = require('service-worker-mock'); const sinon = require('sinon'); const vm = require('vm'); +chai.use(chaiMatchPattern); +const {expect} = chai; + // See https://github.com/chaijs/chai/issues/697 function stringifyFunctionsInArray(arr) { return arr.map((item) => typeof item === 'function' ? item.toString() : item); } -function validatePrecacheAndRoute({actual, expected}) { - for (const call of actual) { - for (const manifestEntry of call[0]) { - if (/[0-9a-f]{32}/.test(manifestEntry.revision)) { - manifestEntry.revision = '32_CHARACTER_HASH'; - } - - if (manifestEntry.url) { - manifestEntry.url = manifestEntry.url.replace(/[0-9a-f]{20}/, '20_CHARACTER_HASH'); - } - } - } - - expect(actual).to.deep.equal(expected); -} - -function validateImportScripts({actual, expected}) { - for (let i = 0; i < actual.length; i++) { - actual[i] = actual[i].map((script) => script.replace(/[0-9a-f]{20}/, '20_CHARACTER_HASH')); - actual[i] = actual[i].map((script) => script.replace(/[0-9a-f]{8}/, '8_CHARACTER_HASH')); - } - - expect(actual).to.deep.equal(expected); -} - function setupSpiesAndContextForInjectManifest() { const cacheableResponsePluginSpy = sinon.spy(); class CacheableResponsePlugin { @@ -166,20 +145,7 @@ function validateMethodCalls({methodsToSpies, expectedMethodCalls, context}) { const args = spy.args.map( (arg) => Array.isArray(arg) ? stringifyFunctionsInArray(arg) : arg); - if (method === 'precacheAndRoute') { - validatePrecacheAndRoute({ - actual: args, - expected: expectedMethodCalls.precacheAndRoute, - }); - } else if (method === 'importScripts') { - validateImportScripts({ - actual: args, - expected: expectedMethodCalls.importScripts, - }); - } else { - expect(args).to.deep.equal(expectedMethodCalls[method], - `while testing method calls for ${method}`); - } + expect(args).to.matchPattern(expectedMethodCalls[method]); } else { expect(expectedMethodCalls[method], `while testing method calls for ${method}`).to.be.undefined; diff --git a/package-lock.json b/package-lock.json index e2a37f103..ef15567a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4714,6 +4714,15 @@ "type-detect": "^4.0.5" } }, + "chai-match-pattern": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/chai-match-pattern/-/chai-match-pattern-1.1.0.tgz", + "integrity": "sha1-TM96GQDKA/mUylpwTJKiZG0CQdM=", + "dev": true, + "requires": { + "lodash-match-pattern": "^2.0.1" + } + }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -4778,6 +4787,16 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, + "checkit": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/checkit/-/checkit-0.7.0.tgz", + "integrity": "sha1-FJeavJMBg0a/z9y6vBmrVMC/10o=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "lodash": "^4.0.0" + } + }, "chokidar": { "version": "2.1.8", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", @@ -11321,6 +11340,40 @@ "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, + "lodash-checkit": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/lodash-checkit/-/lodash-checkit-2.3.2.tgz", + "integrity": "sha512-6ye0MEIYJHl7XMRCIE1sggtTHmTd4xHqZPiGjZVm9DQOFU8k3pMGzOAzC6L7boFFJJI4sRodHR+nU6Z4f+0aeQ==", + "dev": true, + "requires": { + "checkit": "^0.7.0", + "lodash": "^4.17.15" + } + }, + "lodash-match-pattern": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/lodash-match-pattern/-/lodash-match-pattern-2.1.1.tgz", + "integrity": "sha512-uSECNe5YP6etrEhrnAeL6K2Bmy+sJOvNZeEXW5xROULu0WLf9ns1eVTdr8NFsh+5npNJ+ZqO2BocDQM6i5Q6mA==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "he": "^1.2.0", + "lodash-checkit": "^2.3.2" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + } + } + }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", diff --git a/package.json b/package.json index 738bc5836..ffcb773a4 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "bytes": "^3.1.0", "camelcase": "^5.3.1", "chai": "^4.2.0", + "chai-match-pattern": "^1.1.0", "chalk": "^3.0.0", "clear-require": "^3.0.0", "comlinkjs": "^3.2.0", diff --git a/test/workbox-build/node/generate-sw.js b/test/workbox-build/node/generate-sw.js index 9077b29cd..8eccbb7ba 100644 --- a/test/workbox-build/node/generate-sw.js +++ b/test/workbox-build/node/generate-sw.js @@ -134,31 +134,32 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { __WB_DISABLE_DEV_LOGS: undefined, - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], }}); }); @@ -174,31 +175,32 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { __WB_DISABLE_DEV_LOGS: true, - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], }}); }); @@ -215,33 +217,34 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { importScripts: [ - ['./workbox-8_CHARACTER_HASH'], + [/^\.\/workbox-[0-9a-f]{8}$/], [...importScripts], ], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], }}); }); @@ -264,33 +267,34 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], clientsClaim: [[]], skipWaiting: [[]], setCacheNameDetails: [[{prefix: cacheId}]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {directoryIndex, ignoreURLParametersMatching}]], }, addEventListenerValidation: (addEventListenerStub) => { // When skipWaiting is true, the 'message' addEventListener shouldn't be called. @@ -314,30 +318,31 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { // The string additionalManifestEntries entry should lead to one warning. expect(warnings).to.have.length(1); expect(count).to.eql(9); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, '/one', { revision: null, url: '/two', @@ -359,30 +364,31 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], }, addEventListenerValidation: (addEventListenerStub) => { expect(addEventListenerStub.calledOnce).to.be.true; @@ -410,31 +416,32 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { createHandlerBoundToURL: [[navigateFallback]], - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], registerRoute: [[{name: 'NavigationRoute'}]], NavigationRoute: [['/urlWithCacheKey', { @@ -459,30 +466,31 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'link/index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], }}); }); @@ -503,24 +511,25 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(4); - expect(size).to.eql(2535); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2535, 2611]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'link/index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], }}); }); @@ -536,30 +545,31 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], initialize: [[{}]], }}); @@ -580,30 +590,31 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], initialize: [[{ parameterOverrides: { @@ -623,7 +634,8 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); }); @@ -639,7 +651,8 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, filePaths, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); confirmDirectoryContains(outputDir, filePaths); // We can't validate the generated sw.js file, unfortunately. @@ -720,7 +733,7 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { expect(size).to.eql(0); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { [STRING_HANDLER]: [[]], - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], registerRoute: [[STRING_URL_PATTERN, {name: STRING_HANDLER}, DEFAULT_METHOD]], }}); }); @@ -739,28 +752,29 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { [STRING_HANDLER]: [[]], - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], registerRoute: [[STRING_URL_PATTERN, {name: STRING_HANDLER}, DEFAULT_METHOD]], }}); @@ -780,28 +794,29 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { [STRING_HANDLER]: [[]], - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], // See https://github.com/chaijs/chai/issues/697 registerRoute: [['params => true', {name: STRING_HANDLER}, DEFAULT_METHOD]], @@ -845,7 +860,8 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { [STRING_HANDLER]: [[{ @@ -857,25 +873,25 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { }]], ExpirationPlugin: [[firstRuntimeCachingOptions.expiration]], CacheableResponsePlugin: [[secondRuntimeCachingOptions.cacheableResponse]], - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], registerRoute: [ [REGEXP_URL_PATTERN, {name: STRING_HANDLER}, DEFAULT_METHOD], @@ -929,28 +945,29 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { [handler]: [[runtimeCachingOptions]], - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], registerRoute: [ [REGEXP_URL_PATTERN, {name: handler}, DEFAULT_METHOD], @@ -996,27 +1013,28 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], }}); }); @@ -1065,28 +1083,29 @@ describe(`[workbox-build] generate-sw.js (End to End)`, function() { const {count, size, warnings} = await generateSW(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); await validateServiceWorkerRuntime({swFile: swDest, expectedMethodCalls: { [handler]: [[]], - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], {}]], enable: [[]], registerRoute: [[urlPattern, {name: handler}, 'GET']], diff --git a/test/workbox-build/node/get-manifest.js b/test/workbox-build/node/get-manifest.js index 76f6d5a04..9dc70de14 100644 --- a/test/workbox-build/node/get-manifest.js +++ b/test/workbox-build/node/get-manifest.js @@ -6,11 +6,15 @@ https://opensource.org/licenses/MIT. */ -const expect = require('chai').expect; +const chai = require('chai'); +const chaiMatchPattern = require('chai-match-pattern'); const fse = require('fs-extra'); const upath = require('upath'); const tempy = require('tempy'); +chai.use(chaiMatchPattern); +const {expect} = chai; + const getManifest = require('../../../packages/workbox-build/src/get-manifest'); describe(`[workbox-build] get-manifest.js (End to End)`, function() { @@ -86,27 +90,28 @@ describe(`[workbox-build] get-manifest.js (End to End)`, function() { const {count, size, manifestEntries, warnings} = await getManifest(options); expect(warnings).to.be.empty; - expect(manifestEntries).to.deep.equal([{ + expect(manifestEntries).to.matchPattern([{ url: 'index.html', - revision: '3883c45b119c9d7e9ad75a1b4a4672ac', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '544658ab25ee8762dc241e8b1c5ed96d', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: 'a3a71ce0b9b43c459cf58bd37e911b74', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '934823cbc67ccf0d67aa2a2eeb798f12', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '884f6853a4fc655e4c2dc0c0f27a227c', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '5b652181a25e96f255d0490203d3c47e', + revision: /^[0-9a-f]{32}$/, }]); expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); }); it(`should use defaults when all the required parameters, and 'globPatterns' are present`, async function() { @@ -116,21 +121,22 @@ describe(`[workbox-build] get-manifest.js (End to End)`, function() { const {count, size, manifestEntries, warnings} = await getManifest(options); expect(warnings).to.be.empty; - expect(manifestEntries).to.deep.equal([{ + expect(manifestEntries).to.matchPattern([{ url: 'index.html', - revision: '3883c45b119c9d7e9ad75a1b4a4672ac', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '544658ab25ee8762dc241e8b1c5ed96d', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: 'a3a71ce0b9b43c459cf58bd37e911b74', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '5b652181a25e96f255d0490203d3c47e', + revision: /^[0-9a-f]{32}$/, }]); expect(count).to.eql(4); - expect(size).to.eql(2535); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2535, 2611]); }); it(`should use defaults when all the required parameters, and 'globIgnores' are present`, async function() { @@ -140,15 +146,16 @@ describe(`[workbox-build] get-manifest.js (End to End)`, function() { const {count, size, manifestEntries, warnings} = await getManifest(options); expect(warnings).to.be.empty; - expect(manifestEntries).to.deep.equal([{ + expect(manifestEntries).to.matchPattern([{ url: 'styles/stylesheet-1.css', - revision: '934823cbc67ccf0d67aa2a2eeb798f12', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '884f6853a4fc655e4c2dc0c0f27a227c', + revision: /^[0-9a-f]{32}$/, }]); expect(count).to.eql(2); - expect(size).to.eql(69); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([69, 75]); }); it(`should use defaults when all the required parameters, 'globIgnores', and 'globPatterns' are present`, async function() { @@ -159,15 +166,16 @@ describe(`[workbox-build] get-manifest.js (End to End)`, function() { const {count, size, manifestEntries, warnings} = await getManifest(options); expect(warnings).to.be.empty; - expect(manifestEntries).to.deep.equal([{ + expect(manifestEntries).to.matchPattern([{ url: 'styles/stylesheet-1.css', - revision: '934823cbc67ccf0d67aa2a2eeb798f12', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '5b652181a25e96f255d0490203d3c47e', + revision: /^[0-9a-f]{32}$/, }]); expect(count).to.eql(2); - expect(size).to.eql(217); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([217, 220]); }); it(`should use defaults when all the required parameters, and 'maximumFileSizeToCacheInBytes' are present`, async function() { @@ -177,21 +185,22 @@ describe(`[workbox-build] get-manifest.js (End to End)`, function() { const {count, size, manifestEntries, warnings} = await getManifest(options); expect(warnings).to.have.lengthOf(2); - expect(manifestEntries).to.deep.equal([{ - revision: '544658ab25ee8762dc241e8b1c5ed96d', + expect(manifestEntries).to.matchPattern([{ + revision: /^[0-9a-f]{32}$/, url: 'page-1.html', }, { - revision: 'a3a71ce0b9b43c459cf58bd37e911b74', + revision: /^[0-9a-f]{32}$/, url: 'page-2.html', }, { - revision: '934823cbc67ccf0d67aa2a2eeb798f12', + revision: /^[0-9a-f]{32}$/, url: 'styles/stylesheet-1.css', }, { - revision: '884f6853a4fc655e4c2dc0c0f27a227c', + revision: /^[0-9a-f]{32}$/, url: 'styles/stylesheet-2.css', }]); expect(count).to.eql(4); - expect(size).to.eql(101); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([101, 109]); }); it(`should use defaults when all the required parameters, and 'templatedURLs' are present`, async function() { @@ -207,33 +216,34 @@ describe(`[workbox-build] get-manifest.js (End to End)`, function() { const {count, size, manifestEntries, warnings} = await getManifest(options); expect(warnings).to.be.empty; - expect(manifestEntries).to.deep.equal([{ + expect(manifestEntries).to.matchPattern([{ url: 'index.html', - revision: '3883c45b119c9d7e9ad75a1b4a4672ac', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '544658ab25ee8762dc241e8b1c5ed96d', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: 'a3a71ce0b9b43c459cf58bd37e911b74', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '934823cbc67ccf0d67aa2a2eeb798f12', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '884f6853a4fc655e4c2dc0c0f27a227c', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '5b652181a25e96f255d0490203d3c47e', + revision: /^[0-9a-f]{32}$/, }, { url: 'url1', - revision: '69a043d97513b7015bf4bd95df3e308e', + revision: /^[0-9a-f]{32}$/, }, { url: 'url2', - revision: 'c154bc7cdfbfbfb73e23f853bd8fcec0', + revision: /^[0-9a-f]{32}$/, }]); expect(count).to.eql(8); - expect(size).to.eql(4973); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([4973, 5131]); }); it(`should use defaults when all the required parameters, and 'manifestTransforms' are present`, async function() { @@ -259,15 +269,16 @@ describe(`[workbox-build] get-manifest.js (End to End)`, function() { const {count, size, manifestEntries, warnings} = await getManifest(options); expect(warnings).to.be.empty; - expect(manifestEntries).to.deep.equal([{ + expect(manifestEntries).to.matchPattern([{ url: '/prefix/page-1.html', - revision: '544658ab25ee8762dc241e8b1c5ed96d', + revision: /^[0-9a-f]{32}$/, }, { url: '/prefix/styles/stylesheet-1.css', - revision: '934823cbc67ccf0d67aa2a2eeb798f12', + revision: /^[0-9a-f]{32}$/, }]); expect(count).to.eql(2); - expect(size).to.eql(50); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([50, 54]); }); it(`should use defaults when all the required parameters are present, with 'globFollow' and symlinks`, async function() { @@ -282,21 +293,22 @@ describe(`[workbox-build] get-manifest.js (End to End)`, function() { const {count, size, manifestEntries, warnings} = await getManifest(options); expect(warnings).to.be.empty; - expect(manifestEntries).to.deep.equal([{ + expect(manifestEntries).to.matchPattern([{ url: 'link/index.html', - revision: '3883c45b119c9d7e9ad75a1b4a4672ac', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/page-1.html', - revision: '544658ab25ee8762dc241e8b1c5ed96d', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/page-2.html', - revision: 'a3a71ce0b9b43c459cf58bd37e911b74', + revision: /^[0-9a-f]{32}$/, }, { url: 'link/webpackEntry.js', - revision: '5b652181a25e96f255d0490203d3c47e', + revision: /^[0-9a-f]{32}$/, }]); expect(count).to.eql(4); - expect(size).to.eql(2535); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2535, 2611]); }); }); diff --git a/test/workbox-build/node/inject-manifest.js b/test/workbox-build/node/inject-manifest.js index e590fb992..6cefd037c 100644 --- a/test/workbox-build/node/inject-manifest.js +++ b/test/workbox-build/node/inject-manifest.js @@ -169,8 +169,9 @@ describe(`[workbox-build] inject-manifest.js (End to End)`, function() { const {count, filePaths, size, warnings} = await injectManifest(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); - expect(filePaths).to.have.members([swDest]); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); + expect(filePaths).to.have.members([upath.resolve(swDest)]); await validateServiceWorkerRuntime({ entryPoint: 'injectManifest', @@ -178,22 +179,22 @@ describe(`[workbox-build] inject-manifest.js (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }]]], }, }); @@ -220,8 +221,9 @@ describe(`[workbox-build] inject-manifest.js (End to End)`, function() { const {count, filePaths, size, warnings} = await injectManifest(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); - expect(filePaths).to.have.members([swDest]); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); + expect(filePaths).to.have.members([upath.resolve(swDest)]); await validateServiceWorkerRuntime({ entryPoint: 'injectManifest', @@ -230,22 +232,22 @@ describe(`[workbox-build] inject-manifest.js (End to End)`, function() { importScripts: [['./sample-import.js']], precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }]], [[ '/extra-assets/example.1234.css', '/extra-assets/example-2.1234.js', @@ -265,8 +267,9 @@ describe(`[workbox-build] inject-manifest.js (End to End)`, function() { const {count, filePaths, size, warnings} = await injectManifest(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); - expect(filePaths).to.have.members([swDest]); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); + expect(filePaths).to.have.members([upath.resolve(swDest)]); await validateServiceWorkerRuntime({ entryPoint: 'injectManifest', @@ -274,22 +277,22 @@ describe(`[workbox-build] inject-manifest.js (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }]]], }, }); @@ -305,8 +308,9 @@ describe(`[workbox-build] inject-manifest.js (End to End)`, function() { const {count, filePaths, size, warnings} = await injectManifest(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); - expect(filePaths).to.have.members([swDest]); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); + expect(filePaths).to.have.members([upath.resolve(swDest)]); await validateServiceWorkerRuntime({ entryPoint: 'injectManifest', @@ -314,22 +318,22 @@ describe(`[workbox-build] inject-manifest.js (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }], { cleanURLs: true, }]], @@ -353,29 +357,30 @@ describe(`[workbox-build] inject-manifest.js (End to End)`, function() { const {count, size, warnings} = await injectManifest(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); await validateServiceWorkerRuntime({ entryPoint: 'injectManifest', swFile: swDest, expectedMethodCalls: { precacheAndRoute: [[[{ url: 'index.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-1.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'page-2.html', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-1.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'styles/stylesheet-2.css', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }, { url: 'webpackEntry.js', - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, }]]], }, }); @@ -396,8 +401,9 @@ describe(`[workbox-build] inject-manifest.js (End to End)`, function() { const {count, filePaths, size, warnings} = await injectManifest(options); expect(warnings).to.be.empty; expect(count).to.eql(6); - expect(size).to.eql(2604); - expect(filePaths).to.have.members([swDest, sourcemapDest]); + // Line ending differences lead to different sizes on Windows. + expect(size).to.be.oneOf([2604, 2686]); + expect(filePaths).to.have.members([upath.resolve(swDest), sourcemapDest]); const actualSourcemap = await fse.readJSON(sourcemapDest); const expectedSourcemap = await fse.readJSON( diff --git a/test/workbox-webpack-plugin/node/generate-sw.js b/test/workbox-webpack-plugin/node/generate-sw.js index 245d70f42..53bfd3d6d 100644 --- a/test/workbox-webpack-plugin/node/generate-sw.js +++ b/test/workbox-webpack-plugin/node/generate-sw.js @@ -82,19 +82,19 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); await validateServiceWorkerRuntime({ swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', - url: 'entry2-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry2-[0-9a-f]{20}\.js$/, }, ], {}]], }, @@ -140,20 +140,20 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { // There should be a warning logged, due to INVALID_CHUNK_NAME. expect(statsJson.warnings).to.have.length(1); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(8); await validateServiceWorkerRuntime({ swFile, expectedMethodCalls: { // imported-[chunkhash].js.map should *not* be included. importScripts: [ - ['./workbox-8_CHARACTER_HASH'], - ['imported-20_CHARACTER_HASH.js'], + [/^\.\/workbox-[0-9a-f]{8}$/], + [/^imported-[0-9a-f]{20}\.js$/], ], // imported-[chunkhash].js should *not* be included. precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', - url: 'main-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^main-[0-9a-f]{20}\.js$/, }], {}]], }, }); @@ -197,19 +197,19 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { expect(statsJson.errors).to.be.empty; expect(statsJson.warnings).to.have.length(0); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); await validateServiceWorkerRuntime({ swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', - url: 'entry2-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry2-[0-9a-f]{20}\.js$/, }, { revision: null, url: 'one', @@ -257,18 +257,18 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(5); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', - url: 'entry2-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry2-[0-9a-f]{20}\.js$/, }, ], {}]], }}); @@ -310,17 +310,17 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'main.js', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'vendors~main.js', }, ], {}]], @@ -359,18 +359,18 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(5); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', - url: 'entry2-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry2-[0-9a-f]{20}\.js$/, }, ], {}]], }}); @@ -409,15 +409,15 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(5); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, ], {}]], }}); @@ -455,20 +455,20 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(5); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', - url: 'entry2-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry2-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'index.html', }, ], {}]], @@ -507,47 +507,47 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(11); await validateServiceWorkerRuntime({ swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'images/example-jpeg.jpg', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'images/web-fundamentals-icon192x192.png', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'index.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-1.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-2.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'splitChunksEntry.js', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'styles/stylesheet-1.css', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'styles/stylesheet-2.css', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }, ], {}]], @@ -587,19 +587,19 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(9); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'manifest.json', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'not-ignored.js', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }], {}]], }}); @@ -634,16 +634,16 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(6); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js.map', }], {}]], }}); @@ -681,19 +681,19 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(11); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'index.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-1.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-2.html', }], {}]], }}); @@ -732,16 +732,16 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(11); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-1.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-2.html', }], {}]], }}); @@ -778,13 +778,13 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }], {}]], }}); @@ -827,16 +827,16 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { `The chunk 'doesNotExist' was provided in your Workbox chunks config, but was not found in the compilation.`, ]); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); await validateServiceWorkerRuntime({ swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, ], {}]], }, @@ -886,46 +886,46 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { const swFile = upath.join(outputDir, 'service-worker.js'); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(12); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'images/web-fundamentals-icon192x192.png', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'index.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-1.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-2.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'splitChunksEntry.js', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'styles/stylesheet-1.css', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'styles/stylesheet-2.css', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }, ], {}]], @@ -964,15 +964,15 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: '/testing/entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^\/testing\/entry1-[0-9a-f]{20}\.js$/, }, ], {}]], }}); @@ -1015,7 +1015,7 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { // different environments. Instead of hardcoding hash checks, just // confirm that we output the expected number of files, which will // only be true if the build was successful. - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(6); done(); @@ -1059,10 +1059,10 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { const swString = memoryFS.readFileSync(`${outputDir}/service-worker.js`, 'utf-8'); await validateServiceWorkerRuntime({swString, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }], {}]], }}); @@ -1113,7 +1113,7 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { expect(statsJson.warnings).to.have.length(0); } - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); resolve(); @@ -1155,15 +1155,15 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); await validateServiceWorkerRuntime({ swFile: sw1File, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'index.js', }], {}]], }, @@ -1172,9 +1172,9 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { await validateServiceWorkerRuntime({ swFile: sw2File, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'index.js', }], {}]], }, @@ -1214,7 +1214,7 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { // We can't really mock evaluation of the service worker script when // the Workbox runtime is inlined, so just check to make sure the // correct files are output. - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(2); done(); @@ -1250,7 +1250,7 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { // We can't really mock evaluation of the service worker script when // the Workbox runtime is inlined, so just check to make sure the // correct files are output. - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); done(); @@ -1318,13 +1318,13 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ - url: 'main.20_CHARACTER_HASH.js', + url: /^main\.[0-9a-f]{20}\.js$/, revision: null, }], {}]], }}); @@ -1361,14 +1361,14 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', - url: 'https://example.org/main.20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^https:\/\/example\.org\/main\.[0-9a-f]{20}\.js/, }], {}]], }}); @@ -1422,14 +1422,14 @@ describe(`[workbox-webpack-plugin] GenerateSW (End to End)`, function() { expect(statsJson.errors, JSON.stringify(statsJson.errors)).to.be.empty; expect(statsJson.warnings).to.have.members([warningMessage]); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); await validateServiceWorkerRuntime({swFile, expectedMethodCalls: { - importScripts: [['./workbox-8_CHARACTER_HASH']], + importScripts: [[/^\.\/workbox-[0-9a-f]{8}$/]], precacheAndRoute: [[[{ revision: null, - url: 'main.20_CHARACTER_HASH.js-suffix', + url: /^main\.[0-9a-f]{20}\.js-suffix$/, }], {}]], }}); diff --git a/test/workbox-webpack-plugin/node/inject-manifest.js b/test/workbox-webpack-plugin/node/inject-manifest.js index d2101525c..06185a550 100644 --- a/test/workbox-webpack-plugin/node/inject-manifest.js +++ b/test/workbox-webpack-plugin/node/inject-manifest.js @@ -87,7 +87,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); await validateServiceWorkerRuntime({ @@ -96,11 +96,11 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', - url: 'entry2-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry2-[0-9a-f]{20}\.js$/, }, ], {}]], }, @@ -141,7 +141,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); await validateServiceWorkerRuntime({ @@ -150,11 +150,11 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', - url: 'entry2-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry2-[0-9a-f]{20}\.js$/, }, ], {}]], }, @@ -199,7 +199,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); await validateServiceWorkerRuntime({ @@ -208,10 +208,10 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'main.js', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'vendors~main.js', }, ], {}]], @@ -253,7 +253,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); await validateServiceWorkerRuntime({ @@ -262,11 +262,11 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', - url: 'entry2-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry2-[0-9a-f]{20}\.js$/, }, ], {}]], }, @@ -308,7 +308,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); await validateServiceWorkerRuntime({ @@ -317,8 +317,8 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, ], {}]], }, @@ -360,7 +360,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); await validateServiceWorkerRuntime({ @@ -369,13 +369,13 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', - url: 'entry2-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry2-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'index.html', }, ], {}]], @@ -418,7 +418,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(10); await validateServiceWorkerRuntime({ @@ -427,39 +427,39 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'images/example-jpeg.jpg', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'images/web-fundamentals-icon192x192.png', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'index.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-1.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-2.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'splitChunksEntry.js', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'styles/stylesheet-1.css', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'styles/stylesheet-2.css', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }, ], {}]], @@ -499,7 +499,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); const expectedSourcemap = await fse.readJSON( @@ -517,7 +517,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }], {}]], }, @@ -557,7 +557,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); const expectedSourcemap = await fse.readJSON( @@ -576,7 +576,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }], {}]], }, @@ -615,7 +615,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(2); await validateServiceWorkerRuntime({ @@ -623,7 +623,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }], {}]], }, @@ -665,7 +665,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(7); await validateServiceWorkerRuntime({ @@ -673,13 +673,13 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'manifest.json', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'not-ignored.js', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }], {}]], }, @@ -717,7 +717,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(4); await validateServiceWorkerRuntime({ @@ -725,13 +725,13 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'service-worker.js.map', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js.map', }], {}]], }, @@ -772,7 +772,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(10); await validateServiceWorkerRuntime({ @@ -780,13 +780,13 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'index.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-1.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-2.html', }], {}]], }, @@ -828,7 +828,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(10); await validateServiceWorkerRuntime({ @@ -836,10 +836,10 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-1.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-2.html', }], {}]], }, @@ -877,7 +877,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(2); await validateServiceWorkerRuntime({ @@ -885,7 +885,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }], {}]], }, @@ -931,7 +931,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { `The chunk 'doesNotExist' was provided in your Workbox chunks config, but was not found in the compilation.`, ]); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(2); await validateServiceWorkerRuntime({ @@ -940,8 +940,8 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, ], {}]], }, @@ -993,7 +993,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { const swFile = upath.join(outputDir, 'service-worker.js'); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(11); await validateServiceWorkerRuntime({ @@ -1002,39 +1002,39 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: 'entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^entry1-[0-9a-f]{20}\.js$/, }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'images/web-fundamentals-icon192x192.png', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'index.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-1.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'page-2.html', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'splitChunksEntry.js', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'styles/stylesheet-1.css', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'styles/stylesheet-2.css', }, { - revision: '32_CHARACTER_HASH', + revision: /^[0-9a-f]{32}$/, url: 'webpackEntry.js', }, ], {}]], @@ -1077,7 +1077,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(2); await validateServiceWorkerRuntime({ @@ -1086,8 +1086,8 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[ { - revision: '32_CHARACTER_HASH', - url: '/testing/entry1-20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^\/testing\/entry1-[0-9a-f]{20}\.js$/, }, ], {}]], }, @@ -1134,7 +1134,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { // different environments. Instead of hardcoding hash checks, just // confirm that we output the expected number of files, which will // only be true if the build was successful. - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(5); done(); @@ -1170,7 +1170,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(2); await validateServiceWorkerRuntime({ @@ -1178,7 +1178,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - url: 'main.20_CHARACTER_HASH.js', + url: /^main\.[0-9a-f]{20}\.js$/, revision: null, }], {}]], }, @@ -1218,7 +1218,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(2); await validateServiceWorkerRuntime({ @@ -1226,8 +1226,8 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', - url: 'https://example.org/main.20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^https:\/\/example\.org\/main\.[0-9a-f]{20}\.js/, }], {}]], }, }); @@ -1284,7 +1284,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expect(statsJson.errors).to.be.empty; expect(statsJson.warnings).to.have.members([warningMessage]); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(2); await validateServiceWorkerRuntime({ @@ -1293,7 +1293,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expectedMethodCalls: { precacheAndRoute: [[[{ revision: null, - url: 'main.20_CHARACTER_HASH.js-suffix', + url: /^main.[0-9a-f]{20}\.js-suffix$/, }], {}]], }, }); @@ -1378,7 +1378,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { expect(statsJson.warnings).to.have.length(0); } - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(2); resolve(); @@ -1424,7 +1424,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(3); await validateServiceWorkerRuntime({ @@ -1432,8 +1432,8 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', - url: 'main.20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^main\.[0-9a-f]{20}\.js$/, }], {}]], }, }); @@ -1443,8 +1443,8 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', - url: 'main.20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^main\.[0-9a-f]{20}\.js$/, }], {}]], }, }); @@ -1483,7 +1483,7 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { try { webpackBuildCheck(webpackError, stats); - const files = await globby(outputDir); + const files = await globby('**', {cwd: outputDir}); expect(files).to.have.length(2); await validateServiceWorkerRuntime({ @@ -1491,8 +1491,8 @@ describe(`[workbox-webpack-plugin] InjectManifest (End to End)`, function() { entryPoint: 'injectManifest', expectedMethodCalls: { precacheAndRoute: [[[{ - revision: '32_CHARACTER_HASH', - url: 'main.20_CHARACTER_HASH.js', + revision: /^[0-9a-f]{32}$/, + url: /^main\.[0-9a-f]{20}\.js$/, }], {}]], }, });