Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ minimum code coverage percentage (95%).

# Installing and running

First install all dependencies:
First clone this repository and change into the newly cloned directory. The rest of this guide assumes you are in the project's root directory when running commands.

```shell
$ git clone https://github.com/michikono/typescript-tdd-exercises
$ cd typescript-tdd-exercises
```

Then install all dependencies:

```shell
$ npm install
Expand Down
14 changes: 6 additions & 8 deletions src/exercise1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

## Exercise A

Find and open the [/coverage/reports/lcov-report/index.html](../../coverage/reports/lcov-report/index.html) and navigate
the file.
Find and open the [coverage/reports/lcov-report/index.html](../../coverage/reports/lcov-report/index.html) and navigate the file.

You can re-run tests individually by running:

Expand All @@ -30,30 +29,29 @@ $ grunt watch
This is the baseline you want for all of your tests going forward.

As you make any changes to TypeScript files, you should see this command trigger events automatically. For example,
try adding a space to [/src/exercise1/word.ts](../../src/exercise1/word.ts) and save it. You will see the `watch`
try adding a space to [src/exercise1/word.ts](word.ts) and save it. You will see the `watch`
recompile the TypeScript and run all tests.

## Exercise B

Right now, we actually do not have 100% coverage; some test coverage analysis is being suppressed. Edit
[index.ts](./index.ts); remove the line about `istanbul ignore` that looks like this:
[src/exercise1/word.ts](word.ts); remove the line about `istanbul ignore` that looks like this:

```typescript
/* istanbul ignore next */
```

By removing this line, the class defined below it will begin to count against the code coverage reports. You should notice
your code coverage is no longer at 100%.
By removing this line, the class defined below it will begin to count against the code coverage reports. You should notice your code coverage is no longer at 100%.

Add a test for the `removeVowels()` method. The test should go to [/test/exercise1/word.ts](../../test/exercise1/word.ts)
Add a test for the `removeVowels()` method. The test should go to [test/exercise1/word.ts](../../test/exercise1/word.ts)

You should see the coverage report edge back up to 100%. The
[exercise 1 coverage report][../../coverage/reports/lcov-report/exercise1/word.js.html] should show the removeVowels
method fully covered (green). You will notice `removeNumbers()` is still red.

## Exercise C

Add a test for the `removeNumbers()` method. The test should go to [/test/exercise1/word.ts](../../test/exercise1/word.ts)
Add a test for the `removeNumbers()` method. The test should go to [test/exercise1/word.ts](../../test/exercise1/word.ts)

Note that you want to write the test, *that will fail*. This is because we have not yet added the logic for `removeNumbers()`.
*Make sure it fails first.*
Expand Down