diff --git a/packages/babel-parser/test/misc.js b/packages/babel-parser/test/misc.js index 986629d453af8..8598cf320a97e 100644 --- a/packages/babel-parser/test/misc.js +++ b/packages/babel-parser/test/misc.js @@ -4,7 +4,9 @@ describe("misc", () => { describe("Program.extra.async", () => { it("not set for scripts", () => { const ast = parse("function f() {}", { sourceType: "script" }); - expect(ast.program.extra?.topLevelAwait).toBeUndefined(); + expect( + ast.program.extra && ast.program.extra.topLevelAwait, + ).toBeUndefined(); }); test.each([