diff --git a/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap b/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap index bd4aa50ec939..0f2a1173a148 100644 --- a/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/js/import-assertions/__snapshots__/jsfmt.spec.js.snap @@ -101,6 +101,34 @@ import json from "./foo.json" assert { type: "json", type: "bar" }; ================================================================================ `; +exports[`non-type.js [espree] format 1`] = ` +"Unexpected token assert (1:28) +> 1 | import foo from \\"foo.json\\" assert { lazy: \\"true\\" }; + | ^ + 2 |" +`; + +exports[`non-type.js [meriyah] format 1`] = ` +"[1:33]: Unexpected token: 'identifier' (1:33) +> 1 | import foo from \\"foo.json\\" assert { lazy: \\"true\\" }; + | ^ + 2 |" +`; + +exports[`non-type.js format 1`] = ` +====================================options===================================== +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +import foo from "foo.json" assert { lazy: "true" }; + +=====================================output===================================== +import foo from "foo.json" assert { lazy: "true" }; + +================================================================================ +`; + exports[`not-import-assertions.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/format/js/import-assertions/jsfmt.spec.js b/tests/format/js/import-assertions/jsfmt.spec.js index 69aab7bca670..60cc369735ce 100644 --- a/tests/format/js/import-assertions/jsfmt.spec.js +++ b/tests/format/js/import-assertions/jsfmt.spec.js @@ -7,6 +7,7 @@ run_spec(__dirname, ["babel"], { "static-import.js", "re-export.js", "without-from.js", + "non-type.js", ], meriyah: [ "dynamic-import.js", @@ -15,6 +16,7 @@ run_spec(__dirname, ["babel"], { "static-import.js", "re-export.js", "without-from.js", + "non-type.js", ], }, }); diff --git a/tests/format/js/import-assertions/non-type.js b/tests/format/js/import-assertions/non-type.js new file mode 100644 index 000000000000..bdcedd93bb26 --- /dev/null +++ b/tests/format/js/import-assertions/non-type.js @@ -0,0 +1 @@ +import foo from "foo.json" assert { lazy: "true" };