You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Most recent spec reported by the in-app Jasmine progress beacon (see the
10
+
// /progress handler below). When the suite hangs and never POSTs results,
11
+
// this names the spec that was running when the JS thread stalled.
12
+
privateletprogressLock=NSLock()
13
+
privatevarlastSpecSeen="(no spec reported yet)"
14
+
9
15
overridefunc setUp(){
10
16
continueAfterFailure =false
11
17
@@ -25,6 +31,24 @@ class TestRunnerTests: XCTestCase {
25
31
letpath=(environ["PATH_INFO"]as?String)??"/"
26
32
letquery=(environ["QUERY_STRING"]as?String)??""
27
33
34
+
// Progress beacon from the in-app Jasmine reporter (fire-and-forget):
35
+
// records the spec currently running so a hang/timeout can report
36
+
// where the JS suite stalled, even though no JUnit report is POSTed.
37
+
if method =="GET" && path =="/progress"{
38
+
iflet specParam = query
39
+
.split(separator:"&")
40
+
.first(where:{ $0.hasPrefix("spec=")}){
41
+
letraw=String(specParam.dropFirst("spec=".count))
42
+
letdecoded= raw.removingPercentEncoding ?? raw
43
+
self.progressLock.lock()
44
+
self.lastSpecSeen = decoded
45
+
self.progressLock.unlock()
46
+
}
47
+
startResponse("204 No Content",[])
48
+
sendBody(Data())
49
+
return
50
+
}
51
+
28
52
// Serve tiny ESM modules for runtime HTTP loader tests.
29
53
if method =="GET"{
30
54
if path =="/esm/query.mjs" || path =="/ns/m/query.mjs"{
@@ -202,7 +226,10 @@ class TestRunnerTests: XCTestCase {
202
226
}
203
227
return
204
228
case.timedOut:
205
-
XCTFail("Ran past \(Int(jasmineTestsTimeout))s with the \"Jasmine tests\" expectation unfulfilled while the app was STILL RUNNING -> the JS suite HUNG (deadlock or never-settled async); it did not crash. Check the 'test-diagnostics' artifact (simulator.logarchive) for the last spec that logged before the stall.")
229
+
progressLock.lock()
230
+
letlastSpec= lastSpecSeen
231
+
progressLock.unlock()
232
+
XCTFail("Ran past \(Int(jasmineTestsTimeout))s with the \"Jasmine tests\" expectation unfulfilled while the app was STILL RUNNING -> the JS suite HUNG (deadlock or never-settled async); it did not crash. Last spec reported by the in-app beacon: \"\(lastSpec)\". Also see the 'test-diagnostics' artifact (simulator.logarchive).")
0 commit comments