diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5abf64ead..003c91871 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -123,3 +123,46 @@ rules: _danielyxie/bitburner_ and the base is _dev_. - Do not check in any generated files under `doc\`. The documentation is built automatically by ReadTheDocs. + +## Tests + +There are a few unit tests written using [jest](https://jestjs.io/), and some browser automation tests using [Cypress](https://www.cypress.io/). + +### Unit Tests + +Run unit tests with: + +```sh +$ npm run test +$ npm run test:watch # to re-run tests on changes +``` + +Tests go in the `/test` directory. + +### Browser Tests + +There are full browser automation tests which cover some basic "does it work" functionality. + +Run these with: + +```sh +$ npm run build +$ npm run cy:test +``` + +To start up the tests in watch mode (re-run on changes), which will also start up a dev server: + +```sh +$ npm run cy:dev +``` + +## TypeScript Setup + +This project uses [Project References](https://www.typescriptlang.org/docs/handbook/project-references.html) +to make sure that jest and Cypress tests only exist within Jest/Cypress code. + +To type-check the whole project: + +```sh +$ npm run typescript +``` diff --git a/package.json b/package.json index 7d72e9804..cfe6245bd 100644 --- a/package.json +++ b/package.json @@ -137,6 +137,7 @@ "lint": "npm run lint:jsts & npm run lint:style", "lint:jsts": "eslint --fix . --ext js,jsx,ts,tsx", "lint:style": "stylelint --fix ./css/*", + "typescript": "tsc --build", "preinstall": "node ./scripts/engines-check.js", "test": "jest", "test:watch": "jest --watch",