File tree Expand file tree Collapse file tree 1 file changed +1
-22
lines changed
packages/openapi-typescript/test Expand file tree Collapse file tree 1 file changed +1
-22
lines changed Original file line number Diff line number Diff line change 2
2
3
3
// important: MUST use require()!
4
4
const { fileURLToPath } = require ( "node:url" ) ;
5
- const ts = require ( "typescript" ) ;
6
- const openapiTS = require ( "../dist/index.cjs" ) ;
7
-
8
- // copy from lib/ts.ts for CJS
9
- function astToString ( ast , options ) {
10
- const sourceFile = ts . createSourceFile (
11
- options ?. fileName ?? "openapi-ts.ts" ,
12
- options ?. sourceText ?? "" ,
13
- ts . ScriptTarget . ESNext ,
14
- false ,
15
- ts . ScriptKind . TS ,
16
- ) ;
17
- sourceFile . statements = ts . factory . createNodeArray (
18
- Array . isArray ( ast ) ? ast : [ ast ] ,
19
- ) ;
20
- const printer = ts . createPrinter ( {
21
- newLine : ts . NewLineKind . LineFeed ,
22
- removeComments : false ,
23
- ...options ?. formatOptions ,
24
- } ) ;
25
- return printer . printFile ( sourceFile ) ;
26
- }
5
+ const { astToString, default : openapiTS } = require ( '../dist/index.cjs' ) ;
27
6
28
7
describe ( "CJS bundle" , ( ) => {
29
8
it ( "basic" , async ( ) => {
You can’t perform that action at this time.
0 commit comments