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

uvu 0.5.6 regression: CLI runner fails on Node.js 10 #213

Open
ludofischer opened this issue Jul 7, 2022 · 1 comment
Open

uvu 0.5.6 regression: CLI runner fails on Node.js 10 #213

ludofischer opened this issue Jul 7, 2022 · 1 comment

Comments

@ludofischer
Copy link

ludofischer commented Jul 7, 2022

On GitHub actions with Node.js 10, running : uvu packages "test.*\.js$" fails to run any tests and crashes with this stack trace:

ReferenceError: globalThis is not defined
    at Object.exports.run (/home/runner/work/cssnano/cssnano/node_modules/.pnpm/uvu@0.5.6/node_modules/uvu/run/index.js:2:2)
    at sade.version.option.option.option.option.option.action (/home/runner/work/cssnano/cssnano/node_modules/.pnpm/uvu@0.5.6/node_modules/uvu/bin.js:28:30)

The tests run as expected with uvu 0.5.5 on the same configuration.

Link to CI failure: https://github.com/cssnano/cssnano/runs/7240283115?check_suite_focus=true
Node.js version: 10.24.1
OS: Ubuntu

@kytta
Copy link

kytta commented Nov 16, 2023

Don't ask me why, but I was testing a package for Node.js v10 in 2023, and I stumbled upon this bug :D

The regression seems to come from the re-arrangement of the imports in uvu 0.5.6. Now, uvu/run imports uvu after a reference to globalThis, which is something that needs polyfilling. uvu itself, as well as esm (the package) actually take care of this, but running uvu -r esm will polyfill globalThis after it gets referenced.

Workaround: Run tests using node -r esm tests instead of uvu -r esm tests

To resolve this bug, one need to either: a) require esm before requiring uvu/run; or b) move the included globalThis polyfill all the way up to bin.js

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

No branches or pull requests

2 participants