Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid error when outputDir is contained in a non-existent directory #1647

Merged
merged 1 commit into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/shared/src/scanner/scanner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ describe(Scanner, () => {
.returns(() => false)
.verifiable();
// eslint-disable-next-line security/detect-non-literal-fs-filename
fsMock.setup((fsm) => fsm.mkdirSync(reportOutDir)).verifiable();
fsMock.setup((fsm) => fsm.mkdirSync(reportOutDir, { recursive: true })).verifiable();

const crawlerParams: CrawlerRunOptions = {
baseUrl: scanArguments.url,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/scanner/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class Scanner {
if (!this.fileSystemObj.existsSync(outDirectory)) {
this.logger.logInfo(`Report output directory does not exist. Creating directory ${outDirectory}`);
// eslint-disable-next-line security/detect-non-literal-fs-filename
this.fileSystemObj.mkdirSync(outDirectory);
this.fileSystemObj.mkdirSync(outDirectory, { recursive: true });
}
}

Expand Down