Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luontola/tdd-mooc-legacy-code
Exercise for dealing with legacy code
https://github.com/luontola/tdd-mooc-legacy-code
javascript kata legacy-code
Last synced: 4 days ago
JSON representation
Exercise for dealing with legacy code
- Host: GitHub
- URL: https://github.com/luontola/tdd-mooc-legacy-code
- Owner: luontola
- License: mit
- Created: 2021-10-12T17:55:31.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-21T14:34:26.000Z (11 months ago)
- Last Synced: 2024-04-15T07:10:17.406Z (7 months ago)
- Topics: javascript, kata, legacy-code
- Language: JavaScript
- Homepage: https://tdd.mooc.fi
- Size: 2.78 MB
- Stars: 0
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
README
# [TDD MOOC](https://tdd.mooc.fi/): Legacy code
This is an exercise to practice dealing with legacy code. There are three things you need to do:
1. **Write test for the code [src/gilded_rose.mjs](src/gilded_rose.mjs), until it has 100% mutation test coverage.**
2. **Refactor the code to make it understandable.**
3. **Add the "conjured items" feature described in [Gilded Rose requirements](GildedRoseRequirements.txt).**When writing the tests, at first use just line coverage (`npm run coverage`) to find non-tested lines. After all lines
are tested, switch to using mutation coverage (`npm run mutation`) and improve your tests. Both commands write their
reports in html format under the `coverage` directory.(In real projects, mutation coverage typically takes many minutes to run, so for faster feedback it can be practical to
first focus on just the line coverage.)When refactoring, first try to see how far you can get without understanding the problem domain (i.e. use mechanical,
provably correct refactorings). Then read the [Gilded Rose requirements](GildedRoseRequirements.txt) document to
understand the problem domain and get a new perspective for improving the design.---
_This exercise is part of the [TDD MOOC](https://tdd.mooc.fi) at the University of Helsinki, brought to you
by [Esko Luontola](https://twitter.com/EskoLuontola) and [Nitor](https://nitor.com/). This exercise is based on
the [Gilded Rose Refactoring Kata](https://github.com/emilybache/GildedRose-Refactoring-Kata)
by [Emily Bache](https://twitter.com/emilybache) and [Terry Hughes](https://twitter.com/TerryHughes)._## Prerequisites
You'll need a recent [Node.js](https://nodejs.org/) version. Then download this project's dependencies with:
npm install
## Developing
Run tests once
npm run test
Run tests continuously
npm run autotest
Calculate line coverage, writes results to `coverage/lcov-report/index.html`
npm run coverage
Calculate mutation coverage, writes results to `coverage/mutation-report/index.html`
npm run mutation
Code reformat
npm run format