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: fix behaviour on Windows. #593

Merged
merged 53 commits into from Aug 5, 2023
Merged

fix: fix behaviour on Windows. #593

merged 53 commits into from Aug 5, 2023

Conversation

azu
Copy link
Member

@azu azu commented Aug 5, 2023

Fix various bugs on Windows

  • fix secretlint --debug
  • fix to load custom formatter on Windows
  • @secretlint/tester normalize file path by default
    • Previously, it has difference between Windows and Linux
  • secretlint [windows path] supports

refs #590

value
.replace(new RegExp(escapeStringRegexp(snapshotsDir), "g"), "[SNAPSHOT]")
// normalize path sep for windows, but it should not replace \n etc...
.replace(/\\(?![tn])/g, "/")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snapshot testing includes file path

@azu azu added the Type: Testing Adding missing tests or correcting existing tests label Aug 5, 2023
@@ -125,7 +125,7 @@ export const run = async (
});
if (flags.debug) {
const debug = await import("debug");
debug.enable("*secretlint*");
debug.default?.enable("*secretlint*");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--debug does not works?

@azu azu changed the title test: fix tests on Windows fix: fix behaviour on Windows. Aug 5, 2023
@azu azu added Type: Bug Bug or Bug fixes and removed Type: Testing Adding missing tests or correcting existing tests labels Aug 5, 2023
Comment on lines +155 to +157
// dynamic import require file url
const fileUrl = url.pathToFileURL(formatterPath).href;
formatter = moduleInterop(await import(fileUrl)).default;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, windows can not load custom formatter

@azu azu merged commit 2a11017 into master Aug 5, 2023
16 checks passed
@azu azu deleted the fix-windows-test branch August 5, 2023 23:46
@github-actions github-actions bot mentioned this pull request Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug or Bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant