summaryrefslogtreecommitdiff
path: root/cli/js
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2023-09-26 10:01:56 +0900
committerGitHub <noreply@github.com>2023-09-26 10:01:56 +0900
commit26f431fd14e96cb631042aa3feaf4267cb235f38 (patch)
tree5f4314866ec971c8159b5a237bdb235416033cfc /cli/js
parenta27ee8f368dbac33141fdcb9a17d0e4ea907b8ef (diff)
perf(test): use core.currentUserCallSite (#20669)
Speeds up `Deno.test` calls by a bit.
Diffstat (limited to 'cli/js')
-rw-r--r--cli/js/40_testing.js23
1 files changed, 2 insertions, 21 deletions
diff --git a/cli/js/40_testing.js b/cli/js/40_testing.js
index 2702dccf1..cf779ee07 100644
--- a/cli/js/40_testing.js
+++ b/cli/js/40_testing.js
@@ -769,22 +769,8 @@ function testInner(
// Delete this prop in case the user passed it. It's used to detect steps.
delete testDesc.parent;
- const jsError = core.destructureError(new Error());
- let location;
- for (let i = 0; i < jsError.frames.length; i++) {
- const filename = jsError.frames[i].fileName;
- if (filename.startsWith("ext:") || filename.startsWith("node:")) {
- continue;
- }
- location = {
- fileName: jsError.frames[i].fileName,
- lineNumber: jsError.frames[i].lineNumber,
- columnNumber: jsError.frames[i].columnNumber,
- };
- break;
- }
- testDesc.location = location;
+ testDesc.location = core.currentUserCallSite();
testDesc.fn = wrapTest(testDesc);
testDesc.name = escapeName(testDesc.name);
@@ -1307,12 +1293,7 @@ function createTestContext(desc) {
stepDesc.sanitizeOps ??= desc.sanitizeOps;
stepDesc.sanitizeResources ??= desc.sanitizeResources;
stepDesc.sanitizeExit ??= desc.sanitizeExit;
- const jsError = core.destructureError(new Error());
- stepDesc.location = {
- fileName: jsError.frames[1].fileName,
- lineNumber: jsError.frames[1].lineNumber,
- columnNumber: jsError.frames[1].columnNumber,
- };
+ stepDesc.location = core.currentUserCallSite();
stepDesc.level = level + 1;
stepDesc.parent = desc;
stepDesc.rootId = rootId;