@@ -256,6 +256,36 @@ describe("babylon-to-espree", () => {
256
256
parseAndAssertSame ( "export { foo as bar };" ) ;
257
257
} ) ;
258
258
259
+ // Espree doesn't support the optional chaining operator yet
260
+ it ( "optional chaining operator (token)" , ( ) => {
261
+ const code = "foo?.bar" ;
262
+ var babylonAST = babelEslint . parseForESLint ( code , {
263
+ eslintVisitorKeys : true ,
264
+ eslintScopeManager : true ,
265
+ } ) . ast ;
266
+ assert . strictEqual ( babylonAST . tokens [ 1 ] . type , "Punctuator" ) ;
267
+ } ) ;
268
+
269
+ // Espree doesn't support the nullish coalescing operator yet
270
+ it ( "nullish coalescing operator (token)" , ( ) => {
271
+ const code = "foo ?? bar" ;
272
+ var babylonAST = babelEslint . parseForESLint ( code , {
273
+ eslintVisitorKeys : true ,
274
+ eslintScopeManager : true ,
275
+ } ) . ast ;
276
+ assert . strictEqual ( babylonAST . tokens [ 1 ] . type , "Punctuator" ) ;
277
+ } ) ;
278
+
279
+ // Espree doesn't support the pipeline operator yet
280
+ it ( "pipeline operator (token)" , ( ) => {
281
+ const code = "foo |> bar" ;
282
+ var babylonAST = babelEslint . parseForESLint ( code , {
283
+ eslintVisitorKeys : true ,
284
+ eslintScopeManager : true ,
285
+ } ) . ast ;
286
+ assert . strictEqual ( babylonAST . tokens [ 1 ] . type , "Punctuator" ) ;
287
+ } ) ;
288
+
259
289
it . skip ( "empty program with line comment" , ( ) => {
260
290
parseAndAssertSame ( "// single comment" ) ;
261
291
} ) ;
0 commit comments