Make the stack trace filter path-independent (auto-detection vs. hardcoded previously)
This commit is contained in:
parent
8eb12454ca
commit
0873cb53cc
1 changed files with 8 additions and 1 deletions
|
|
@ -8,6 +8,13 @@ else window.o = m()
|
||||||
|
|
||||||
if (name != null) spec[name] = ctx = {}
|
if (name != null) spec[name] = ctx = {}
|
||||||
|
|
||||||
|
try {throw new Error} catch (e) {
|
||||||
|
var stackTraceMatcher = new RegExp(
|
||||||
|
"^(?:(?!Error|"
|
||||||
|
+ e.stack.match(/[\/\\](.*?):\d+:\d+/)[1]
|
||||||
|
+ ").)*$", "gm"
|
||||||
|
)
|
||||||
|
}
|
||||||
function o(subject, predicate) {
|
function o(subject, predicate) {
|
||||||
if (predicate === undefined) {
|
if (predicate === undefined) {
|
||||||
if (results == null) throw new Error("Assertions should not occur outside test definitions")
|
if (results == null) throw new Error("Assertions should not occur outside test definitions")
|
||||||
|
|
@ -52,7 +59,7 @@ else window.o = m()
|
||||||
return spy
|
return spy
|
||||||
}
|
}
|
||||||
o.cleanStackTrace = function(stack) {
|
o.cleanStackTrace = function(stack) {
|
||||||
return stack.match(/^(?:(?!Error|[\/\\]ospec[\/\\]ospec\.js).)*$/gm).pop()
|
return stack.match(stackTraceMatcher).pop()
|
||||||
}
|
}
|
||||||
o.run = function(_reporter) {
|
o.run = function(_reporter) {
|
||||||
results = []
|
results = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue