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

test: add test bundler compatibility #166

Merged
merged 2 commits into from
Nov 9, 2024

Conversation

ChALkeR
Copy link
Contributor

@ChALkeR ChALkeR commented Nov 9, 2024

  1. const __dirname renamed to const _dirname to avoid conflict, as bundler tries to replace __dirname variables
  2. process.env is undefined, replaced to globalThis.process?.env?. in one place
  3. added a hint in comment for CROSS_PATH_GZ so that bundler can locate that file and include it
  4. fallback to guarded require() in json() loader, as bundler is not aware of those files, but can glob require()
  5. renamed test/index.test.js to test/index.js -- it's not a test itself, and we don't want test runner that loads *.test.js files to load all tests twice

To test:

  • npm run lint && npm test
  • CI
  • npx @exodus/test (Node.js)
    This is also faster than npm test here 🙃
  • npx @exodus/test --engine jsc:bundle --bundle-entropy-size=1000000 --testTimeout 5000000 (JSC)
    Requires jsc available in PATH
  • npx @exodus/test --engine hermes:bundle --bundle-entropy-size=1000000 --testTimeout 5000000 (Hermes)
    Requires hermes available in PATH or https://npmjs.com/hermes-engine-cli installed with @exodus/test:
    npm add @exodus/test hermes-engine-cli

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