Skip to content

Commit

Permalink
Test import attributes instead of deprecated import assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Feb 10, 2024
1 parent 80867d1 commit 164c4d6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion babel.config.json
@@ -1,6 +1,6 @@
{
"plugins": [
"@babel/plugin-syntax-import-assertions",
"@babel/plugin-syntax-import-attributes",
"@babel/plugin-transform-flow-strip-types"
]
}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"@babel/eslint-parser": "7.23.10",
"@babel/plugin-syntax-import-assertions": "7.23.3",
"@babel/plugin-syntax-import-attributes": "7.23.3",
"@babel/plugin-transform-flow-strip-types": "7.23.3",
"@typescript-eslint/parser": "6.21.0",
"@vitest/coverage-v8": "^1.2.2",
Expand Down
22 changes: 11 additions & 11 deletions test/imports.test.js
Expand Up @@ -1584,7 +1584,7 @@ const flowTests = {
`import type a, {b} from "a"`,
`import type {} from "a"`,
`import type { } from "a"`,
`import json from "./foo.json" assert { type: "json" };`,
`import json from "./foo.json" with { type: "json" };`,

// typeof
`import typeof a from "a"`,
Expand Down Expand Up @@ -1681,11 +1681,11 @@ const flowTests = {
errors: 1,
},

// Import assertions.
// Import attributes.
{
code: input`
|import json from "./foo.json" assert { type: "json" };
|import {default as b} from "./bar.json" assert {
|import json from "./foo.json" with { type: "json" };
|import {default as b} from "./bar.json" with {
| // json
| type: "json",
| a: "b",
Expand All @@ -1695,12 +1695,12 @@ const flowTests = {
`,
output: (actual) => {
expect(actual).toMatchInlineSnapshot(`
|import {default as b} from "./bar.json" assert {
|import {default as b} from "./bar.json" with {
| // json
| type: "json",
| a: "b",
|} /* bar */
|import json from "./foo.json" assert { type: "json" };/* end
|import json from "./foo.json" with { type: "json" };/* end
| comment */
|;[].forEach()
`);
Expand Down Expand Up @@ -1977,11 +1977,11 @@ const typescriptTests = {
errors: 1,
},

// Import assertions.
// Import attributes.
{
code: input`
|import json from "./foo.json" assert { type: "json" };
|import {b, a} from "./bar.json" assert {
|import json from "./foo.json" with { type: "json" };
|import {b, a} from "./bar.json" with {
| // json
| type: "json",
| a: "b",
Expand All @@ -1991,12 +1991,12 @@ const typescriptTests = {
`,
output: (actual) => {
expect(actual).toMatchInlineSnapshot(`
|import {a,b} from "./bar.json" assert {
|import {a,b} from "./bar.json" with {
| // json
| type: "json",
| a: "b",
|} /* bar */
|import json from "./foo.json" assert { type: "json" };/* end
|import json from "./foo.json" with { type: "json" };/* end
| comment */
|;[].forEach()
`);
Expand Down

0 comments on commit 164c4d6

Please sign in to comment.