summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/40_testing.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/runtime/js/40_testing.js b/runtime/js/40_testing.js
index abbef2ae4..0b75daa24 100644
--- a/runtime/js/40_testing.js
+++ b/runtime/js/40_testing.js
@@ -792,6 +792,7 @@
const step = new TestStep({
name: test.name,
parent: undefined,
+ parentContext: undefined,
rootTestDescription: description,
sanitizeOps: test.sanitizeOps,
sanitizeResources: test.sanitizeResources,
@@ -1064,8 +1065,9 @@
* }} TestStepDefinition
*
* @typedef {{
- * name: string;
+ * name: string,
* parent: TestStep | undefined,
+ * parentContext: TestContext | undefined,
* rootTestDescription: { origin: string; name: string };
* sanitizeOps: boolean,
* sanitizeResources: boolean,
@@ -1099,6 +1101,10 @@
return this.#params.parent;
}
+ get parentContext() {
+ return this.#params.parentContext;
+ }
+
get rootTestDescription() {
return this.#params.rootTestDescription;
}
@@ -1269,6 +1275,18 @@
return {
[SymbolToStringTag]: "TestContext",
/**
+ * The current test name.
+ */
+ name: parentStep.name,
+ /**
+ * Parent test context.
+ */
+ parent: parentStep.parentContext ?? undefined,
+ /**
+ * File Uri of the test code.
+ */
+ origin: parentStep.rootTestDescription.origin,
+ /**
* @param nameOrTestDefinition {string | TestStepDefinition}
* @param fn {(t: TestContext) => void | Promise<void>}
*/
@@ -1284,6 +1302,7 @@
const subStep = new TestStep({
name: definition.name,
parent: parentStep,
+ parentContext: this,
rootTestDescription: parentStep.rootTestDescription,
sanitizeOps: getOrDefault(
definition.sanitizeOps,