-
-
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 (#5582)
* Don't skip configured matchers for exact file names * Just use one file in test
- Loading branch information
1 parent
4d4bc67
commit 950b2e7
Showing
6 changed files
with
81 additions
and
114 deletions.
There are no files selected for viewing
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
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 foo/bar.spec.js | ||
✓ foo | ||
" | ||
`; | ||
|
||
exports[`CLI accepts exact file names if matchers matched 2`] = ` | ||
"Test Suites: 1 passed, 1 total | ||
Tests: 1 passed, 1 total | ||
Snapshots: 0 total | ||
Time: <<REPLACED>> | ||
Ran all test suites matching /.\\\\/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.
56 changes: 56 additions & 0 deletions
56
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,56 @@ | ||
/** | ||
* 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, { | ||
'foo/bar.spec.js': ` | ||
test('foo', () => {}); | ||
`, | ||
'package.json': JSON.stringify({jest: {testEnvironment: 'node'}}), | ||
}); | ||
|
||
const result = runJest(DIR, ['-i', '--forceExit', './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, { | ||
'foo/bar.js': ` | ||
test('foo', () => {); | ||
`, | ||
'package.json': JSON.stringify({jest: {testEnvironment: 'node'}}), | ||
}); | ||
|
||
const result = runJest(DIR, ['-i', '--forceExit', './foo/bar.js']); | ||
|
||
expect(result.status).toBe(1); | ||
expect(result.stdout).toMatch(/No tests found([\S\s]*)2 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