Skip to content

Commit

Permalink
Split new line on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
yukukotani committed Feb 5, 2020
1 parent 5765aef commit d60e3ed
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions __tests__/integration/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ function stripBenchmark(stdout) {
return stdout.replace(/\s*\[\d+\.?\d+s\](\n?)/g, '$1'); //remove benchmark
}
function stripWhitespace(stdout) {
return stdout.replace(/\s+$/gm, '');
// stdout.replace(/\s+$/gm, '');
// return stdout.replace(/(\s|(\r\n)|(\\n))+/gm, '');
return stdout.replace(/((\s+$)|((\r\n)|(\\n)))/gm, '');
}

beforeAll(() => {
Expand Down Expand Up @@ -54,10 +56,6 @@ for (const testName of readdirSync(__dirname)) {
// NOTE: We only compare files so that we give the test runner a more detailed diff.
return;
}
// NOTE: Skip source map on Windows, because generated source map has different newline code (CRLF).
if (process.platform === 'win32' && entry.name1.endsWith('.js.map')) {
return;
}
return assert.strictEqual(
stripWhitespace(readFileSync(path.join(entry.path1, entry.name1), {encoding: 'utf8'})),
stripWhitespace(readFileSync(path.join(entry.path2, entry.name2), {encoding: 'utf8'})),
Expand Down

0 comments on commit d60e3ed

Please sign in to comment.