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

Replace mocha and c8 with native node test runner #503

Open
chris48s opened this issue Sep 1, 2024 · 0 comments
Open

Replace mocha and c8 with native node test runner #503

chris48s opened this issue Sep 1, 2024 · 0 comments

Comments

@chris48s
Copy link
Owner

chris48s commented Sep 1, 2024

You've already replaced chai with node's native assert library. It should also be possible to replace mocha and c8 with

node --test --experimental-test-coverage

This should work even back to node 18.

Useful blog post: https://evertpot.com/bigint-money-2/

Some notes based on a quick spike:

  • By default node expects to find tests in tests dir or file prefixed with test*. You might need to switch from the .spec naming convention and rename test-helpers.js

  • You need to explicitly import describe, it, and any test hooks you are using e.g:

    import { describe, it, before, beforeEach, afterEach } from 'node:test';
    
  • Remember to set V8R_CACHE_NAME env var

  • It is probably worth double checking that tests using nock and mock-cwd don't cause any issue before going all in on this

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

1 participant