-
-
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.
Don't skip configured matchers for exact file names
- Loading branch information
1 parent
966aab6
commit 6ce0afe
Showing
5 changed files
with
96 additions
and
114 deletions.
There are no files selected for viewing
29 changes: 0 additions & 29 deletions
29
integration-tests/__tests__/__snapshots__/cli-accepts-exact-filenames.test.js.snap
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
integration-tests/__tests__/__snapshots__/cli-handles-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,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`CLI accepts exact file names if matchers matched 1`] = ` | ||
"PASS ./bar.spec.js | ||
PASS foo/bar.spec.js | ||
" | ||
`; | ||
|
||
exports[`CLI accepts exact file names if matchers matched 2`] = ` | ||
"Test Suites: 2 passed, 2 total | ||
Tests: 2 passed, 2 total | ||
Snapshots: 0 total | ||
Time: <<REPLACED>> | ||
Ran all test suites matching /.\\\\/bar.spec.js|.\\\\/foo\\\\/bar.spec.js/i. | ||
" | ||
`; | ||
exports[`CLI accepts exact file names if matchers matched 3`] = `""`; |
51 changes: 0 additions & 51 deletions
51
integration-tests/__tests__/cli-accepts-exact-filenames.test.js
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
integration-tests/__tests__/cli-handles-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,72 @@ | ||
/** | ||
* 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/SkipOnWindows'); | ||
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 file names if matchers matched', () => { | ||
writeFiles(DIR, { | ||
'bar.spec.js': ` | ||
test('bar', () => {}); | ||
`, | ||
'foo/bar.spec.js': ` | ||
test('foo', () => {}); | ||
`, | ||
'package.json': JSON.stringify({jest: {testEnvironment: 'node'}}), | ||
}); | ||
|
||
const result = runJest(DIR, [ | ||
'-i', | ||
'--forceExit', | ||
'./bar.spec.js', | ||
'./foo/bar.spec.js', | ||
]); | ||
|
||
expect(result.status).toBe(0); | ||
|
||
const {rest, summary} = extractSummary(result.stderr); | ||
|
||
expect(rest).toMatchSnapshot(); | ||
expect(summary).toMatchSnapshot(); | ||
expect(result.stdout).toMatchSnapshot(); | ||
}); | ||
|
||
test('CLI skips exact file names if no matchers matched', () => { | ||
writeFiles(DIR, { | ||
'bar.js': ` | ||
test('bar', () => {); | ||
`, | ||
'foo/bar.js': ` | ||
test('foo', () => {); | ||
`, | ||
'package.json': JSON.stringify({jest: {testEnvironment: 'node'}}), | ||
}); | ||
|
||
const result = runJest(DIR, [ | ||
'-i', | ||
'--forceExit', | ||
'./bar.js', | ||
'./foo/bar.js', | ||
]); | ||
|
||
expect(result.status).toBe(1); | ||
expect(result.stdout).toMatch(/No tests found([\S\s]*)3 files checked./); | ||
expect(result.stderr).toEqual(''); | ||
}); |
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