Skip to content

Commit fb485de

Browse files
committed
Fix for nodejs stack format change
1 parent 71be92c commit fb485de

7 files changed

Lines changed: 12 additions & 4 deletions

File tree

snapshot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe.assert.cmdSnapshot = function(cmd, file, opts) {
1919
return this(0, "Snapshot command failed: " + cmd + "\n---\n" + actual)
2020
}
2121
}
22-
return this.matchSnapshot(file, actual.toString("utf8").replace(relPathRe, relPathFn))
22+
return this.matchSnapshot(file, actual.toString("utf8").replace(relPathRe, relPathFn).replace(/at \w+\.<anonymous>/g, "at <anonymous>"))
2323
}
2424

2525
describe.assert.matchSnapshot = function(file, actual, snapFile) {
@@ -36,7 +36,7 @@ describe.assert.matchSnapshot = function(file, actual, snapFile) {
3636
try {
3737
expected = fs.readFileSync(path.resolve(snapFile), enc)
3838
if (actual && actual.constructor === Uint8Array) expected = new Uint8Array(expected)
39-
if (typeof expected === "string") expected = expected.replace(relPathRe, relPathFn)
39+
if (typeof expected === "string") expected = expected.replace(relPathRe, relPathFn).replace(/at \w+\.<anonymous>/g, "at <anonymous>")
4040
} catch(e) {}
4141

4242
if (describe.conf.up) {

test/data/snap/2/build/767b.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.a {
2+
background: url("a.svg");
3+
}
4+

test/data/snap/2/build/b1a4.svg

Lines changed: 1 addition & 0 deletions
Loading

test/data/snap/2/build/f78c.svg

Lines changed: 1 addition & 0 deletions
Loading

test/data/snap/3/ls.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.
22
./a.css
33
./a.js
4-
./build
54
./dev.html
65
./index.html
76
./lib1.css

test/data/snap/6/build/8d6b.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"a": 1
3+
}

test/spec/test-first.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
✘ 1. it should fail [0/1]
44
Error: Assertion:1: equal
55
expected:actual:   ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]
6-
at testCase.<anonymous> (test/test-fail.js:7:9)
6+
at <anonymous> (test/test-fail.js:7:9)
77
at nextCase (test.js:293:19)
88
at nextSuite (test.js:376:3)
99
at Timeout.nextCase [as _onTimeout] (test.js:264:26)

0 commit comments

Comments
 (0)