@samitouri / QOS-React / commits / b6c423daad

Use matching test command for equivalence tests (#17604)

Dan Abramov committed Dec 14, 2019 at 17:52 UTC b6c423daadaa35da3f34048628df9635505eecb1
1 file changed +7 -1
packages/react/src/__tests__/ReactClassEquivalence-test.js
+7 -1
@@ -28,7 +28,13 @@ describe('ReactClassEquivalence', () => {
28 function runJest(testFile) {
29 const cwd = process.cwd();
30 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], {
38 cwd,
39 env: Object.assign({}, process.env, {
40 REACT_CLASS_EQUIVALENCE_TEST: 'true',