* This function is called when the ProcessingQueue is done processing all * items. It handles emitting the final run events.
()
| 2717 | * items. It handles emitting the final run events. |
| 2718 | */ |
| 2719 | function done() { |
| 2720 | var storage = config.storage; |
| 2721 | |
| 2722 | ProcessingQueue.finished = true; |
| 2723 | |
| 2724 | var runtime = now() - config.started; |
| 2725 | var passed = config.stats.all - config.stats.bad; |
| 2726 | |
| 2727 | if (config.stats.all === 0) { |
| 2728 | |
| 2729 | if (config.filter && config.filter.length) { |
| 2730 | throw new Error("No tests matched the filter \"" + config.filter + "\"."); |
| 2731 | } |
| 2732 | |
| 2733 | if (config.module && config.module.length) { |
| 2734 | throw new Error("No tests matched the module \"" + config.module + "\"."); |
| 2735 | } |
| 2736 | |
| 2737 | if (config.moduleId && config.moduleId.length) { |
| 2738 | throw new Error("No tests matched the moduleId \"" + config.moduleId + "\"."); |
| 2739 | } |
| 2740 | |
| 2741 | if (config.testId && config.testId.length) { |
| 2742 | throw new Error("No tests matched the testId \"" + config.testId + "\"."); |
| 2743 | } |
| 2744 | |
| 2745 | throw new Error("No tests were run."); |
| 2746 | } |
| 2747 | |
| 2748 | emit("runEnd", globalSuite.end(true)); |
| 2749 | runLoggingCallbacks("done", { |
| 2750 | passed: passed, |
| 2751 | failed: config.stats.bad, |
| 2752 | total: config.stats.all, |
| 2753 | runtime: runtime |
| 2754 | }).then(function () { |
| 2755 | |
| 2756 | // Clear own storage items if all tests passed |
| 2757 | if (storage && config.stats.bad === 0) { |
| 2758 | for (var i = storage.length - 1; i >= 0; i--) { |
| 2759 | var key = storage.key(i); |
| 2760 | |
| 2761 | if (key.indexOf("qunit-test-") === 0) { |
| 2762 | storage.removeItem(key); |
| 2763 | } |
| 2764 | } |
| 2765 | } |
| 2766 | }); |
| 2767 | } |
| 2768 | |
| 2769 | var ProcessingQueue = { |
| 2770 | finished: false, |
no test coverage detected