-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow unmatched test paths from CLI (#3882)
* Allow to pass the exact test filenames * Replaced custom check with fs.existsSync(), added tests * Changed licence to MIT * Fixed tests
- Loading branch information
1 parent
ffec104
commit 9cd00e6
Showing
4 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
integration_tests/__tests__/__snapshots__/cli-accepts-exact-filenames.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`CLI accepts exact filenames 1`] = ` | ||
"PASS ./bar.js | ||
● Console | ||
console.log bar.js:2 | ||
Hey | ||
PASS foo/baz.js | ||
● Console | ||
console.log foo/baz.js:2 | ||
Hey | ||
" | ||
`; | ||
|
||
exports[`CLI accepts exact filenames 2`] = ` | ||
"Test Suites: 2 passed, 2 total | ||
Tests: 2 passed, 2 total | ||
Snapshots: 0 total | ||
Time: <<REPLACED>> | ||
Ran all test suites matching /.\\\\/bar.js|.\\\\/foo\\\\/baz.js/i. | ||
" | ||
`; | ||
exports[`CLI accepts exact filenames 3`] = `""`; |
47 changes: 47 additions & 0 deletions
47
integration_tests/__tests__/cli-accepts-exact-filenames.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const path = require('path'); | ||
const skipOnWindows = require('../../scripts/skip_on_windows'); | ||
const {extractSummary, cleanup, writeFiles} = require('../utils'); | ||
const runJest = require('../runJest'); | ||
|
||
const DIR = path.resolve(__dirname, '../cli_accepts_exact_filenames'); | ||
|
||
skipOnWindows.suite(); | ||
|
||
beforeEach(() => cleanup(DIR)); | ||
afterAll(() => cleanup(DIR)); | ||
|
||
test('CLI accepts exact filenames', () => { | ||
writeFiles(DIR, { | ||
'bar.js': ` | ||
test('bar', () => console.log('Hey')); | ||
`, | ||
'foo/baz.js': ` | ||
test('baz', () => console.log('Hey')); | ||
`, | ||
'package.json': '{}', | ||
}); | ||
|
||
const {stderr, stdout, status} = runJest(DIR, [ | ||
'-i', | ||
'--ci=false', | ||
'--forceExit', | ||
'./bar.js', | ||
'./foo/baz.js', | ||
]); | ||
const {rest, summary} = extractSummary(stderr); | ||
expect(status).toBe(0); | ||
expect(rest).toMatchSnapshot(); | ||
expect(summary).toMatchSnapshot(); | ||
expect(stdout).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters