Skip to content

Commit

Permalink
Canonicalize stack trace paths
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainMuller committed Mar 28, 2022
1 parent 1bec42e commit 0888e83
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/jsii/test/deprecation-warnings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(), '<process.cwd>'))
.toMatchInlineSnapshot(`
"index.js:16
throw error;
^
Expand All @@ -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.<anonymous> (/Users/rmuller/Development/aws/jsii/packages/jsii/test/deprecation-warnings.test.ts:682:10)"
at Object.<anonymous> (<process.cwd>/test/deprecation-warnings.test.ts:682:10)"
`);
}
});
Expand Down Expand Up @@ -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(), '<process.cwd>'))
.toMatchInlineSnapshot(`
"index.js:15
Error.captureStackTrace(error, Object.getOwnPropertyDescriptor(this, \\"property\\").get);
^
Expand All @@ -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.<anonymous> (/Users/rmuller/Development/aws/jsii/packages/jsii/test/deprecation-warnings.test.ts:727:10)"
at Object.<anonymous> (<process.cwd>/test/deprecation-warnings.test.ts:728:7)"
`);
}
});
Expand Down Expand Up @@ -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(), '<process.cwd>'))
.toMatchInlineSnapshot(`
"index.js:30
Error.captureStackTrace(error, Object.getOwnPropertyDescriptor(this, \\"property\\").set);
^
Expand All @@ -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.<anonymous> (/Users/rmuller/Development/aws/jsii/packages/jsii/test/deprecation-warnings.test.ts:777:10)"
at Object.<anonymous> (<process.cwd>/test/deprecation-warnings.test.ts:779:7)"
`);
}
});
Expand Down Expand Up @@ -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(), '<process.cwd>'))
.toMatchInlineSnapshot(`
"index.js:17
throw error;
^
Expand All @@ -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.<anonymous> (/Users/rmuller/Development/aws/jsii/packages/jsii/test/deprecation-warnings.test.ts:821:10)"
at Object.<anonymous> (<process.cwd>/test/deprecation-warnings.test.ts:824:6)"
`);
}
});
Expand Down

0 comments on commit 0888e83

Please sign in to comment.