.test.tsin their filename. If you have written a test file but aren't seeing it executed, this is probably why. There are two separate test commands and configurations, as unit tests don't need the complete Screeps server run-time as integration tests do.
npm testwill execute all unit and integration tests in sequence. This is helpful for CI/CD and pre-publish checks, however during active development it's better to run just a subset of interesting tests.
npm run test-unitor
npm run test-integrationto run just one of the test suites. Additionally you can supply Mocha options to these test commands to further control the testing behavior. As an example, the following command will only execute integration tests with the word
memoryin their description:
--will be passed to
package.json, add a new
test-integrationscript and add the new integration testing to the main
test-integrationscript or run both unit and integration tests using the
awaitkeyword to get a result and ensure order of execution. If you find that some of your preconditions don't seem to take effect, or that you receive a Promise object rather than an expected value, you're likely missing
awaiton an API method.