From 854650eea6fe382aa6606a871a11fc5011a63583 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Thu, 25 Feb 2016 16:47:07 +0000 Subject: [PATCH] fix(service-worker): fix manifest path separator Fix #251 --- lib/broccoli/service-worker-manifest.js | 10 +++++----- tests/e2e/e2e_workflow.spec.js | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/broccoli/service-worker-manifest.js b/lib/broccoli/service-worker-manifest.js index 669ae17f92b7..54289d439285 100644 --- a/lib/broccoli/service-worker-manifest.js +++ b/lib/broccoli/service-worker-manifest.js @@ -16,7 +16,7 @@ class DiffingSWManifest { this.options = options; this.firstBuild = true; } - + rebuild(diff) { var manifest = {}; if (this.firstBuild) { @@ -25,10 +25,10 @@ class DiffingSWManifest { // Read manifest from disk. manifest = this.readManifestFromCache(); } - + // Remove manifest entries for files that are no longer present. diff.removedPaths.forEach((file) => delete manifest[file]); - + // Merge the lists of added and changed paths and update their hashes in the manifest. [] .concat(diff.addedPaths) @@ -60,7 +60,7 @@ class DiffingSWManifest { var files = Object.keys(manifest).sort(); var bundleHash = this.computeBundleHash(files, manifest); var contents = files - .map((file) => `# sw.file.hash: ${this.computeFileHash(file)}\n/${file}`) + .map((file) => `# sw.file.hash: ${this.computeFileHash(file)}\n${path.sep}${file}`) .join('\n'); return `CACHE MANIFEST # sw.bundle: ng-cli @@ -95,4 +95,4 @@ ${contents} } Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = diffingPlugin.wrapDiffingPlugin(DiffingSWManifest); \ No newline at end of file +exports.default = diffingPlugin.wrapDiffingPlugin(DiffingSWManifest); diff --git a/tests/e2e/e2e_workflow.spec.js b/tests/e2e/e2e_workflow.spec.js index 2c5c3aff8565..59962b298a1f 100644 --- a/tests/e2e/e2e_workflow.spec.js +++ b/tests/e2e/e2e_workflow.spec.js @@ -76,10 +76,10 @@ describe('Basic end-to-end Workflow', function () { .readFileSync(manifestPath, {encoding: 'utf8'}) .trim() .split('\n'); - + // Check that a few critical files have been detected. - expect(lines).to.include('/index.html'); - expect(lines).to.include('/thirdparty/libs.js'); + expect(lines).to.include(`${path.sep}index.html`); + expect(lines).to.include(`${path.sep}thirdparty${path.sep}libs.js`); }); it('Perform `ng test` after initial build', function() { @@ -193,20 +193,20 @@ describe('Basic end-to-end Workflow', function () { // sh.rm('-rf', './tmp'); // tmp.teardown takes too long }); }); - + it('Turn on `noImplicitAny` in tsconfig.json and rebuild', function (done) { this.timeout(420000); - + var configFilePath = path.join(process.cwd(), 'src', 'tsconfig.json'); fs.readFile(configFilePath, 'utf8', function(err, data){ - + var config = JSON.parse(data); config.compilerOptions.noImplicitAny = true; - + fs.writeFile(configFilePath, JSON.stringify(config), function(){ //clear the dist folder sh.rm('-rf', path.join(process.cwd(), 'dist')); - + return ng([ 'build', '--silent'