From 258575af9ade68a28813ea79a829468b61c94f22 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Tue, 10 Jan 2017 21:51:28 +0800 Subject: [PATCH 1/2] Make `testRegex` Jest config a string instead of array. Ref. https://facebook.github.io/jest/docs/configuration.html#testregex-string. Closes #10. --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 3f2485b3..7c7567f5 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,7 @@ "setupFiles": [ "/tests_config/run_spec.js" ], - "testRegex": [ - "jsfmt\\.spec\\.js$" - ], + "testRegex": "jsfmt\\.spec\\.js$", "testPathIgnorePatterns": [ "tests/new_react", "tests/more_react" From e72347e51b3cd9d1694462856fad0047c4c6b38f Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Tue, 10 Jan 2017 21:53:09 +0800 Subject: [PATCH 2/2] Fix tests on Windows. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert CRLF into LF for Jest’s snapshot matching. --- tests_config/run_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests_config/run_spec.js b/tests_config/run_spec.js index 68c9c28f..94b96b65 100644 --- a/tests_config/run_spec.js +++ b/tests_config/run_spec.js @@ -23,7 +23,7 @@ function run_spec(dirname) { const path = dirname + '/' + filename; if (!RUN_AST_TESTS) { - const source = read(path); + const source = read(path).replace(/\r\n/g, '\n'); const output = prettyprint(source, path); test(filename, () => { expect(source + '~'.repeat(80) + '\n' + output).toMatchSnapshot();