Skip to content

Commit d38339e

Browse files
authored
Merge pull request #209 from ember-learn/fix-deterministic-tests
Fix the "deterministic tests" hack
2 parents 7cfa970 + d6df03a commit d38339e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/markdown/tutorial/part-1/01-orientation.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ del package.json
9898
```
9999
100100
```run:file:patch hidden=true cwd=super-rentals filename=tests/index.html
101-
@@ -28,2 +28,91 @@
101+
@@ -28,2 +28,93 @@
102102
<script src="{{rootURL}}assets/tests.js"></script>
103103
+ <script>
104104
+ if (QUnit.urlParams.deterministic) {
@@ -178,15 +178,17 @@ del package.json
178178
+ }
179179
+ });
180180
+
181-
+ QUnit.config.callbacks.done.unshift(details => {
182-
+ details.runtime = totalRuntime;
183-
+ });
184-
+
185181
+ QUnit.begin(details => {
186182
+ let ua = document.getElementById('qunit-userAgent');
187183
+ ua.innerText = ua.innerText.replace(/QUnit [0-9\.]+/g, 'QUnit');
188184
+ ua.innerText = ua.innerText.replace(/(WebKit|Chrome|Safari)\/[0-9\.]+/g, '$1');
189185
+ });
186+
+
187+
+ QUnit.on('runEnd', () => {
188+
+ let display = document.getElementById('qunit-testresult-display');
189+
+ display.innerText = display.innerText
190+
+ .replace(/in [.0-9]+ milliseconds/, `in ${totalRuntime} milliseconds`);
191+
+ });
190192
+ }
191193
+ </script>
192194

0 commit comments

Comments
 (0)