Skip to content

Commit 8831ab3

Browse files
authored
Tests: ensuring output containing slashes is normalized to forward slashes
For windows, tests will fail since the output contains `$CWD\path` rather than `$CWD/path`. We can just replace all backslashes for now and make Windows happy. If we ever need to assert something contains a backslash, do a more complex solution here.
1 parent 85fa57d commit 8831ab3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ function getNormalizedOutput(output, options) {
106106
// the cwd is replaced with $CWD for snapshotting purposes
107107
const { cwd } = options;
108108
output = output.replaceAll(cwd, "$CWD");
109+
// We do this because snapshots on windows will have backslashes, and on
110+
// linux will have forward slashes. Since we don't care right now about
111+
// slashes, we can replace them.
112+
// If we ever need to assert that something contained a backslash, remove
113+
// this and make it configurable or do it only for paths
114+
output = output.replaceAll("\\", "/");
109115
return output;
110116
}
111117

0 commit comments

Comments
 (0)