From 0888e830af21cfd61a5304f2c3bbd6e07cd1853a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=A7=91=F0=9F=8F=BB=E2=80=8D=F0=9F=92=BB=20Romain=20M?= =?UTF-8?q?arcadier?= Date: Mon, 28 Mar 2022 15:12:59 -0700 Subject: [PATCH] Canonicalize stack trace paths --- .../jsii/test/deprecation-warnings.test.ts | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/jsii/test/deprecation-warnings.test.ts b/packages/jsii/test/deprecation-warnings.test.ts index c511d57148..94ef3ba627 100644 --- a/packages/jsii/test/deprecation-warnings.test.ts +++ b/packages/jsii/test/deprecation-warnings.test.ts @@ -683,7 +683,8 @@ describe('thrown exceptions have the expected stack trace', () => { // The above line should have resulted in a DeprecationError being thrown expect(null).toBeInstanceOf(Error); } catch (error) { - expect(error.stack).toMatchInlineSnapshot(` + expect(error.stack.replace(process.cwd(), '')) + .toMatchInlineSnapshot(` "index.js:16 throw error; ^ @@ -695,7 +696,7 @@ describe('thrown exceptions have the expected stack trace', () => { at index.js:25:1 at Script.runInContext (node:vm:139:12) at Object.runInContext (node:vm:289:6) - at Object. (/Users/rmuller/Development/aws/jsii/packages/jsii/test/deprecation-warnings.test.ts:682:10)" + at Object. (/test/deprecation-warnings.test.ts:682:10)" `); } }); @@ -728,7 +729,8 @@ describe('thrown exceptions have the expected stack trace', () => { // The above line should have resulted in a DeprecationError being thrown expect(null).toBeInstanceOf(Error); } catch (error) { - expect(error.stack).toMatchInlineSnapshot(` + expect(error.stack.replace(process.cwd(), '')) + .toMatchInlineSnapshot(` "index.js:15 Error.captureStackTrace(error, Object.getOwnPropertyDescriptor(this, \\"property\\").get); ^ @@ -739,7 +741,7 @@ describe('thrown exceptions have the expected stack trace', () => { at index.js:29:1 at Script.runInContext (node:vm:139:12) at Object.runInContext (node:vm:289:6) - at Object. (/Users/rmuller/Development/aws/jsii/packages/jsii/test/deprecation-warnings.test.ts:727:10)" + at Object. (/test/deprecation-warnings.test.ts:728:7)" `); } }); @@ -778,7 +780,8 @@ describe('thrown exceptions have the expected stack trace', () => { // The above line should have resulted in a DeprecationError being thrown expect(null).toBeInstanceOf(Error); } catch (error) { - expect(error.stack).toMatchInlineSnapshot(` + expect(error.stack.replace(process.cwd(), '')) + .toMatchInlineSnapshot(` "index.js:30 Error.captureStackTrace(error, Object.getOwnPropertyDescriptor(this, \\"property\\").set); ^ @@ -789,7 +792,7 @@ describe('thrown exceptions have the expected stack trace', () => { at index.js:44:1 at Script.runInContext (node:vm:139:12) at Object.runInContext (node:vm:289:6) - at Object. (/Users/rmuller/Development/aws/jsii/packages/jsii/test/deprecation-warnings.test.ts:777:10)" + at Object. (/test/deprecation-warnings.test.ts:779:7)" `); } }); @@ -822,7 +825,8 @@ describe('thrown exceptions have the expected stack trace', () => { // The above line should have resulted in a DeprecationError being thrown expect(null).toBeInstanceOf(Error); } catch (error) { - expect(error.stack).toMatchInlineSnapshot(` + expect(error.stack.replace(process.cwd(), '')) + .toMatchInlineSnapshot(` "index.js:17 throw error; ^ @@ -834,7 +838,7 @@ describe('thrown exceptions have the expected stack trace', () => { at index.js:28:1 at Script.runInContext (node:vm:139:12) at Object.runInContext (node:vm:289:6) - at Object. (/Users/rmuller/Development/aws/jsii/packages/jsii/test/deprecation-warnings.test.ts:821:10)" + at Object. (/test/deprecation-warnings.test.ts:824:6)" `); } });