From ee2cdef3347dfc439708b6841e9c44d778e215bb Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 26 May 2024 12:36:46 -0400 Subject: [PATCH] test_runner: add context.fullName This commit adds a fullName getter to the TestContext and SuiteContext classes. This is similar to the existing name getter, but also includes the name of all ancestor tests/suites. PR-URL: https://github.com/nodejs/node/pull/53169 Reviewed-By: Moshe Atlow Reviewed-By: Benjamin Gruenbaum Reviewed-By: Geoffrey Booth Co-authored-by: Jacob Smith --- doc/api/test.md | 8 ++++++++ lib/internal/test_runner/test.js | 18 ++++++++++++++++ test/parallel/test-runner-test-fullname.js | 24 ++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 test/parallel/test-runner-test-fullname.js diff --git a/doc/api/test.md b/doc/api/test.md index 7069dbc38ed9a8..5ce1d8f3d2286f 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -3044,6 +3044,14 @@ test('top level test', (t) => { }); ``` +### `context.fullName` + + + +The name of the test and each of its ancestors, separated by `>`. + ### `context.name`