It should take less that 3 mn (you can practice to go even faster than that), and give you a shareable public repository ready to write tests and have a linter ready for fast feedback. Now we can move on to the kata.
Project start:
$ mkdir bowling-kata
$ cd bowling-kata
Npm setup (pulled from shell history, Ctrl-R
):
$ npm init -y; npm install -D mocha chai eslint eslint-plugin-mocha
ESLint setup (pulled from shell history, edit with Ctrl-X Ctrl-E
if needed):
$ echo "\
{
\"env\": {
\"commonjs\": true,
\"es2021\": true,
\"node\": true
},
\"extends\": [\"eslint:recommended\", \"plugin:mocha/recommended\"],
\"parserOptions\": {
\"ecmaVersion\": \"latest\"
},
\"rules\": {
}
}
" > .eslintrc.json
Write the shortest possible failing test in your favorite editor in "bowling_test.js", for example:
const {expect} = require('chai');
it('fails', function() {
expect(1).to.equal(0);
});
Setup the npm test
script in the "package.json" file (for example, mocha .
)
Git setup:
$ echo node_modules/ > .gitignore
$ git init
$ git add .
$ git commit -m first
Create a new repo on github or gitlab or ..., then copy / paste the provided snipet to setup the remote and push.