https://github.com/nicoespeon/refactoringjavascript-kata
A coding exercise to practice your Atomic Refactorings skills
https://github.com/nicoespeon/refactoringjavascript-kata
coding-challenge coding-kata legacy-code refactoring
Last synced: 3 months ago
JSON representation
A coding exercise to practice your Atomic Refactorings skills
- Host: GitHub
- URL: https://github.com/nicoespeon/refactoringjavascript-kata
- Owner: nicoespeon
- License: mit
- Created: 2021-09-29T12:18:04.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-29T13:39:39.000Z (over 4 years ago)
- Last Synced: 2025-03-10T23:59:49.649Z (about 1 year ago)
- Topics: coding-challenge, coding-kata, legacy-code, refactoring
- Language: JavaScript
- Homepage: https://refactoringjavascript.dev
- Size: 38.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Refactoring JavaScript: Kata
> A coding playground to practice your refactoring skills.
I have crafted this kata for the [Refactoring JavaScript](https://refactoringjavascript.dev/) course 🎓
It is based on [J. B. Rainsberger's Trivia kata](https://github.com/jbrains/trivia), which is itself a fork from [a Legacy Code Retreat kata](https://github.com/caradojo/trivia).
## Exercise
**Your goal is to refactor `Game` without breaking the tests, spending as few time as possible in a "broken" state.**
In watch mode, each save will run the tests again.
How **short** can you spend time between each test? The shortest, the better.
Each time you save and tests stay green is a victory 🏆
## Pre-requisite
[Node.js](https://nodejs.org/en/download/releases/) `>= v14` and `< v17`
You can use [nvm](https://github.com/nvm-sh/nvm) or [n](https://github.com/tj/n) to install a specific version of Node.
## Installation
1. Clone the repository: `git clone git@github.com:nicoespeon/refactoringjavascript-kata.git`
2. Install dependencies: `npm install`
## Run the tests
While working, I recommend you run them in watch mode:
```
npm test -- --watch
```
You can launch a single test run with `npm test`
Tests are using [Jest](https://jestjs.io/) to run.
Since this kata is tailored for refactorings, tests are already present. Your goal is NOT to understand, nor update these tests.
If you want to practice writing tests on existing code, I recommend:
- Learn about [Approval Testing]()
- Use one of [these refactorings kata]()
- Have a look at [Testing JavaScript](https://testingjavascript.com/) course from Kent C. Dodds