Skip to content

Commit db3f510

Browse files
committed
update test and snapshot
1 parent 26d4584 commit db3f510

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

src/generator.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@ import {log, toSafeString} from './utils'
1818
import {basename, dirname, extname, join} from 'path'
1919

2020
export function generate(ast: AST, options = DEFAULT_OPTIONS): string {
21-
const namedTypes = declareNamedTypes(ast, options, ast.standaloneName!)
22-
const namedInterfaces = declareNamedInterfaces(ast, options, ast.standaloneName!)
23-
const enums = declareEnums(ast, options)
24-
25-
return [options.bannerComment, namedTypes, namedInterfaces, enums].filter(Boolean).join('\n\n') + '\n' // trailing newline
21+
return (
22+
[
23+
options.bannerComment,
24+
declareNamedTypes(ast, options, ast.standaloneName!),
25+
declareNamedInterfaces(ast, options, ast.standaloneName!),
26+
declareEnums(ast, options),
27+
]
28+
.filter(Boolean)
29+
.join('\n\n') + '\n'
30+
) // trailing newline
2631
}
2732

2833
function declareEnums(ast: AST, options: Options, processed = new Set<AST>()): string {

test/__snapshots__/test/test.ts.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449780,7 +449780,7 @@ Generated by [AVA](https://avajs.dev).
449780449780

449781449781
> Snapshot 1
449782449782

449783-
'test/resources/mirror-dir/out/inner-dir/ReferencedTypeInInnerDir.ts'
449783+
'test/resources/mirror-dir/out/inner-dir/ReferencedTypeInInnerDir.d.ts'
449784449784

449785449785
> Snapshot 2
449786449786

@@ -449800,7 +449800,7 @@ Generated by [AVA](https://avajs.dev).
449800449800

449801449801
> Snapshot 3
449802449802

449803-
'test/resources/mirror-dir/out/ReferencedType.ts'
449803+
'test/resources/mirror-dir/out/ReferencedType.d.ts'
449804449804

449805449805
> Snapshot 4
449806449806

@@ -449827,7 +449827,7 @@ Generated by [AVA](https://avajs.dev).
449827449827

449828449828
> Snapshot 5
449829449829

449830-
'test/resources/mirror-dir/out/ReferencingType.ts'
449830+
'test/resources/mirror-dir/out/ReferencingType.d.ts'
449831449831

449832449832
> Snapshot 6
449833449833

test/__snapshots__/test/test.ts.snap

6 Bytes
Binary file not shown.

test/testCLI.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ export function run() {
139139
})
140140

141141
test('type imports', t => {
142-
execSync(
143-
'node dist/src/cli.js --useTypeImports --declareExternallyReferenced false -i ./test/resources/mirror-dir -o ./test/resources/mirror-dir/out',
144-
)
142+
execSync('node dist/src/cli.js --useTypeImports -i ./test/resources/mirror-dir -o ./test/resources/mirror-dir/out')
145143
getPaths('./test/resources/mirror-dir/out').forEach(file => {
146144
t.snapshot(file)
147145
t.snapshot(readFileSync(file, 'utf-8'))

0 commit comments

Comments
 (0)