-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tests): Ensure TestLoader module load failures are counted as t…
…est failures (#541)
- Loading branch information
Showing
3 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import TestLoader from 'ember-cli/test-loader'; | ||
|
||
/** | ||
* Ensures that when the TestLoader failures to load a test module, the error | ||
* is reported. Without this the rest of the full test suite still passes and there is an | ||
* error printed in the console only. | ||
* The technique is from: https://github.com/ember-cli/ember-cli-qunit/blob/master/vendor/ember-cli-qunit/test-loader.js#L55 | ||
*/ | ||
export default function(QUnit) { | ||
var moduleLoadFailures = []; | ||
|
||
TestLoader.prototype.moduleLoadFailure = function(moduleName, error) { | ||
moduleLoadFailures.push(error); | ||
QUnit.module('TestLoader Failures'); | ||
QUnit.test(moduleName + ': could not be loaded', function() { | ||
throw error; | ||
}); | ||
}; | ||
|
||
QUnit.done(function() { | ||
if (moduleLoadFailures.length) { | ||
throw new Error('\n' + moduleLoadFailures.join('\n')); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters