Skip to content

Commit

Permalink
chore: remove stack trace from error snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Aug 7, 2024
1 parent 97ec7db commit 4dc8dcf
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
TypeError: Cannot add property fullName, object is not extensible
at /src/__tests__/fixture.ts
TypeError: Cannot add property fullName, object is not extensible
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
Error: Assignment to constant variable.
at /src/__tests__/fire-event.ts
at /src/__tests__/fixtures/get-and-set/index.test.ts
at /src/__tests__/fixture.ts
Error: Assignment to constant variable.
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
Error: Assignment to constant variable.
at /src/__tests__/fire-event.ts
at /src/__tests__/fixtures/get-and-set/index.test.ts
at /src/__tests__/fixture.ts
Error: Assignment to constant variable.
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
Error: Assignment to constant variable.
at /src/__tests__/fire-event.ts
at /src/__tests__/fixtures/get-and-set/index.test.ts
at /src/__tests__/fixture.ts
Error: Assignment to constant variable.
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
ReferenceError: Cannot access 'x' before initialization
at /src/transform/hoist-tag-vars/index.ts
at /src/__tests__/fixtures/misc/hoisting/templates/error-hoisting-maybe-sync-read-before-with-custom-tag.marko
at /src/__tests__/fixture.ts
ReferenceError: Cannot access 'x' before initialization
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ReferenceError: Cannot access 'x' before initialization
at /src/__tests__/fixtures/misc/hoisting/templates/error-hoisting-maybe-sync-read-before-with-custom-tag.marko
ReferenceError: Cannot access 'x' before initialization
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
ReferenceError: Cannot access 'x' before initialization
at /src/transform/hoist-tag-vars/index.ts
at /src/__tests__/fixtures/misc/hoisting/templates/error-hoisting-maybe-sync-read-before.marko
at /src/__tests__/fixtures/misc/hoisting/templates/error-hoisting-maybe-sync-read-before.marko
at /src/__tests__/fixture.ts
ReferenceError: Cannot access 'x' before initialization
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
ReferenceError: Cannot access 'x' before initialization
at /src/__tests__/fixtures/misc/hoisting/templates/error-hoisting-maybe-sync-read-before.marko
at /src/__tests__/fixtures/misc/hoisting/templates/error-hoisting-maybe-sync-read-before.marko
ReferenceError: Cannot access 'x' before initialization
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Error: Cannot read an element reference while rendering.
at /src/__tests__/fixture.ts
Error: Cannot read an element reference while rendering.
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Error: Cannot read an element reference while rendering.
at /src/__tests__/fixture.ts
Error: Cannot read an element reference while rendering.
3 changes: 1 addition & 2 deletions src/__tests__/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ function format(data: any): string {
// eslint-disable-next-line no-control-regex
.replace(/\x1B[[(?);]{0,2}(;?\d)*./g, "")
.replaceAll(process.cwd(), "")
.replace(/\r?\n +at (?![/\\]src[/\\])[^\n]+$/gm, "")
.replace(/(\r?\n +at [/\\]src[/\\].*[^\n]):\d+:\d+$/gm, "$1")
.replace(/\r?\n +at [^\n]+$/gm, "")
);
}
}
Expand Down

0 comments on commit 4dc8dcf

Please sign in to comment.