Skip to content

Commit 41dd3cd

Browse files
committed
test(openapi-typescript): modify unit test
1 parent 02ff167 commit 41dd3cd

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

packages/openapi-typescript/test/cjs.test.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,7 @@
22

33
// important: MUST use require()!
44
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');
276

287
describe("CJS bundle", () => {
298
it("basic", async () => {

0 commit comments

Comments
 (0)