Skip to content

Commit b6c423d

Browse files
authored
Use matching test command for equivalence tests (#17604)
1 parent 8a347ed commit b6c423d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/react/src/__tests__/ReactClassEquivalence-test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ describe('ReactClassEquivalence', () => {
2828
function runJest(testFile) {
2929
const cwd = process.cwd();
3030
const extension = process.platform === 'win32' ? '.cmd' : '';
31-
const result = spawnSync('yarn' + extension, ['test', testFile], {
31+
const command = process.env.npm_lifecycle_event;
32+
if (!command.startsWith('test')) {
33+
throw new Error(
34+
'Expected this test to run as a result of one of test commands.',
35+
);
36+
}
37+
const result = spawnSync('yarn' + extension, [command, testFile], {
3238
cwd,
3339
env: Object.assign({}, process.env, {
3440
REACT_CLASS_EQUIVALENCE_TEST: 'true',

0 commit comments

Comments
 (0)