diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c8a64f57487..3f37dede68c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Fixes * `[expect]` toMatchObject throws TypeError when a source property is null ([#6313](https://github.com/facebook/jest/pull/6313)) +* `[jest-cli]` Normalize slashes in paths in CLI output on Windows ((#6310)[https://github.com/facebook/jest/pull/6310]) ## 23.0.1 diff --git a/integration-tests/Utils.js b/integration-tests/Utils.js index 01c668940707..85265ae39178 100644 --- a/integration-tests/Utils.js +++ b/integration-tests/Utils.js @@ -48,15 +48,6 @@ const linkJestPackage = (packageName: string, cwd: Path) => { fs.symlinkSync(packagePath, destination, 'dir'); }; -const fileExists = (filePath: Path) => { - try { - fs.accessSync(filePath, fs.F_OK); - return true; - } catch (e) { - return false; - } -}; - const makeTemplate = (str: string): ((values?: Array) => string) => { return (values: ?Array) => { return str.replace(/\$(\d+)/g, (match, number) => { @@ -175,14 +166,25 @@ const cleanupStackTrace = (output: string) => { .replace(/^.*at.*[\s][\(]?(\S*\:\d*\:\d*).*$/gm, ' at $1'); }; +const normalizeIcons = (str: string) => { + if (!str) { + return str; + } + + // Make sure to keep in sync with `jest-cli/src/constants` + return str + .replace(new RegExp('\u00D7', 'g'), '\u2715') + .replace(new RegExp('\u221A', 'g'), '\u2713'); +}; + module.exports = { cleanup, copyDir, createEmptyPackage, extractSummary, - fileExists, linkJestPackage, makeTemplate, + normalizeIcons, run, writeFiles, }; diff --git a/integration-tests/__tests__/__snapshots__/jest.config.js.test.js.snap b/integration-tests/__tests__/__snapshots__/jest.config.js.test.js.snap index 8cf2b3947dd5..d7080456d7bc 100644 --- a/integration-tests/__tests__/__snapshots__/jest.config.js.test.js.snap +++ b/integration-tests/__tests__/__snapshots__/jest.config.js.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`traverses directory tree up until it finds jest.config 1`] = ` -" console.log ../../../__tests__/a-banana.js:3 +" console.log ../../../__tests__/a-banana.js:4 <>/jest.config.js/some/nested/directory " `; diff --git a/integration-tests/__tests__/compare_dom_nodes.test.js b/integration-tests/__tests__/compare_dom_nodes.test.js index c954b66d1b21..58cc42b41d19 100644 --- a/integration-tests/__tests__/compare_dom_nodes.test.js +++ b/integration-tests/__tests__/compare_dom_nodes.test.js @@ -8,11 +8,8 @@ */ 'use strict'; -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const runJest = require('../runJest'); -SkipOnWindows.suite(); - test('does not crash when expect involving a DOM node fails', () => { const result = runJest('compare-dom-nodes'); diff --git a/integration-tests/__tests__/console.test.js b/integration-tests/__tests__/console.test.js index f1870d5042b7..807fc418744a 100644 --- a/integration-tests/__tests__/console.test.js +++ b/integration-tests/__tests__/console.test.js @@ -9,12 +9,9 @@ 'use strict'; -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {extractSummary} = require('../Utils'); const runJest = require('../runJest'); -SkipOnWindows.suite(); - test('console printing', () => { const {stderr, status} = runJest('console'); const {summary, rest} = extractSummary(stderr); diff --git a/integration-tests/__tests__/console_log_output_when_run_in_band.test.js b/integration-tests/__tests__/console_log_output_when_run_in_band.test.js index 73b7a90c5e51..16be4ca0e33a 100644 --- a/integration-tests/__tests__/console_log_output_when_run_in_band.test.js +++ b/integration-tests/__tests__/console_log_output_when_run_in_band.test.js @@ -10,14 +10,11 @@ 'use strict'; const path = require('path'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {extractSummary, cleanup, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(__dirname, '../console_log_output_when_run_in_band'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/coverage_report.test.js b/integration-tests/__tests__/coverage_report.test.js index 4a080e71f8d6..caa1644a5028 100644 --- a/integration-tests/__tests__/coverage_report.test.js +++ b/integration-tests/__tests__/coverage_report.test.js @@ -10,14 +10,11 @@ const fs = require('fs'); const path = require('path'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {extractSummary} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(__dirname, '../coverage-report'); -SkipOnWindows.suite(); - test('outputs coverage report', () => { const {stdout, status} = runJest(DIR, ['--no-cache', '--coverage']); const coverageDir = path.resolve(__dirname, '../coverage-report/coverage'); diff --git a/integration-tests/__tests__/coverage_threshold.test.js b/integration-tests/__tests__/coverage_threshold.test.js index a8493959a4b7..3a53c5ef426a 100644 --- a/integration-tests/__tests__/coverage_threshold.test.js +++ b/integration-tests/__tests__/coverage_threshold.test.js @@ -10,14 +10,11 @@ 'use strict'; const path = require('path'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {cleanup, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(__dirname, '../coverage-threshold'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/custom_matcher_stack_trace.test.js b/integration-tests/__tests__/custom_matcher_stack_trace.test.js index 1023dae042fe..badef8314bb3 100644 --- a/integration-tests/__tests__/custom_matcher_stack_trace.test.js +++ b/integration-tests/__tests__/custom_matcher_stack_trace.test.js @@ -10,9 +10,6 @@ const runJest = require('../runJest'); const {extractSummary} = require('../Utils'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); - -SkipOnWindows.suite(); test('works with custom matchers', () => { const {stderr} = runJest('custom-matcher-stack-trace'); diff --git a/integration-tests/__tests__/custom_reporters.test.js b/integration-tests/__tests__/custom_reporters.test.js index 5fd586507f1c..7dd8ebe23704 100644 --- a/integration-tests/__tests__/custom_reporters.test.js +++ b/integration-tests/__tests__/custom_reporters.test.js @@ -8,7 +8,6 @@ */ 'use strict'; -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {cleanup, extractSummary, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const os = require('os'); @@ -20,8 +19,6 @@ beforeEach(() => cleanup(DIR)); afterEach(() => cleanup(DIR)); describe('Custom Reporters Integration', () => { - SkipOnWindows.suite(); - test('valid string format for adding reporters', () => { const reporterConfig = { reporters: ['/reporters/TestReporter.js'], diff --git a/integration-tests/__tests__/debug.test.js b/integration-tests/__tests__/debug.test.js index 6062b6e9a7ba..ac8af5ad2c22 100644 --- a/integration-tests/__tests__/debug.test.js +++ b/integration-tests/__tests__/debug.test.js @@ -7,12 +7,9 @@ */ const path = require('path'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const runJest = require('../runJest'); describe('jest --debug', () => { - SkipOnWindows.suite(); - const dir = path.resolve(__dirname, '..', 'verbose-reporter'); it('outputs debugging info before running the test', () => { diff --git a/integration-tests/__tests__/each.test.js b/integration-tests/__tests__/each.test.js index 6e49091519be..19d25c11a6f1 100644 --- a/integration-tests/__tests__/each.test.js +++ b/integration-tests/__tests__/each.test.js @@ -13,10 +13,8 @@ const path = require('path'); const runJest = require('../runJest'); const {extractSummary} = require('../Utils'); const dir = path.resolve(__dirname, '../each'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const SkipOnJestCircus = require('../../scripts/SkipOnJestCircus'); -SkipOnWindows.suite(); SkipOnJestCircus.suite(); test('works with passing tests', () => { diff --git a/integration-tests/__tests__/execute-tests-once-in-mpr.js b/integration-tests/__tests__/execute-tests-once-in-mpr.js index a9cb3c0763ef..426e69171565 100644 --- a/integration-tests/__tests__/execute-tests-once-in-mpr.js +++ b/integration-tests/__tests__/execute-tests-once-in-mpr.js @@ -10,14 +10,11 @@ 'use strict'; const path = require('path'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {extractSummary, cleanup, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(__dirname, '../execute-tests-once-in-mpr'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/expect-async-matcher.test.js b/integration-tests/__tests__/expect-async-matcher.test.js index 85e668718385..bdbb480e8a12 100644 --- a/integration-tests/__tests__/expect-async-matcher.test.js +++ b/integration-tests/__tests__/expect-async-matcher.test.js @@ -10,13 +10,10 @@ 'use strict'; const path = require('path'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const runJest = require('../runJest'); const {extractSummary} = require('../Utils'); const dir = path.resolve(__dirname, '../expect-async-matcher'); -SkipOnWindows.suite(); - test('works with passing tests', () => { const result = runJest(dir, ['success.test.js']); expect(result.status).toBe(0); diff --git a/integration-tests/__tests__/failures.test.js b/integration-tests/__tests__/failures.test.js index df50d5f85dec..d8ee86c8b759 100644 --- a/integration-tests/__tests__/failures.test.js +++ b/integration-tests/__tests__/failures.test.js @@ -8,7 +8,6 @@ */ const path = require('path'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {extractSummary} = require('../Utils'); const runJest = require('../runJest'); @@ -16,8 +15,6 @@ const dir = path.resolve(__dirname, '../failures'); const normalizeDots = text => text.replace(/\.{1,}$/gm, '.'); -SkipOnWindows.suite(); - function cleanStderr(stderr) { const {rest} = extractSummary(stderr); return rest diff --git a/integration-tests/__tests__/find_related_files.test.js b/integration-tests/__tests__/find_related_files.test.js index ffa924d257ff..01828d3b4be3 100644 --- a/integration-tests/__tests__/find_related_files.test.js +++ b/integration-tests/__tests__/find_related_files.test.js @@ -15,11 +15,8 @@ import path from 'path'; const {cleanup, writeFiles, extractSummary} = require('../Utils'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const DIR = path.resolve(os.tmpdir(), 'find_related_tests_test'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterEach(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/force_exit.test.js b/integration-tests/__tests__/force_exit.test.js index dd48784ec6f1..df39f1b36ec0 100644 --- a/integration-tests/__tests__/force_exit.test.js +++ b/integration-tests/__tests__/force_exit.test.js @@ -14,11 +14,8 @@ import os from 'os'; import path from 'path'; const {cleanup, writeFiles} = require('../Utils'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const DIR = path.resolve(os.tmpdir(), 'force_exit_test'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterEach(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/globals.test.js b/integration-tests/__tests__/globals.test.js index 47617b9ea181..af217505bd65 100644 --- a/integration-tests/__tests__/globals.test.js +++ b/integration-tests/__tests__/globals.test.js @@ -11,7 +11,6 @@ const path = require('path'); const os = require('os'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const runJest = require('../runJest'); const {extractSummary} = require('../Utils'); const {createEmptyPackage, writeFiles, cleanup} = require('../Utils'); @@ -19,8 +18,6 @@ const {createEmptyPackage, writeFiles, cleanup} = require('../Utils'); const DIR = path.resolve(os.tmpdir(), 'global-variables.test'); const TEST_DIR = path.resolve(DIR, '__tests__'); -SkipOnWindows.suite(); - function cleanStderr(stderr) { const {rest} = extractSummary(stderr); return rest.replace(/.*(jest-jasmine2|jest-circus).*\n/g, ''); diff --git a/integration-tests/__tests__/jest.config.js.test.js b/integration-tests/__tests__/jest.config.js.test.js index d4da0512252c..7174bf6d79ac 100644 --- a/integration-tests/__tests__/jest.config.js.test.js +++ b/integration-tests/__tests__/jest.config.js.test.js @@ -10,14 +10,11 @@ 'use strict'; const path = require('path'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {extractSummary, cleanup, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(__dirname, '../jest.config.js'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); @@ -38,8 +35,9 @@ test('works with jest.config.js', () => { test('traverses directory tree up until it finds jest.config', () => { writeFiles(DIR, { '__tests__/a-banana.js': ` + const slash = require('slash'); test('banana', () => expect(1).toBe(1)); - test('abc', () => console.log(process.cwd())); + test('abc', () => console.log(slash(process.cwd()))); `, 'jest.config.js': `module.exports = {testRegex: '.*-banana.js'};`, 'package.json': '{}', diff --git a/integration-tests/__tests__/jest_require_actual.test.js b/integration-tests/__tests__/jest_require_actual.test.js index 37cde924a196..8a07876b1d70 100644 --- a/integration-tests/__tests__/jest_require_actual.test.js +++ b/integration-tests/__tests__/jest_require_actual.test.js @@ -11,14 +11,11 @@ const path = require('path'); const os = require('os'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {cleanup, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(os.tmpdir(), 'jest_require_actual_test'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/jest_require_mock.test.js b/integration-tests/__tests__/jest_require_mock.test.js index 8b1e6b19437b..5d7ab9e38475 100644 --- a/integration-tests/__tests__/jest_require_mock.test.js +++ b/integration-tests/__tests__/jest_require_mock.test.js @@ -11,14 +11,11 @@ const path = require('path'); const os = require('os'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {cleanup, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(os.tmpdir(), 'jest_require_mock_test'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/log_heap_usage.test.js b/integration-tests/__tests__/log_heap_usage.test.js index 12de67c22e26..7145d8652595 100644 --- a/integration-tests/__tests__/log_heap_usage.test.js +++ b/integration-tests/__tests__/log_heap_usage.test.js @@ -11,14 +11,11 @@ const path = require('path'); const os = require('os'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {cleanup, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(os.tmpdir(), 'log_heap_usage_test'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/module_name_mapper.test.js b/integration-tests/__tests__/module_name_mapper.test.js index a26725165da7..4fda58c72e85 100644 --- a/integration-tests/__tests__/module_name_mapper.test.js +++ b/integration-tests/__tests__/module_name_mapper.test.js @@ -9,12 +9,8 @@ 'use strict'; const runJest = require('../runJest'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {extractSummary} = require('../Utils'); -// Works on windows, we just need to adjust snapshot test output -SkipOnWindows.suite(); - test('moduleNameMapper wrong configuration', () => { const {stderr, status} = runJest('module-name-mapper-wrong-config'); const {rest} = extractSummary(stderr); diff --git a/integration-tests/__tests__/multi_project_runner.test.js b/integration-tests/__tests__/multi_project_runner.test.js index 5578fddcdc6c..4ecf778c55ed 100644 --- a/integration-tests/__tests__/multi_project_runner.test.js +++ b/integration-tests/__tests__/multi_project_runner.test.js @@ -15,11 +15,8 @@ import path from 'path'; import stripAnsi from 'strip-ansi'; const {cleanup, extractSummary, writeFiles} = require('../Utils'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const DIR = path.resolve(os.tmpdir(), 'multi_project_runner_test'); -SkipOnWindows.suite(); - const fileContentWithProvidesModule = name => `/* * @providesModule ${name} */ diff --git a/integration-tests/__tests__/run_tests_by_path.test.js b/integration-tests/__tests__/run_tests_by_path.test.js index c60aa6d489c6..2e9b555de4e7 100644 --- a/integration-tests/__tests__/run_tests_by_path.test.js +++ b/integration-tests/__tests__/run_tests_by_path.test.js @@ -14,11 +14,8 @@ import os from 'os'; import path from 'path'; const {cleanup, writeFiles} = require('../Utils'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const DIR = path.resolve(os.tmpdir(), 'run_tests_by_path_test'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterEach(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/snapshot.test.js b/integration-tests/__tests__/snapshot.test.js index ca4d40e012c5..4a63d2a3e94b 100644 --- a/integration-tests/__tests__/snapshot.test.js +++ b/integration-tests/__tests__/snapshot.test.js @@ -13,9 +13,6 @@ const path = require('path'); const {extractSummary} = require('../Utils'); const runJest = require('../runJest'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); -SkipOnWindows.suite(); - const emptyTest = 'describe("", () => {it("", () => {})})'; const snapshotDir = path.resolve( __dirname, diff --git a/integration-tests/__tests__/test_failure_exit_code.test.js b/integration-tests/__tests__/test_failure_exit_code.test.js index 40d5a3ec234e..6212f37c1387 100644 --- a/integration-tests/__tests__/test_failure_exit_code.test.js +++ b/integration-tests/__tests__/test_failure_exit_code.test.js @@ -11,14 +11,11 @@ const path = require('path'); const os = require('os'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {cleanup, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(os.tmpdir(), 'test_failure_exit_code_test'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/test_path_pattern_reporter_message.test.js b/integration-tests/__tests__/test_path_pattern_reporter_message.test.js index ae0675f8ef24..6e14e83fc77a 100644 --- a/integration-tests/__tests__/test_path_pattern_reporter_message.test.js +++ b/integration-tests/__tests__/test_path_pattern_reporter_message.test.js @@ -13,11 +13,8 @@ import os from 'os'; import path from 'path'; const {cleanup, writeFiles} = require('../Utils'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const DIR = path.resolve(os.tmpdir(), 'jest_path_pattern_reporter_message'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterEach(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/timeouts.test.js b/integration-tests/__tests__/timeouts.test.js index 70c5dfbc3468..50de0186fc5e 100644 --- a/integration-tests/__tests__/timeouts.test.js +++ b/integration-tests/__tests__/timeouts.test.js @@ -9,14 +9,11 @@ 'use strict'; const path = require('path'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {extractSummary, cleanup, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(__dirname, '../timeouts'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/transform-linked-modules.test.js b/integration-tests/__tests__/transform-linked-modules.test.js index 195aba9cd8b6..fe257ad3eb45 100644 --- a/integration-tests/__tests__/transform-linked-modules.test.js +++ b/integration-tests/__tests__/transform-linked-modules.test.js @@ -2,11 +2,8 @@ 'use strict'; -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const runJest = require('../runJest'); -SkipOnWindows.suite(); - it('should transform linked modules', () => { const result = runJest.json('transform-linked-modules', ['--no-cache']).json; diff --git a/integration-tests/__tests__/use_stderr.test.js b/integration-tests/__tests__/use_stderr.test.js index d09451cc981e..fc5b14576d6a 100644 --- a/integration-tests/__tests__/use_stderr.test.js +++ b/integration-tests/__tests__/use_stderr.test.js @@ -14,11 +14,8 @@ import os from 'os'; import path from 'path'; const {cleanup, writeFiles} = require('../Utils'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const DIR = path.resolve(os.tmpdir(), 'use_stderr_test'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterEach(() => cleanup(DIR)); diff --git a/integration-tests/__tests__/version.test.js b/integration-tests/__tests__/version.test.js index b79be3d04aa5..e852de8dcf3d 100644 --- a/integration-tests/__tests__/version.test.js +++ b/integration-tests/__tests__/version.test.js @@ -11,14 +11,11 @@ const path = require('path'); const os = require('os'); -const SkipOnWindows = require('../../scripts/SkipOnWindows'); const {cleanup, writeFiles} = require('../Utils'); const runJest = require('../runJest'); const DIR = path.resolve(os.tmpdir(), 'version_test'); -SkipOnWindows.suite(); - beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); diff --git a/integration-tests/runJest.js b/integration-tests/runJest.js index 4bf972add1bf..c4b859c0ee5c 100644 --- a/integration-tests/runJest.js +++ b/integration-tests/runJest.js @@ -9,9 +9,10 @@ 'use strict'; const path = require('path'); +const fs = require('fs'); const execa = require('execa'); const {Writable} = require('readable-stream'); -const {fileExists} = require('./Utils'); +const {normalizeIcons} = require('./Utils'); const {sync: spawnSync} = execa; @@ -37,7 +38,7 @@ function runJest( } const localPackageJson = path.resolve(dir, 'package.json'); - if (!options.skipPkgJsonCheck && !fileExists(localPackageJson)) { + if (!options.skipPkgJsonCheck && !fs.existsSync(localPackageJson)) { throw new Error( ` Make sure you have a local package.json file at @@ -63,6 +64,9 @@ function runJest( // For compat with cross-spawn result.status = result.code; + result.stdout = normalizeIcons(result.stdout); + result.stderr = normalizeIcons(result.stderr); + return result; } @@ -102,7 +106,7 @@ runJest.until = async function( } const localPackageJson = path.resolve(dir, 'package.json'); - if (!options.skipPkgJsonCheck && !fileExists(localPackageJson)) { + if (!options.skipPkgJsonCheck && !fs.existsSync(localPackageJson)) { throw new Error( ` Make sure you have a local package.json file at @@ -145,6 +149,9 @@ runJest.until = async function( // For compat with cross-spawn result.status = result.code; + result.stdout = normalizeIcons(result.stdout); + result.stderr = normalizeIcons(result.stderr); + return result; }; diff --git a/packages/expect/src/__tests__/assertion_counts.test.js b/packages/expect/src/__tests__/assertion_counts.test.js index a79a55dfc4af..6b59e8ae134d 100644 --- a/packages/expect/src/__tests__/assertion_counts.test.js +++ b/packages/expect/src/__tests__/assertion_counts.test.js @@ -10,8 +10,6 @@ const jestExpect = require('../'); -const SkipOnWindows = require('../../../../scripts/SkipOnWindows'); - describe('.assertions()', () => { it('does not throw', () => { jestExpect.assertions(2); @@ -31,7 +29,6 @@ describe('.assertions()', () => { }); describe('.hasAssertions()', () => { - SkipOnWindows.suite(); it('does not throw if there is an assertion', () => { jestExpect.hasAssertions(); jestExpect('a').toBe('a'); diff --git a/packages/jest-cli/src/reporters/utils.js b/packages/jest-cli/src/reporters/utils.js index 67b2d776fdab..30bbf4b07c51 100644 --- a/packages/jest-cli/src/reporters/utils.js +++ b/packages/jest-cli/src/reporters/utils.js @@ -76,7 +76,7 @@ export const formatTestPath = ( testPath: Path, ) => { const {dirname, basename} = relativePath(config, testPath); - return chalk.dim(dirname + path.sep) + chalk.bold(basename); + return slash(chalk.dim(dirname + path.sep) + chalk.bold(basename)); }; export const relativePath = ( diff --git a/packages/jest-util/package.json b/packages/jest-util/package.json index 876607b74736..cb446878291e 100644 --- a/packages/jest-util/package.json +++ b/packages/jest-util/package.json @@ -14,6 +14,7 @@ "is-ci": "^1.0.10", "jest-message-util": "^23.0.0", "mkdirp": "^0.5.1", + "slash": "^1.0.0", "source-map": "^0.6.0" }, "devDependencies": { diff --git a/packages/jest-util/src/get_console_output.js b/packages/jest-util/src/get_console_output.js index 0a7ea41a32c9..36d21e57e9f1 100644 --- a/packages/jest-util/src/get_console_output.js +++ b/packages/jest-util/src/get_console_output.js @@ -11,13 +11,14 @@ import type {ConsoleBuffer} from 'types/Console'; import path from 'path'; import chalk from 'chalk'; +import slash from 'slash'; export default (root: string, verbose: boolean, buffer: ConsoleBuffer) => { const TITLE_INDENT = verbose ? ' ' : ' '; const CONSOLE_INDENT = TITLE_INDENT + ' '; return buffer.reduce((output, {type, message, origin}) => { - origin = path.relative(root, origin); + origin = slash(path.relative(root, origin)); message = message .split(/\n/) .map(line => CONSOLE_INDENT + line)