@@ -5,17 +5,17 @@ import { describe, expect, test } from 'vitest'
5
5
import { browserLogs , isServe , serverLogs } from '~utils'
6
6
7
7
test . skip ( 'should respected each `tsconfig.json`s compilerOptions' , ( ) => {
8
- // main side effect should be called (because of `"importsNotUsedAsValues ": "preserve" `)
8
+ // main side effect should be called (because of `"verbatimModuleSyntax ": true `)
9
9
expect ( browserLogs ) . toContain ( 'main side effect' )
10
10
// main base setter should not be called (because of `"useDefineForClassFields": true"`)
11
11
expect ( browserLogs ) . not . toContain ( 'data setter in MainBase' )
12
12
13
- // nested side effect should not be called (because "importsNotUsedAsValues " is not set, defaults to "remove" )
13
+ // nested side effect should not be called (because "verbatimModuleSyntax " is not set, defaults to false )
14
14
expect ( browserLogs ) . not . toContain ( 'nested side effect' )
15
15
// nested base setter should be called (because of `"useDefineForClassFields": false"`)
16
16
expect ( browserLogs ) . toContain ( 'data setter in NestedBase' )
17
17
18
- // nested-with-extends side effect should be called (because "importsNotUsedAsValues " is extended from the main tsconfig.json, which is "preserve" )
18
+ // nested-with-extends side effect should be called (because "verbatimModuleSyntax " is extended from the main tsconfig.json, which is true )
19
19
expect ( browserLogs ) . toContain ( 'nested-with-extends side effect' )
20
20
// nested-with-extends base setter should be called (because of `"useDefineForClassFields": false"`)
21
21
expect ( browserLogs ) . toContain ( 'data setter in NestedWithExtendsBase' )
@@ -42,8 +42,8 @@ describe('transformWithEsbuild', () => {
42
42
} ,
43
43
} ,
44
44
} )
45
- // "importsNotUsedAsValues ": "preserve" from tsconfig.json should still work
46
- expect ( result . code ) . toContain ( ' import ". /not-used-type";' )
45
+ // "verbatimModuleSyntax ": true from tsconfig.json should still work
46
+ expect ( result . code ) . toMatch ( / i m p o r t . * " . \ /n o t - u s e d - t y p e " ; / )
47
47
} )
48
48
49
49
test ( 'overwrite tsconfigRaw string' , async ( ) => {
@@ -56,26 +56,24 @@ describe('transformWithEsbuild', () => {
56
56
}
57
57
}` ,
58
58
} )
59
- // "importsNotUsedAsValues ": "preserve" from tsconfig.json should not be read
60
- // and defaults to "remove"
61
- expect ( result . code ) . not . toContain ( ' import ". /not-used-type";' )
59
+ // "verbatimModuleSyntax ": true from from tsconfig.json should not be read
60
+ // and defaults to false
61
+ expect ( result . code ) . not . toMatch ( / i m p o r t . * " . \ /n o t - u s e d - t y p e " ; / )
62
62
} )
63
63
64
- test ( 'preserveValueImports ' , async ( ) => {
64
+ test ( 'verbatimModuleSyntax ' , async ( ) => {
65
65
const main = path . resolve ( __dirname , '../src/main.ts' )
66
66
const mainContent = fs . readFileSync ( main , 'utf-8' )
67
67
const result = await transformWithEsbuild ( mainContent , main , {
68
68
tsconfigRaw : {
69
69
compilerOptions : {
70
70
useDefineForClassFields : false ,
71
- preserveValueImports : true ,
71
+ verbatimModuleSyntax : false ,
72
72
} ,
73
73
} ,
74
74
} )
75
- // "importsNotUsedAsValues": "preserve" from tsconfig.json should still work
76
- expect ( result . code ) . toContain (
77
- 'import { MainTypeOnlyClass } from "./not-used-type";' ,
78
- )
75
+ // "verbatimModuleSyntax": false from tsconfig.json should still work
76
+ expect ( result . code ) . not . toMatch ( / i m p o r t .* " .\/ n o t - u s e d - t y p e " ; / )
79
77
} )
80
78
81
79
test ( 'experimentalDecorators' , async ( ) => {
0 commit comments