Skip to content

Commit

Permalink
Conditionally return a promise.
Browse files Browse the repository at this point in the history
This is 🍌s and I don't like it one bit, but I also don't want to wait
3 times as long for the test suite to finish.
  • Loading branch information
rwjblue committed Jan 5, 2018
1 parent f505abc commit 78320d0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/internal-test-helpers/lib/module-for.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,19 @@ export default function moduleFor(description, TestClass, ...mixins) {
promises.push(context.afterEach());
}

return all(promises);
// this seems odd, but actually saves significant time
// in the test suite
//
// returning a promise from a QUnit test always adds a 13ms
// delay to the test, this filtering prevents returning a
// promise when it is not needed
//
// Remove after we can update to QUnit that includes
// https://github.com/qunitjs/qunit/pull/1246
let filteredPromises = promises.filter(Boolean);
if (filteredPromises.length > 0) {
return all(filteredPromises);
}
}
});

Expand Down

0 comments on commit 78320d0

Please sign in to comment.