Skip to content

Commit

Permalink
doc: add directory structure in writing-tests.md
Browse files Browse the repository at this point in the history
PR-URL: #18802
Fixes: #18774
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
juggernaut451 authored and BethGriggs committed Dec 3, 2018
1 parent 63d8632 commit 8338700
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/guides/writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ Add tests when:
- Fixing regressions and bugs.
- Expanding test coverage.

## Test directory structure

See [directory structure overview][] for outline of existing test & locations.
When deciding on whether to expand an existing test file or create a new one,
consider going through the files related to the subsystem.
For example, look for `test-streams` when writing a test for `lib/streams.js`.

## Test structure

Let's analyze this basic test from the Node.js test suite:
Expand Down Expand Up @@ -376,3 +383,4 @@ will depend on what is being tested if this is required or not.
[all maintained branches]: https://github.com/nodejs/lts
[node.green]: http://node.green/
[test fixture]: https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#test-fixtures-using-the-same-data-configuration-for-multiple-tests
[directory structure overview]: https://github.com/nodejs/node/blob/master/test/README.md#test-directories

0 comments on commit 8338700

Please sign in to comment.