Use broccoli to build tests

This commit is contained in:
Joe Fiorini
2015-02-05 11:59:03 -05:00
parent a9e0de98d7
commit 13998e2898
8 changed files with 143 additions and 51 deletions

View File

@@ -0,0 +1,33 @@
{
"name": "ember-cli-test-loader",
"main": "test-loader.js",
"version": "0.1.0",
"homepage": "https://github.com/rjackson/ember-cli-test-loader",
"description": "Test loader for Ember CLI projects.",
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"authors": [
"Robert Jackson <robert.w.jackson@me.com>"
],
"moduleType": [
"globals"
],
"keywords": [
"ember-cli"
],
"_release": "0.1.0",
"_resolution": {
"type": "version",
"tag": "v0.1.0",
"commit": "c6006a11515c756d115bb5209103a22c2e9554a0"
},
"_source": "git://github.com/ember-cli/ember-cli-test-loader.git",
"_target": "0.1.0",
"_originalSource": "ember-cli/ember-cli-test-loader"
}

View File

@@ -0,0 +1,19 @@
## Ember CLI Test Loader
Defines a `TestLoader` object that reviews all of the modules in
`requirejs.entries` and loads those identified as tests.
`TestLoader.prototype.shouldLoadModule` can be overridden in order to customize
the criteria for identifying test modules.
### Usage
Within your test suite:
```javascript
var TestLoader = require('ember-cli/test-loader')['default'];
// optionally override TestLoader.prototype.shouldLoadModule
TestLoader.load();
```

View File

@@ -0,0 +1,24 @@
{
"name": "ember-cli-test-loader",
"main": "test-loader.js",
"version": "0.1.0",
"homepage": "https://github.com/rjackson/ember-cli-test-loader",
"description": "Test loader for Ember CLI projects.",
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"authors": [
"Robert Jackson <robert.w.jackson@me.com>"
],
"moduleType": [
"globals"
],
"keywords": [
"ember-cli"
]
}

View File

@@ -0,0 +1,36 @@
/* globals requirejs, require */
(function() {
define("ember-cli/test-loader",
[],
function() {
"use strict";
var TestLoader = function() {
};
TestLoader.prototype = {
shouldLoadModule: function(moduleName) {
return (moduleName.match(/[-_]test$/));
},
loadModules: function() {
var moduleName;
for (moduleName in requirejs.entries) {
if (this.shouldLoadModule(moduleName)) {
require(moduleName);
}
}
}
};
TestLoader.load = function() {
new TestLoader().loadModules();
};
return {
'default': TestLoader
}
}
);
})();