Add more tests, update changelog (#11779)

* Update changelog

* Fix

* Add more tests

Co-authored-by: fisker Cheung <lionkay@gmail.com>
This commit is contained in:
Sosuke Suzukiandfisker Cheung authored and GitHub committed 2021-11-08 22:52:20 +09:00
1 parent bf3e872fe9
commit aab66b846b
5 files changed
+59 -2

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
#### Ignore errors for non-strict mode features (#11750 by @fisker, #11778 by @sosukesuzuki)
#### Ignore errors for sloppy mode syntax (#11750 by @fisker, #11778 by @sosukesuzuki)
<!-- prettier-ignore -->
```jsx
@@ -59,6 +59,55 @@ function myfunc() {
================================================================================
`;
exports[`function-declaration-in-lf.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
if (false) function foo(){}
=====================================output=====================================
if (false) function foo() {}
================================================================================
`;
exports[`function-declaration-in-while.js [espree] format 1`] = `
"Unexpected token function (1:15)
> 1 | while (false) function foo(){}
| ^
2 |"
`;
exports[`function-declaration-in-while.js [flow] format 1`] = `
"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement. (1:15)
> 1 | while (false) function foo(){}
| ^^^^^^^^^^^^^^^^
2 |"
`;
exports[`function-declaration-in-while.js [meriyah] format 1`] = `
"[1:22]: In strict mode code, functions can only be declared at top level or inside a block (1:22)
> 1 | while (false) function foo(){}
| ^
2 |"
`;
exports[`function-declaration-in-while.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
while (false) function foo(){}
=====================================output=====================================
while (false) function foo() {}
================================================================================
`;
exports[`labeled-function-declaration.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
@@ -0,0 +1 @@
if (false) function foo(){}
@@ -0,0 +1 @@
while (false) function foo(){}
+7 -1
View File
@@ -1 +1,7 @@
run_spec(__dirname, ["babel", "flow", "typescript"]);
run_spec(__dirname, ["babel", "flow", "typescript"], {
errors: {
flow: ["function-declaration-in-while.js"],
espree: ["function-declaration-in-while.js"],
meriyah: ["function-declaration-in-while.js"],
},
});