Skip to content

Commit f164f52

Browse files
committed
[skip ci] fix(tests): windows paths incorrect
1 parent 287772b commit f164f52

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

__tests__/checkLogs.helper.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ module.exports = async ({ client, projectPath, projectName, mode }) => {
2222
// Remove any quotes
2323
appBaseUrl = appBaseUrl.replace('"', '')
2424
// Base url should be root of server or packaged asar
25-
expect(appBaseUrl).toBe(isBuild ? outputPath : '/')
25+
expect(path.normalize(appBaseUrl)).toBe(
26+
isBuild ? outputPath : path.sep /* Server root */
27+
)
2628

2729
let appStatic = logs
2830
// Find __static log
@@ -45,6 +47,8 @@ module.exports = async ({ client, projectPath, projectName, mode }) => {
4547
modulePaths = modulePaths.replace(/"$/, '')
4648
// Parse modulePaths array
4749
modulePaths = modulePaths.split(',')
50+
// Normalize paths
51+
modulePaths = modulePaths.map(p => path.normalize(p))
4852
// module.paths should include path to project's node_modules unless in build
4953
if (isBuild) {
5054
expect(modulePaths).not.toContain(
@@ -65,7 +69,7 @@ module.exports = async ({ client, projectPath, projectName, mode }) => {
6569
vuePath = vuePath.replace('"', '')
6670
// Vue should be bundled and not externalized (can't check in build because of NamedModulePlugin)
6771
if (!isBuild) {
68-
expect(path.normalize(vuePath)).toBe(
72+
expect(path.posix.normalize(vuePath)).toBe(
6973
'../../../node_modules/vue/dist/vue.runtime.esm.js'
7074
)
7175
}
@@ -78,7 +82,9 @@ module.exports = async ({ client, projectPath, projectName, mode }) => {
7882
// Remove any quotes
7983
mockExternalPath = mockExternalPath.replace('"', '')
8084
// mockExternal should be externalized (can't check in build because of NamedModulePlugin)
81-
if (!isBuild) expect(path.normalize(mockExternalPath)).toBe('mockExternal')
85+
if (!isBuild) {
86+
expect(mockExternalPath).toBe('mockExternal')
87+
}
8288
})
8389

8490
await client.getMainProcessLogs().then(logs => {
@@ -105,6 +111,8 @@ module.exports = async ({ client, projectPath, projectName, mode }) => {
105111
.split('=')[1]
106112
// Parse modulePaths array
107113
modulePaths = modulePaths.split(',')
114+
// Normalize paths
115+
modulePaths = modulePaths.map(p => path.normalize(p))
108116
// module.paths should include path to project's node_modules unless in build
109117
if (isBuild) {
110118
expect(modulePaths).not.toContain(
@@ -124,6 +132,8 @@ module.exports = async ({ client, projectPath, projectName, mode }) => {
124132
// Remove any quotes
125133
mockExternalPath = mockExternalPath.replace('"', '')
126134
// mockExternal should be externalized (can't check in build because of NamedModulePlugin)
127-
if (!isBuild) expect(mockExternalPath).toBe('mockExternal')
135+
if (!isBuild) {
136+
expect(mockExternalPath).toBe('mockExternal')
137+
}
128138
})
129139
}

0 commit comments

Comments
 (0)