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 Windows CI with jest as alternative to bun, also add more matrix envs #154

Closed
wants to merge 1 commit into from

Conversation

fritx
Copy link
Collaborator

@fritx fritx commented Jan 9, 2024

Goal:
Add and fix CI for Windows

Problem:
bun is not availble in Windows currently (ref: oven-sh/bun#8045, oven-sh/bun#7991).
Tried with both setup-bun (docs, failed) and powershell -c "irm bun.sh/install.ps1|iex" (docs, failed)

Solution:
For Windows, switching to npm install + jest as alternative to bun install + bun test.

Details:

  • Completing the CI matrix.envs: ubuntu-bun, ubuntu-jest, macos-bun, macos-jest, windows-jest
  • Making tests compatible with node + jest:
    • replacing toInclude => toContain
    • adding some missing is_browser detections
    • skipping esbuild: false test (bun only)
    • introducing es-main to detect and prevent unexpected call of getArgs (throwing on the wrong args)
  • Making tests compatible with Windows:
    • introducing toMatchOSPath
    • handling some paths with path.normalize or (path/posix).join

✅ The CI are all passing:
https://github.com/nuejs/nue/actions/runs/7463368446

image

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just an idea... should we use the lock-file(s) for dependency installation?
That might make the test-runs more reproducible.
Referring to #150 (comment)

I mean... the test / build library might still change (new line 25 / 33), but at least the main dependencies would be the same

I'm not sure if it's a great idea, but it came to my mind.

Copy link
Collaborator Author

@fritx fritx Jan 10, 2024

Choose a reason for hiding this comment

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

Yes. It's a good question. I'm +1. For each project, we have different choices. Like:

  • simple: totally ignoring all the lock-files
  • sample: ...or just keeping one of the lock-files as a sample, e.g., yarn.lock (via bun-install -y)
  • strict: ...or even keeping all the lock-files (bun, yarn, pnpm, npm, etc)

IMO, I personally prefer the choice 1 or 2, as nuejs is a quite lightweight framework or tool. Keeping more than 1 lock-files can be much effort while committing and code-reviewing. (which means to remove most of the lock-files and add them into .gitignore)

How do you guys think? @nobkd

@fritx
Copy link
Collaborator Author

fritx commented Jan 10, 2024

Sorry. Closing for some cleaning work. Would re-open later...

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