Skip to content

Commit

Permalink
Ember-cli version
Browse files Browse the repository at this point in the history
  • Loading branch information
cibernox committed Jan 13, 2016
1 parent 9435bd3 commit a559557
Show file tree
Hide file tree
Showing 65 changed files with 77,224 additions and 0 deletions.
1 change: 1 addition & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"examples/angular2/**/*.js",
"examples/duel/www/**",
"examples/duel/src/main/webapp/js/lib/**",
"examples/ember-cli/todomvc/dist/**/*.js",
"examples/humble/js/**",
"examples/js_of_ocaml/js/*.js",
"examples/polymer/elements/elements.build.js",
Expand Down
Binary file added examples/ember-cli/assets/failed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/ember-cli/assets/passed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions examples/ember-cli/assets/test-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/* globals requirejs, require */
(function() {
define("ember-cli/test-loader",
[],
function() {
"use strict";

var moduleIncludeMatchers = [];
var moduleExcludeMatchers = [];

function addModuleIncludeMatcher(fn) {
moduleIncludeMatchers.push(fn);
};

function addModuleExcludeMatcher(fn) {
moduleExcludeMatchers.push(fn);
};

function checkMatchers(matchers, moduleName) {
var matcher;

for (var i = 0, l = matchers.length; i < l; i++) {
matcher = matchers[i];

if (matcher(moduleName)) {
return true;
}
}

return false;
}

function TestLoader() {
this._didLogMissingUnsee = false;
};

TestLoader.prototype = {
shouldLoadModule: function(moduleName) {
return (moduleName.match(/[-_]test$/));
},

listModules: function() {
return Object.keys(requirejs.entries);
},

loadModules: function() {
var moduleName, index, length;
var moduleNames = this.listModules();

for (index = 0, length = moduleNames.length; index < length; index++) {
moduleName = moduleNames[index];

if (checkMatchers(moduleExcludeMatchers, moduleName)) {
continue;
}

if (checkMatchers(moduleIncludeMatchers, moduleName) || this.shouldLoadModule(moduleName)) {
this.require(moduleName);
this.unsee(moduleName);
}
}
}
};

TestLoader.prototype.require = function(moduleName) {
try {
require(moduleName);
} catch(e) {
this.moduleLoadFailure(moduleName, e);
}
};

TestLoader.prototype.unsee = function(moduleName) {
if (typeof require.unsee === 'function') {
require.unsee(moduleName);
} else if (!this._didLogMissingUnsee) {
this._didLogMissingUnsee = true;
if (typeof console !== 'undefined') {
console.warn('unable to require.unsee, please upgrade loader.js to >= v3.3.0');
}
}
};

TestLoader.prototype.moduleLoadFailure = function(moduleName, error) {
console.error('Error loading: ' + moduleName, error.stack);
};

TestLoader.load = function() {
new TestLoader().loadModules();
};

return {
'default': TestLoader,
addModuleIncludeMatcher: addModuleIncludeMatcher,
addModuleExcludeMatcher: addModuleExcludeMatcher
};
}
);
})();
Loading

0 comments on commit a559557

Please sign in to comment.