Skip to content

Commit 81aa451

Browse files
committed
fix remaining test case
1 parent 520897f commit 81aa451

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/openapi-typescript/bin/cli.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ async function main() {
182182
}
183183

184184
// error: tried to glob output to single file
185-
if (isGlob && output === OUTPUT_FILE && fs.existsSync(outputDir) && fs.lstatSync(outputDir).isFile()) {
185+
if (isGlob && output === OUTPUT_FILE && ((fs.existsSync(outputDir) && fs.lstatSync(outputDir).isFile()) || outputDir.pathname !== outputFile.pathname)) {
186186
error(`Expected directory for --output if using glob patterns. Received "${flags.output}".`);
187187
process.exit(1);
188188
}
@@ -193,8 +193,7 @@ async function main() {
193193
if (flags.output !== "." && output === OUTPUT_FILE) {
194194
if (isGlob || outputDir.pathname === outputFile.pathname) {
195195
fs.mkdirSync(new URL(path.dirname(specPath), outputDir), { recursive: true }); // recursively make parent dirs
196-
}
197-
else {
196+
} else {
198197
fs.mkdirSync(outputDir, { recursive: true }); // recursively make parent dirs
199198
}
200199
}

packages/openapi-typescript/test/cli.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe("CLI", () => {
114114
expect(result).toEqual([ "file-a.ts" ]);
115115
})
116116

117-
test.todo("multiple files to file", async ()=>{
117+
test("multiple files to file", async ()=>{
118118
const inputFile = path.join(inputDir, "*.yaml");
119119
const outputFile = path.join(outputDir, "file-a.ts");
120120
await expect(execa(cmd, [inputFile, "--output", outputFile], { cwd })).rejects.toThrow();

0 commit comments

Comments
 (0)