diff --git a/cli/js/40_testing.js b/cli/js/40_testing.js index 2702dccf13..cf779ee076 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; diff --git a/runtime/ops/worker_host.rs b/runtime/ops/worker_host.rs index 002cc742a9..a77f57b60f 100644 --- a/runtime/ops/worker_host.rs +++ b/runtime/ops/worker_host.rs @@ -154,10 +154,8 @@ fn op_create_worker( }; let parent_permissions = parent_permissions.clone(); let worker_id = state.take::(); - let create_web_worker_cb = state.take::(); - state.put::(create_web_worker_cb.clone()); - let format_js_error_fn = state.take::(); - state.put::(format_js_error_fn.clone()); + let create_web_worker_cb = state.borrow::().clone(); + let format_js_error_fn = state.borrow::().clone(); state.put::(worker_id.next().unwrap()); let module_specifier = deno_core::resolve_url(&specifier)?;