Skip to content

Commit

Permalink
Fix tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Jul 12, 2019
1 parent 74cb5ca commit 504885d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/tests/themeTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class ThemeTest {
}
}

private static _normalizeNewLines(str: string): string {
return str.split(/\r\n|\n/).join('\n');
}

private readonly EXPECTED_FILE_PATH: string;
private readonly tests: SingleThemeTest[];

Expand All @@ -36,7 +40,7 @@ export class ThemeTest {
const testFileContents = ThemeTest._readFile(TEST_FILE_PATH);

this.EXPECTED_FILE_PATH = path.join(THEMES_TEST_PATH, 'tests', testFile + '.result');
this.expected = ThemeTest._readFile(this.EXPECTED_FILE_PATH);
this.expected = ThemeTest._normalizeNewLines(ThemeTest._readFile(this.EXPECTED_FILE_PATH));

// Determine the language
let language = resolver.findLanguageByExtension(path.extname(testFile)) || resolver.findLanguageByFilename(testFile);
Expand Down Expand Up @@ -74,7 +78,7 @@ export class ThemeTest {
actual[this.tests[i].themeData.themeName] = this.tests[i].actual;
}

this.actual = JSON.stringify(actual, null, '\t');
this.actual = ThemeTest._normalizeNewLines(JSON.stringify(actual, null, '\t'));
}

public writeExpected(): void {
Expand Down

0 comments on commit 504885d

Please sign in to comment.