Skip to content

Commit

Permalink
Fix regression on non-matching suites (#6415) (#6657)
Browse files Browse the repository at this point in the history
## Summary

Fix a regression on jest-jasmine for non marching test suites.
#6415

## Test plan
https://github.com/Crispioso/possible-jest-bug
  • Loading branch information
jbdemonte authored and thymikee committed Jul 8, 2018
1 parent e44325d commit 064a8bc
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- `[jest-runner]` Force parallel runs for watch mode, to avoid TTY freeze ([#6647](https://github.com/facebook/jest/pull/6647))
- `[jest-cli]` properly reprint resolver errors in watch mode ([#6407](https://github.com/facebook/jest/pull/6407))
- `[jest-cli]` Write configuration to stdout when the option was explicitly passed to Jest ([#6447](https://github.com/facebook/jest/pull/6447))
- `[jest-cli]` Fix regression on non-matching suites ([6657](https://github.com/facebook/jest/pull/6657))

## 23.3.0

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`testNamePattern skipped 1`] = `
"Test Suites: 1 passed, 1 total
Tests: 1 skipped, 1 passed, 2 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites with tests matching \\"false\\"."
`;
23 changes: 23 additions & 0 deletions e2e/__tests__/test_name_pattern_skipped.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* 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 {extractSummary} = require('../Utils');
const runJest = require('../runJest');

test('testNamePattern skipped', () => {
const {stderr, status} = runJest.json('testNamePattern_skipped', [
'--testNamePattern',
'false',
]);
const {summary} = extractSummary(stderr);

expect(status).toBe(0);
expect(summary).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* 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.
*/
'use strict';

describe('First suite', () => {
it('true equals true', () => {
expect(true).toBe(true);
});
});

describe('Second suite', () => {
it('false equals false', () => {
expect(false).toBe(false);
});
});
5 changes: 5 additions & 0 deletions e2e/testNamePattern_skipped/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jest": {
"testEnvironment": "node"
}
}
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/tree_processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function treeProcessor(options: Options) {
fn: getNodeHandler(child, enabled),
}));
if (!hasEnabledTest(node)) {
return [];
return children;
}
return node.beforeAllFns.concat(children).concat(node.afterAllFns);
}
Expand Down

0 comments on commit 064a8bc

Please sign in to comment.