From 8338700d05a911c0784e833381f1c727bed4f281 Mon Sep 17 00:00:00 2001 From: juggernaut451 Date: Fri, 16 Feb 2018 00:01:52 +0530 Subject: [PATCH] doc: add directory structure in writing-tests.md PR-URL: https://github.com/nodejs/node/pull/18802 Fixes: https://github.com/nodejs/node/issues/18774 Reviewed-By: Joyee Cheung Reviewed-By: James M Snell Reviewed-By: Matheus Marchini Reviewed-By: Gibson Fahnestock Reviewed-By: Franziska Hinkelmann Reviewed-By: Shingo Inoue Reviewed-By: Trivikram Kamat --- doc/guides/writing-tests.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index ec9398dcb928ec..b5f641289f77b6 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -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: @@ -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