Skip to content

Commit

Permalink
Use matching test command for equivalence tests (#17604)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Dec 14, 2019
1 parent 8a347ed commit b6c423d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/react/src/__tests__/ReactClassEquivalence-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ describe('ReactClassEquivalence', () => {
function runJest(testFile) {
const cwd = process.cwd();
const extension = process.platform === 'win32' ? '.cmd' : '';
const result = spawnSync('yarn' + extension, ['test', testFile], {
const command = process.env.npm_lifecycle_event;
if (!command.startsWith('test')) {
throw new Error(
'Expected this test to run as a result of one of test commands.',
);
}
const result = spawnSync('yarn' + extension, [command, testFile], {
cwd,
env: Object.assign({}, process.env, {
REACT_CLASS_EQUIVALENCE_TEST: 'true',
Expand Down

0 comments on commit b6c423d

Please sign in to comment.