diff --git a/tests/format/js/deferred-import-evaluation/__snapshots__/format.test.js.snap b/tests/format/js/deferred-import-evaluation/__snapshots__/format.test.js.snap index 2f7ec0f89..6b13f6eac 100644 --- a/tests/format/js/deferred-import-evaluation/__snapshots__/format.test.js.snap +++ b/tests/format/js/deferred-import-evaluation/__snapshots__/format.test.js.snap @@ -1,5 +1,81 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`dynamic-import.js [acorn] format 1`] = ` +"The only valid meta property for import is 'import.meta' (1:8) +> 1 | import.defer("foo"); + | ^ + 2 | +Cause: The only valid meta property for import is 'import.meta' (1:7)" +`; + +exports[`dynamic-import.js [espree] format 1`] = ` +"The only valid meta property for import is 'import.meta' (1:8) +> 1 | import.defer("foo"); + | ^ + 2 | +Cause: The only valid meta property for import is 'import.meta'" +`; + +exports[`dynamic-import.js [meriyah] format 1`] = ` +"The only valid meta property for import is 'import.meta' (1:8) +> 1 | import.defer("foo"); + | ^^^^^ + 2 | +Cause: [1:7-1:12]: The only valid meta property for import is 'import.meta'" +`; + +exports[`dynamic-import.js format 1`] = ` +====================================options===================================== +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +import.defer("foo"); + +=====================================output===================================== +import.defer("foo"); + +================================================================================ +`; + +exports[`dynamic-import-attributes-expression.js [acorn] format 1`] = ` +"The only valid meta property for import is 'import.meta' (1:8) +> 1 | import.defer("x", { with: { attr: "val" } }); + | ^ + 2 | +Cause: The only valid meta property for import is 'import.meta' (1:7)" +`; + +exports[`dynamic-import-attributes-expression.js [espree] format 1`] = ` +"The only valid meta property for import is 'import.meta' (1:8) +> 1 | import.defer("x", { with: { attr: "val" } }); + | ^ + 2 | +Cause: The only valid meta property for import is 'import.meta'" +`; + +exports[`dynamic-import-attributes-expression.js [meriyah] format 1`] = ` +"The only valid meta property for import is 'import.meta' (1:8) +> 1 | import.defer("x", { with: { attr: "val" } }); + | ^^^^^ + 2 | +Cause: [1:7-1:12]: The only valid meta property for import is 'import.meta'" +`; + +exports[`dynamic-import-attributes-expression.js format 1`] = ` +====================================options===================================== +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +import.defer("x", { with: { attr: "val" } }); + +=====================================output===================================== +import.defer("x", { with: { attr: "val" } }); + +================================================================================ +`; + exports[`import-defer.js [acorn] format 1`] = ` "Unexpected token (1:14) > 1 | import defer * as ns from "x"; diff --git a/tests/format/js/deferred-import-evaluation/dynamic-import-attributes-expression.js b/tests/format/js/deferred-import-evaluation/dynamic-import-attributes-expression.js new file mode 100644 index 000000000..999759d1e --- /dev/null +++ b/tests/format/js/deferred-import-evaluation/dynamic-import-attributes-expression.js @@ -0,0 +1 @@ +import.defer("x", { with: { attr: "val" } }); diff --git a/tests/format/js/deferred-import-evaluation/dynamic-import.js b/tests/format/js/deferred-import-evaluation/dynamic-import.js new file mode 100644 index 000000000..a0939dce0 --- /dev/null +++ b/tests/format/js/deferred-import-evaluation/dynamic-import.js @@ -0,0 +1 @@ +import.defer("foo"); diff --git a/tests/format/js/deferred-import-evaluation/format.test.js b/tests/format/js/deferred-import-evaluation/format.test.js index ec3f16db8..ae71ea629 100644 --- a/tests/format/js/deferred-import-evaluation/format.test.js +++ b/tests/format/js/deferred-import-evaluation/format.test.js @@ -1,6 +1,8 @@ const importDeferTests = [ "import-defer.js", "import-defer-attributes-declaration.js", + "dynamic-import.js", + "dynamic-import-attributes-expression.js", ]; const invalidSyntaxTests = ["no-default.js", "no-named.js"];