Make ReactWebWorker-test.js less flaky.
Two improvements: make sure we set `done = true` when an error message is received, so that the test output contains the error message instead of eventually timing out and displaying nothing useful; and increase the timeout for this particular test from 5000ms (the default) to 20000ms.
Ben Newman committed
Feb 16, 2014 at 12:54 UTC
47ae8654281874b7e30859876bc05d984d3b8d68
1 file changed
+3
-1
src/browser/__tests__/ReactWebWorker-test.js
+3
-1
@@ -31,6 +31,7 @@ describe('ReactWebWorker', function() {
31
var data = JSON.parse(e.data);
32
if (data.type == 'error') {
33
error = data.message + "\n" + data.stack;
34
+ done = true;
35
} else if (data.type == 'log') {
36
console.log(data.message);
37
} else {
@@ -41,7 +42,8 @@ describe('ReactWebWorker', function() {
42
43
waitsFor(function() {
44
return done;
44
- });
45
+ }, "the final message to arrive from the worker", 2e4);
46
+
47
runs(function() {
48
if (error) {
49
console.error(error);