JavaScript
#
Versions- Node 8.x
- Node 10.x
- Node 12.x
#
Test FrameworksStarting 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.
#
Example for Node v10.x/v12.xEach 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:
Prefixing with <LOG::-LABEL>
will put the message inside a container with LABEL
. The -
makes it collapsed by default.
#
Timeout12 seconds
#
Node ModulesNOTE: Module versions are locked but may be updated. If an update happens, existing kata may need to be manually updated.
- bignumber.js
- bluebird
- brain
- canvas
- chai
- chai-http
- chai-spies
- cheerio
- enzyme
- escape-html
- expect
- express
- faker
- jsdom
- lodash
- mocha
- moment
- mongodb
- mongoose
- pg
- q
- ramda
- react
- react-addons-test-utils
- react-dom
- react-redux
- react-test-renderer
- redis
- redux
- should
- sinon
- sqlite3
- underscore
- web3
- ganache-core
#
Services- sqlite3
- redis
- mongodb
#
Language IDjavascript