refactor: tidied existing mocha test scripts in package.json and added a test-ts script #10864
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
andtest-fast
scripts in thepackage.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 thetest
andtest-fast
scripts, and I also added a.mocharc.yaml
file for a newtest-ts
script that usests-node
(to run the tests without needing to compile/transpile them first), and which will also be used by default when runningnpx mocha path/to/test.ts
.Most tests are passing locally when run via
test-ts path/to/test.ts
ornpx 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
master
branchnpm run format
to apply prettier formattingnpm run test
passes with this changeFixes #0000