From ce7460d8d4fda0cb10fb14957fcde40b6b8401c7 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Tue, 7 Dec 2021 16:50:07 -0800 Subject: [PATCH] Fixed stack trace filtering on Safari 15 --- README.md | 5 ++++- lib/jasmine-core/jasmine.js | 2 +- scripts/run-all-browsers | 1 + spec/core/StackTraceSpec.js | 29 ++++++++++++++++++++++++++++- src/core/StackTrace.js | 2 +- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f900383e..160ac27f 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Jasmine tests itself across many browsers (Safari, Chrome, Firefox, Microsoft Ed | Environment | Supported versions | |-------------------|--------------------| | Node | 10, 12, 14, 16 | -| Safari | 8-14 | +| Safari | 8-15 | | Chrome | Evergreen | | Firefox | Evergreen, 68, 78, 91 | | Edge | Evergreen | @@ -62,6 +62,9 @@ For evergreen browsers, each version of Jasmine is tested against the version of at the time of release. Other browsers, as well as older & newer versions of some supported browsers, are likely to work. However, Jasmine isn't tested against them and they aren't actively supported. +See the [release notes](https://github.com/jasmine/jasmine/tree/main/release_notes) +for the supported environments for each Jasmine release. + ## Support * Search past discussions: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js). diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 2ce7c15f..aacb163e 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -9460,7 +9460,7 @@ getJasmineRequireObj().StackTrace = function(j$) { // e.g. "run@http://localhost:8888/__jasmine__/jasmine.js:4320:27" // or "http://localhost:8888/__jasmine__/jasmine.js:4320:27" { - re: /^(([^@\s]+)@)?([^\s]+)$/, + re: /^(?:(([^@\s]+)@)|@)?([^\s]+)$/, fnIx: 2, fileLineColIx: 3, style: 'webkit' diff --git a/scripts/run-all-browsers b/scripts/run-all-browsers index 45d74aaa..bc44db36 100755 --- a/scripts/run-all-browsers +++ b/scripts/run-all-browsers @@ -30,6 +30,7 @@ run_browser firefox latest run_browser firefox 91 run_browser firefox 78 run_browser firefox 68 +run_browser safari 15 run_browser safari 14 run_browser safari 13 run_browser safari 9 diff --git a/spec/core/StackTraceSpec.js b/spec/core/StackTraceSpec.js index d041c8e7..3685969c 100644 --- a/spec/core/StackTraceSpec.js +++ b/spec/core/StackTraceSpec.js @@ -95,7 +95,7 @@ describe('StackTrace', function() { ]); }); - it('understands Safari/Firefox/Phantom-OS X style traces', function() { + it('understands Safari <=14/Firefox/Phantom-OS X style traces', function() { var error = { message: 'nope', stack: @@ -122,6 +122,33 @@ describe('StackTrace', function() { ]); }); + it('understands Safari 15 style traces', function() { + var error = { + message: 'nope', + stack: + '@http://localhost:8888/__spec__/core/FooSpec.js:164:24\n' + + 'attempt@http://localhost:8888/__jasmine__/jasmine.js:8074:44\n' + }; + var result = new jasmineUnderTest.StackTrace(error); + + expect(result.message).toBeFalsy(); + expect(result.style).toEqual('webkit'); + expect(result.frames).toEqual([ + { + raw: '@http://localhost:8888/__spec__/core/FooSpec.js:164:24', + func: undefined, + file: 'http://localhost:8888/__spec__/core/FooSpec.js', + line: 164 + }, + { + raw: 'attempt@http://localhost:8888/__jasmine__/jasmine.js:8074:44', + func: 'attempt', + file: 'http://localhost:8888/__jasmine__/jasmine.js', + line: 8074 + } + ]); + }); + it('does not mistake gibberish for Safari/Firefox/Phantom-OS X style traces', function() { var error = { message: 'nope', diff --git a/src/core/StackTrace.js b/src/core/StackTrace.js index 44db4ff1..5183f2b7 100644 --- a/src/core/StackTrace.js +++ b/src/core/StackTrace.js @@ -36,7 +36,7 @@ getJasmineRequireObj().StackTrace = function(j$) { // e.g. "run@http://localhost:8888/__jasmine__/jasmine.js:4320:27" // or "http://localhost:8888/__jasmine__/jasmine.js:4320:27" { - re: /^(([^@\s]+)@)?([^\s]+)$/, + re: /^(?:(([^@\s]+)@)|@)?([^\s]+)$/, fnIx: 2, fileLineColIx: 3, style: 'webkit'