MCPcopy
hub / github.com/MithrilJS/mithril.js / o

Function o

ospec/ospec.js:12–22  ·  view source on GitHub ↗
(subject, predicate)

Source from the content-addressed store, hash-verified

10 if (name != null) spec[name] = ctx = {}
11
12 function o(subject, predicate) {
13 if (predicate === undefined) {
14 if (!isRunning()) throw new Error("Assertions should not occur outside test definitions")
15 return new Assert(subject)
16 } else {
17 if (isRunning()) throw new Error("Test definitions and hooks shouldn't be nested. To group tests use `o.spec()`")
18 subject = String(subject)
19 if (subject.charCodeAt(0) === 1) throw new Error("test names starting with '\\x01' are reserved for internal use")
20 ctx[unique(subject)] = new Task(predicate, ensureStackTrace(new Error))
21 }
22 }
23 o.before = hook("\x01before")
24 o.after = hook("\x01after")
25 o.beforeEach = hook("\x01beforeEach")

Callers 15

test-promise.jsFile · 0.85
popFunction · 0.85
test-xhrMock.jsFile · 0.85
finishFunction · 0.85
finish2Function · 0.85
test-components.jsFile · 0.85
test-parseURL.jsFile · 0.85
test-domMock.jsFile · 0.85
test-callAsync.jsFile · 0.85

Calls 3

isRunningFunction · 0.85
uniqueFunction · 0.85
ensureStackTraceFunction · 0.85

Tested by

no test coverage detected