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

Make unit tests pass on Windows #839

Merged
merged 12 commits into from
Jan 28, 2025
Merged

Conversation

fredrikekelund
Copy link
Contributor

@fredrikekelund fredrikekelund commented Jan 23, 2025

Related issues

Proposed Changes

This PR makes all unit tests pass on Windows by mocking the path module and/or using it correctly. Unsurprisingly, all of the failing tests were related to the differences between file paths on Unix and Windows…

I've added src/tests/utils/platform-test-suite.ts that wraps a test suite in a describe.each call that iterates over Unix and Windows platforms (meaning we run a mock test suite for both platforms at all times). Having this wrapper should make it easier to implement future tests for code that uses the path module.

Testing Instructions

Run npm test on Windows and make sure all tests pass

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@fredrikekelund fredrikekelund requested a review from a team January 23, 2025 16:08
@fredrikekelund fredrikekelund self-assigned this Jan 23, 2025
@fredrikekelund fredrikekelund changed the title [WIP] Make unit tests pass on Windows Make unit tests pass on Windows Jan 28, 2025
@fredrikekelund fredrikekelund marked this pull request as ready for review January 28, 2025 12:15
Copy link
Contributor

@wojtekn wojtekn left a comment

Choose a reason for hiding this comment

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

Nice work @fredrikekelund !

Are we ready to enable (and rename) "Experiment Windows Unit Tests" to start running them on CI side again?

@fredrikekelund
Copy link
Contributor Author

I didn't know we'd already configured a CI job for that. I've enabled it again as part of this PR 👍 (Fingers crossed it works now…)

@fredrikekelund
Copy link
Contributor Author

Looks like the CI process indeed works 🙂

@wojtekn
Copy link
Contributor

wojtekn commented Jan 28, 2025

Thanks @fredrikekelund ! 🥳

@fredrikekelund fredrikekelund merged commit fcb8bf8 into trunk Jan 28, 2025
7 checks passed
@wojtekn wojtekn deleted the f26d/windows-unit-tests branch January 28, 2025 17:48
bgrgicak pushed a commit that referenced this pull request Jan 29, 2025
* WIP - Make unit tests pass on Windows

* Fix DefaultExporter tests

* Abstract the path mocking logic

* Exclude tests/utils from Jest config

* SqlExporter

* PlaygroundValidator

* Normalize paths passed to fs.__setFileContents

* Fix file name

* User data tests

* Enable unit tests on Windows

* Remove "Experiment" from name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants