From 19ba571f63502a8deb5d630e738d2746a9057909 Mon Sep 17 00:00:00 2001 From: Elon Mitchell Date: Tue, 21 Aug 2018 12:09:28 -0500 Subject: [PATCH 1/5] Fix the snapshot testing issue on windows The back slash should be replaced with the slash for consistent hash. --- lib/loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/loader.js b/lib/loader.js index 45edc130e..36c58ce68 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -85,7 +85,7 @@ module.exports = function (content) { this.options.context || process.cwd() const sourceRoot = path.dirname(path.relative(context, filePath)) - const shortFilePath = path.relative(context, filePath).replace(/^(\.\.[\\\/])+/, '') + const shortFilePath = path.relative(context, filePath).replace(/^(\.\.[\\\/])+/, '').replace(/\\/g, '/') const moduleId = 'data-v-' + hash(isProduction ? (shortFilePath + '\n' + content) : shortFilePath) let cssLoaderOptions = '' From 682687e22ac6c0001c14b2e28453b128d7da50cf Mon Sep 17 00:00:00 2001 From: Elon Mitchell Date: Tue, 21 Aug 2018 12:54:53 -0500 Subject: [PATCH 2/5] fix the testing issue on windows the snapshot testing fails on windows. --- lib/parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parser.js b/lib/parser.js index 5eec24ae4..ba0f25a31 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -7,7 +7,7 @@ const splitRE = /\r?\n/g const emptyRE = /^(?:\/\/)?\s*$/ module.exports = (content, filename, needMap, sourceRoot, needCSSMap) => { - const cacheKey = hash(filename + content) + const cacheKey = hash(filename + content).replace(/\\/g, '/')) let output = cache.get(cacheKey) if (output) return output output = compiler.parseComponent(content, { pad: 'line' }) From 3bb5cbcd7835eb0d36c86f203a2dd47681ba854a Mon Sep 17 00:00:00 2001 From: Elon Mitchell Date: Tue, 21 Aug 2018 12:56:44 -0500 Subject: [PATCH 3/5] fix the testing issue on windows fix for committing lib/loader.js --- test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index e87d7bc82..fbc087555 100644 --- a/test/test.js +++ b/test/test.js @@ -36,7 +36,7 @@ const globalConfig = { } function genId (file) { - return hash(path.join('test', 'fixtures', file)) + return hash(path.join('test', 'fixtures', file).replace(/\\/g, '/')) } function bundle (options, cb, wontThrowError) { From 75e0a1d34240138f52ed4ca51c40fdf4d5bc6124 Mon Sep 17 00:00:00 2001 From: Elon Mitchell Date: Tue, 21 Aug 2018 12:58:03 -0500 Subject: [PATCH 4/5] fix the testing issue on windows fix for committing lib/loader.js changes --- test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index fbc087555..44addd5d3 100644 --- a/test/test.js +++ b/test/test.js @@ -129,7 +129,7 @@ describe('vue-loader', () => { test({ entry: './test/fixtures/basic.vue' }, (window, module, rawModule) => { - expect(module.__file).to.equal(path.normalize('test/fixtures/basic.vue')) + expect(module.__file).to.equal(path.normalize('test/fixtures/basic.vue').replace(/\\/g, '/')) done() }) }) From 50bc1fc4d82afc577e1845ce045bb01e1c166c64 Mon Sep 17 00:00:00 2001 From: Elon Mitchell Date: Tue, 21 Aug 2018 13:09:01 -0500 Subject: [PATCH 5/5] fix missing symbol --- lib/parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parser.js b/lib/parser.js index ba0f25a31..a02cca317 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -7,7 +7,7 @@ const splitRE = /\r?\n/g const emptyRE = /^(?:\/\/)?\s*$/ module.exports = (content, filename, needMap, sourceRoot, needCSSMap) => { - const cacheKey = hash(filename + content).replace(/\\/g, '/')) + const cacheKey = hash((filename + content).replace(/\\/g, '/')) let output = cache.get(cacheKey) if (output) return output output = compiler.parseComponent(content, { pad: 'line' })