Fixed stack trace filtering in FF when the developer tools are open

This commit is contained in:
Steve Gravrock
2024-06-22 11:49:49 -07:00
parent ba7560f65e
commit cc69edf92c
3 changed files with 39 additions and 2 deletions
+10 -1
View File
@@ -9774,7 +9774,7 @@ getJasmineRequireObj().StackTrace = function(j$) {
// e.g. " at /some/path:4320:20 // e.g. " at /some/path:4320:20
{ re: /\s*at (.+)$/, fileLineColIx: 1, style: 'v8' }, { re: /\s*at (.+)$/, fileLineColIx: 1, style: 'v8' },
// PhantomJS on OS X, Safari, Firefox // Safari, most Firefox stack frames
// e.g. "run@http://localhost:8888/__jasmine__/jasmine.js:4320:27" // e.g. "run@http://localhost:8888/__jasmine__/jasmine.js:4320:27"
// or "http://localhost:8888/__jasmine__/jasmine.js:4320:27" // or "http://localhost:8888/__jasmine__/jasmine.js:4320:27"
{ {
@@ -9782,6 +9782,15 @@ getJasmineRequireObj().StackTrace = function(j$) {
fnIx: 2, fnIx: 2,
fileLineColIx: 3, fileLineColIx: 3,
style: 'webkit' style: 'webkit'
},
// Some Firefox stack frames when the developer tools are open
// e.g. "promise callback*specStarted@http://localhost:8888/__jasmine__/jasmine.js:1880:41"
{
re: /^^(?:((?:promise callback|[^\s]+ handler)\*([^@\s]+)@)|@)?([^\s]+)$/,
fnIx: 2,
fileLineColIx: 3,
style: 'webkit'
} }
]; ];
+19
View File
@@ -153,6 +153,25 @@ describe('ExceptionFormatter', function() {
); );
}); });
it('filters Jasmine stack frames with Firefox async annotations', function() {
const error = {
stack:
'http://localhost:8888/__spec__/core/UtilSpec.js:115:28\n' +
'promise callback*fn1@http://localhost:8888/__jasmine__/jasmine.js:4320:27\n' +
'setTimeout handler*fn2@http://localhost:8888/__jasmine__/jasmine.js:4320:27\n' +
'http://localhost:8888/__spec__/core/UtilSpec.js:115:28'
};
const subject = new jasmineUnderTest.ExceptionFormatter({
jasmineFile: 'http://localhost:8888/__jasmine__/jasmine.js'
});
const result = subject.stack(error);
expect(result).toEqual(
'http://localhost:8888/__spec__/core/UtilSpec.js:115:28\n' +
'<Jasmine>\n' +
'http://localhost:8888/__spec__/core/UtilSpec.js:115:28'
);
});
it('filters Jasmine stack frames in this environment', function() { it('filters Jasmine stack frames in this environment', function() {
const error = new Error('an error'); const error = new Error('an error');
const subject = new jasmineUnderTest.ExceptionFormatter({ const subject = new jasmineUnderTest.ExceptionFormatter({
+10 -1
View File
@@ -32,7 +32,7 @@ getJasmineRequireObj().StackTrace = function(j$) {
// e.g. " at /some/path:4320:20 // e.g. " at /some/path:4320:20
{ re: /\s*at (.+)$/, fileLineColIx: 1, style: 'v8' }, { re: /\s*at (.+)$/, fileLineColIx: 1, style: 'v8' },
// PhantomJS on OS X, Safari, Firefox // Safari, most Firefox stack frames
// e.g. "run@http://localhost:8888/__jasmine__/jasmine.js:4320:27" // e.g. "run@http://localhost:8888/__jasmine__/jasmine.js:4320:27"
// or "http://localhost:8888/__jasmine__/jasmine.js:4320:27" // or "http://localhost:8888/__jasmine__/jasmine.js:4320:27"
{ {
@@ -40,6 +40,15 @@ getJasmineRequireObj().StackTrace = function(j$) {
fnIx: 2, fnIx: 2,
fileLineColIx: 3, fileLineColIx: 3,
style: 'webkit' style: 'webkit'
},
// Some Firefox stack frames when the developer tools are open
// e.g. "promise callback*specStarted@http://localhost:8888/__jasmine__/jasmine.js:1880:41"
{
re: /^^(?:((?:promise callback|[^\s]+ handler)\*([^@\s]+)@)|@)?([^\s]+)$/,
fnIx: 2,
fileLineColIx: 3,
style: 'webkit'
} }
]; ];