Skip to content

Commit cd1734d

Browse files
committed
test: fix error message tests on windows
1 parent 39772a5 commit cd1734d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/helpers/compareErrorMessage.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
const path = require('path');
22

3-
const projectPath = path.resolve(__dirname, '..', '..');
3+
const projectPath = path.resolve(__dirname, '..', '..').replace(/\\/g, '/');
44
const projectPathPattern = new RegExp(projectPath, 'g');
5+
const CR = /\r/g;
56

67
// We need to remove all environment dependent features
78
function compareErrorMessage(msg) {
89
const envIndependentMsg = msg
9-
.replace(projectPathPattern, '')
10-
.replace(/\\/g, '/');
10+
.replace(/\\/g, '/')
11+
.replace(CR, '')
12+
.replace(projectPathPattern, '');
1113

1214
expect(envIndependentMsg).toMatchSnapshot();
1315
}

0 commit comments

Comments
 (0)