Skip to content

cyrilverloop/codingame-js-tests

Repository files navigation

CodinGame JavaScript tests

A project to test your CodinGame JavaScript code. It is not intended to have solutions. It only contains Mocha tests to let you code in your favorite IDE, outside of the CodinGame web site.

License

This project now uses Node 21+. Unfortunaly, CodinGame is still on Node 16.14.2 which is not supported anymore. If you want to run your code on Node 16.14.2, you can use a version up to 1.x of this software which do not receive further update.

Installation

Downloading the project :

user@host ~$ cd [PATH_WHERE_TO_PUT_THE_PROJECT] # E.g. ~/projects/
user@host projects$ git clone https://github.com/cyrilverloop/codingame-js-tests.git
user@host projects$ cd codingame-js-tests

Copy some configuration files for Docker :

user@host projects$ cp ./.env.dist ./.env
user@host projects$ cp ./.ashrc.dist ./.ashrc

Edit the ./.env to use your user UID and GID in the container if necessary. The ./.ashrc, ./.env and ./docker-compose.override.yml files are ignored by git, you can modify them to your needs. The ./.ashrc add some aliases to your container.

Installing the dependencies :

user@host codingame-js-tests$ docker compose run --rm app npm i

Generate the code and test files :

user@host codingame-js-tests$ docker compose run --rm app npm run generate

Existing code, test, input and output files will not be overwritten. To generate a file again, you must delete it first.

Add your code

Every files in ./lib/**/CGCode.js files have an execute() method with the default CodinGame code. A test executes the execute() method. You can add your code in and arround it.

Test your solution

Executing tests for a specific code :

user@host codingame-js-tests$ docker compose run --rm app npm test ./test/training/easy/unary/

Add your test (optional)

Every tests in ./test/**/CGTest.js files include the tests from CodinGame. You can add your own tests in ./test/**/*.js files.

Time limit

The maximum time allowed may differ from CodinGame.

About

A project to test your CodinGame JavaScript code.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published