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

refactor: tidied existing mocha test scripts in package.json and added a test-ts script #10864

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

RohanTalip
Copy link
Contributor

@RohanTalip RohanTalip commented Apr 30, 2024

Description of change

mocha allows for configurations to be put into files. See https://github.com/mochajs/mocha/tree/master/example/config and https://mochajs.org/#configuring-mocha-nodejs .

This allows the test and test-fast scripts in the package.json file to be more concise.

I find YAML to be more concise for mocha configuration files than JSON files, but also allow for comments. I added a .mocharc-compiled.yaml file for the test and test-fast scripts, and I also added a .mocharc.yaml file for a new test-ts script that uses ts-node (to run the tests without needing to compile/transpile them first), and which will also be used by default when running npx mocha path/to/test.ts.

Most tests are passing locally when run via test-ts path/to/test.ts or npx mocha path/to/test.ts. I fixed some imports/requires in some tests but there are still a few that are failing locally, on my Mac.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

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.

None yet

1 participant