@@ -5,6 +5,12 @@ It only contains Mocha tests to let you code in your favorite IDE, outside of th
55
66[ ![ License] ( https://img.shields.io/github/license/cyrilverloop/codingame-js-tests )] ( https://github.com/cyrilverloop/codingame-js-tests/blob/trunk/LICENSE )
77
8+ ** This project now uses Node 21+.
9+ Unfortunaly, CodinGame is still on Node 16.14.2
10+ which is not [ supported] ( https://nodejs.org/en/about/previous-releases#release-schedule ) anymore.
11+ If you want to run your code on Node 16.14.2,
12+ you can use a version up to 1.x of this software which do not receive further update.**
13+
814
915## Installation
1016
@@ -15,43 +21,49 @@ user@host projects$ git clone https://github.com/cyrilverloop/codingame-js-tests
1521user@host projects $ cd codingame-js-tests
1622```
1723
24+ Copy some configuration files for Docker :
25+ ``` shellsession
26+ user@host projects $ cp ./.env.dist ./.env
27+ user@host projects $ cp ./.ashrc.dist ./.ashrc
28+ ```
29+ Edit the ` ./.env ` to use your user UID and GID in the container if necessary.
30+ The ` ./.ashrc ` , ` ./.env ` and ` ./docker-compose.override.yml ` files are ignored by git, you can modify them to your needs.
31+ The ` ./.ashrc ` add some aliases to your container.
32+
1833Installing the dependencies :
1934``` shellsession
2035user@host codingame-js-tests $ docker compose run --rm app npm i
2136```
2237
23-
24- ## Add your code
25-
26- Every files in ` ./lib/**/*.dist ` files have an ` execute() ` method with the default CodinGame code.
27- To try a puzzle, copy the corresponding file and change the extension to ` js ` :
38+ Generate the code and test files :
2839``` shellsession
29- user@host codingame-js-tests $ cp ./lib/training/easy/unary/unary.dist ./ls/training/easy/unary/unary.js
40+ user@host codingame-js-tests $ docker compose run --rm app npm run generate
3041```
31- Then, add your code to solve the puzzle.
3242
33- ** If you do not have an ` execute() ` method in it, the tests will not be able to run.**
43+ ** Existing code, test, input and output files will not be overwritten.
44+ To generate a file again, you must delete it first.**
45+
46+
47+ ## Add your code
48+
49+ Every files in ` ./lib/**/CGCode.js ` files have an ` execute() ` method with the default CodinGame code.
50+ A test executes the ` execute() ` method. You can add your code in and arround it.
3451
3552
3653## Test your solution
3754
38- Executing tests for a specific puzzle :
55+ Executing tests for a specific code :
3956``` shellsession
4057user@host codingame-js-tests $ docker compose run --rm app npm test ./test/training/easy/unary/
4158```
4259
43- Executing all the tests :
44- ``` shellsession
45- user@host codingame-js-tests $ docker compose run --rm app npm test ./test/** /* .js
46- ```
47-
4860
4961## Add your test (optional)
5062
5163Every tests in ` ./test/**/CGTest.js ` files include the tests from CodinGame.
52- You can add your own tests in other ` ./test/**/*.js ` files.
64+ You can add your own tests in ` ./test/**/*.js ` files.
5365
5466
5567## Time limit
5668
57- The maximum time allowed for a puzzle may differ from CodinGame.
69+ The maximum time allowed may differ from CodinGame.
0 commit comments