- Node 8.x
- Node 10.x
- Node 12.x
Starting from Node 10.x, Mocha is used instead of our custom test framework. Codewars' assertion methods under
Test are still defined. However, those are wrappers around Chai assertions for backwards compatibility. Any new tests should not use them and existing tests should consider using Chai directly.
Starting from Node 12.x,
Test is no longer defined. For backwards compatibility, you can import a package:
const Test = require("@codewars/test-compat");. Any new tests should use Chai instead.
If the failure output for deep equality is truncated,
chai.config.truncateThreshold can be adjusted. Setting this to
0 will disable the truncation.
If you're creating a kata, try inserting an example in the kata editor to get started.
it represents a test case and stops at the first assertion failure.
If you want to have a test case for each input, you can write tests like the following:
When the input is too much for a test case name, you can output it inside a test case:
<LOG::-LABEL> will put the message inside a container with
- makes it collapsed by default.
NOTE: Module versions are locked but may be updated. If an update happens, existing kata may need to be manually updated.