From fd208c754ace6ec589d429182aa6aa43f4d862fc Mon Sep 17 00:00:00 2001 From: Cameron Little Date: Sun, 16 Aug 2020 12:16:58 +0200 Subject: [PATCH] Add hacky fix for bad each location in Jasmine --- packages/jest-jasmine2/src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/jest-jasmine2/src/index.ts b/packages/jest-jasmine2/src/index.ts index e2e220308bf4..0260c345aaf2 100644 --- a/packages/jest-jasmine2/src/index.ts +++ b/packages/jest-jasmine2/src/index.ts @@ -50,9 +50,12 @@ async function jasmine2( if (config.testLocationInResults === true) { function wrapIt(original: (...args: Array) => unknown) { return (...args: Array) => { - const stack = getCallsite(1, runtime.getSourceMaps()); + let stack = getCallsite(1, runtime.getSourceMaps()); const it = original(...args); + if (stack.getFileName().includes('/jest-each/')) { + stack = getCallsite(4, runtime.getSourceMaps()); + } // @ts-expect-error it.result.__callsite = stack;