Skip to content

Commit 2caa9fe

Browse files
committed
chore: add test cases for type-reëxport
1 parent ab8970e commit 2caa9fe

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

test/prefer-export-from.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,22 @@ test.snapshot({
474474
export {foo};
475475
export {bar} from './foo.json' assert { type: 'unknown' };
476476
`,
477+
outdent`
478+
import type * as X from 'foo';
479+
export { X };
480+
`,
481+
outdent`
482+
import * as X from 'foo';
483+
export type { X };
484+
`,
485+
outdent`
486+
import type * as X from 'foo';
487+
export type { X };
488+
`,
489+
outdent`
490+
import * as X from 'foo';
491+
export { X };
492+
`,
477493
],
478494
});
479495

test/snapshots/prefer-export-from.js.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,6 +2158,98 @@ Generated by [AVA](https://avajs.dev).
21582158
3 | export {bar, foo} from './foo.json' assert { type: 'unknown' };␊
21592159
`
21602160

2161+
## invalid(26): import type * as X from 'foo'; export { X };
2162+
2163+
> Input
2164+
2165+
`␊
2166+
1 | import type * as X from 'foo';␊
2167+
2 | export { X };␊
2168+
`
2169+
2170+
> Error 1/1
2171+
2172+
`␊
2173+
Message:␊
2174+
1 | import type * as X from 'foo';␊
2175+
> 2 | export { X };␊
2176+
| ^ Use \`export…from\` to re-export \`X\`.␊
2177+
2178+
Output:␊
2179+
1 |␊
2180+
2 |␊
2181+
3 | export * as X from 'foo';␊
2182+
`
2183+
2184+
## invalid(27): import * as X from 'foo'; export type { X };
2185+
2186+
> Input
2187+
2188+
`␊
2189+
1 | import * as X from 'foo';␊
2190+
2 | export type { X };␊
2191+
`
2192+
2193+
> Error 1/1
2194+
2195+
`␊
2196+
Message:␊
2197+
1 | import * as X from 'foo';␊
2198+
> 2 | export type { X };␊
2199+
| ^ Use \`export…from\` to re-export \`X\`.␊
2200+
2201+
Output:␊
2202+
1 |␊
2203+
2 |␊
2204+
3 | export * as X from 'foo';␊
2205+
`
2206+
2207+
## invalid(28): import type * as X from 'foo'; export type { X };
2208+
2209+
> Input
2210+
2211+
`␊
2212+
1 | import type * as X from 'foo';␊
2213+
2 | export type { X };␊
2214+
`
2215+
2216+
> Error 1/1
2217+
2218+
`␊
2219+
Message:␊
2220+
1 | import type * as X from 'foo';␊
2221+
> 2 | export type { X };␊
2222+
| ^ Use \`export…from\` to re-export \`X\`.␊
2223+
2224+
Output:␊
2225+
1 |␊
2226+
2 |␊
2227+
3 | export * as X from 'foo';␊
2228+
`
2229+
2230+
## invalid(29): import * as X from 'foo'; export { X };
2231+
2232+
> Input
2233+
2234+
`␊
2235+
1 | import * as X from 'foo';␊
2236+
2 | export { X };␊
2237+
`
2238+
2239+
> Error 1/1
2240+
2241+
`␊
2242+
Message:␊
2243+
1 | import * as X from 'foo';␊
2244+
> 2 | export { X };␊
2245+
| ^ Use \`export…from\` to re-export \`X\`.␊
2246+
2247+
Output:␊
2248+
1 |␊
2249+
2 |␊
2250+
3 | export * as X from 'foo';␊
2251+
`
2252+
21612253
## invalid(1): import json from './foo.json' with { type: 'json' }; export default json;
21622254

21632255
> Input
148 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)