Skip to content

Commit d14203e

Browse files
committed
test: fix tests on Windows
1 parent 0766fe7 commit d14203e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ module.exports = function (source) {
6565
}
6666

6767
// module id for scoped CSS & hot-reload
68-
const shortFilePath = path
68+
const rawShortFilePath = path
6969
.relative(context, resourcePath)
70-
.replace(/\\/g, '/')
71-
.replace(/^(\.\.\/)+/, '') +
72-
resourceQuery
70+
.replace(/^(\.\.[\/\\])+/, '')
71+
72+
const shortFilePath = rawShortFilePath.replace(/\\/g, '/') + resourceQuery
7373

7474
const id = hash(
7575
isProduction
@@ -161,7 +161,7 @@ var component = normalizer(
161161

162162
// Expose filename. This is used by the devtools and vue runtime warnings.
163163
if (!isProduction) {
164-
code += `\ncomponent.options.__file = ${JSON.stringify(shortFilePath)}`
164+
code += `\ncomponent.options.__file = ${JSON.stringify(rawShortFilePath)}`
165165
}
166166

167167
code += `\nexport default component.exports`

test/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const baseConfig = {
4343
}
4444

4545
function genId (file) {
46-
return hash(path.join('test', 'fixtures', file))
46+
return hash(path.join('test', 'fixtures', file).replace(/\\/g, '/'))
4747
}
4848

4949
function bundle (options, cb, wontThrowError) {

0 commit comments

Comments
 (0)