Skip to content

Commit 7a610e8

Browse files
committed
Expect optional chaining test to fail iif babel<7
1 parent 00c950c commit 7a610e8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

__tests__/src/getPropValue-test.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,21 @@ describe('getPropValue', () => {
359359
});
360360

361361
it('should evaluate to a correct representation of member expression with a nullable member', () => {
362-
// This tell will not throw when Babel is upgraded from 6 to 7. Remove
363-
// the throw expectation wrapper at that time.
364-
// eslint-disable-next-line no-undef
365-
expect(() => {
362+
const runTest = () => {
366363
const prop = extractProp('<div foo={bar?.baz} />');
367364

368365
const expected = 'bar?.baz';
369366
const actual = getPropValue(prop);
370367

371368
assert.equal(expected, actual);
372-
}).toThrow();
369+
};
370+
371+
if (fallbackToBabylon) {
372+
// eslint-disable-next-line no-undef
373+
expect(runTest).toThrow();
374+
} else {
375+
runTest();
376+
}
373377
});
374378
});
375379

0 commit comments

Comments
 (0)