mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 00:37:37 -02:30
Use broccoli to build tests
This commit is contained in:
18
Brocfile.js
18
Brocfile.js
@@ -20,6 +20,7 @@ var args = parseArgs(allArgs['--']);
|
|||||||
var shouldCompress = isUndefined(args.compress) ? false : args.compress;
|
var shouldCompress = isUndefined(args.compress) ? false : args.compress;
|
||||||
var debugMode = isUndefined(args.debug) ? false : args.debug;
|
var debugMode = isUndefined(args.debug) ? false : args.debug;
|
||||||
var silentMode = isUndefined(args.silent) ? false : args.silent;
|
var silentMode = isUndefined(args.silent) ? false : args.silent;
|
||||||
|
var includeTests = isUndefined(args.tests) ? true : args.tests;
|
||||||
|
|
||||||
var appName = 'tower';
|
var appName = 'tower';
|
||||||
|
|
||||||
@@ -67,6 +68,11 @@ var vendorFiles =
|
|||||||
'ansible/*.js'
|
'ansible/*.js'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var testFiles =
|
||||||
|
[ 'tests/helpers.js',
|
||||||
|
'tests/unit/**/*.js'
|
||||||
|
];
|
||||||
|
|
||||||
function log() {
|
function log() {
|
||||||
var msgs = Array.prototype.slice.apply(arguments);
|
var msgs = Array.prototype.slice.apply(arguments);
|
||||||
|
|
||||||
@@ -133,6 +139,18 @@ var styles = compileLess(appStyles, 'less/ansible-ui.less', 'tower.min.css');
|
|||||||
|
|
||||||
app = mergeTrees([app, styles]);
|
app = mergeTrees([app, styles]);
|
||||||
|
|
||||||
|
if (includeTests) {
|
||||||
|
var tests = new Funnel('awx/ui',
|
||||||
|
{ include: ['tests/unit/**/*.js']
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
tests = doDebug('tests-funnel', tests);
|
||||||
|
tests = new ES6(tests);
|
||||||
|
app = mergeTrees([app, tests]);
|
||||||
|
app = doDebug('merge-tests', app);
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldCompress) {
|
if (shouldCompress) {
|
||||||
app = uglifyFiles(app);
|
app = uglifyFiles(app);
|
||||||
app = gzip(app,
|
app = gzip(app,
|
||||||
|
|||||||
33
awx/ui/static/lib/ember-cli-test-loader/.bower.json
Normal file
33
awx/ui/static/lib/ember-cli-test-loader/.bower.json
Normal 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"
|
||||||
|
}
|
||||||
19
awx/ui/static/lib/ember-cli-test-loader/README.md
Normal file
19
awx/ui/static/lib/ember-cli-test-loader/README.md
Normal 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();
|
||||||
|
```
|
||||||
24
awx/ui/static/lib/ember-cli-test-loader/bower.json
Normal file
24
awx/ui/static/lib/ember-cli-test-loader/bower.json
Normal 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"
|
||||||
|
]
|
||||||
|
}
|
||||||
36
awx/ui/static/lib/ember-cli-test-loader/test-loader.js
Normal file
36
awx/ui/static/lib/ember-cli-test-loader/test-loader.js
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})();
|
||||||
@@ -10,53 +10,13 @@ module.exports = function(config) {
|
|||||||
// frameworks to use
|
// frameworks to use
|
||||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||||
frameworks: ['mocha', 'chai', 'sinon-chai', 'chai-as-promised'],
|
frameworks: ['mocha', 'chai', 'sinon-chai', 'chai-as-promised'],
|
||||||
|
|
||||||
// list of files / patterns to load in the browser
|
// list of files / patterns to load in the browser
|
||||||
files: [
|
files: [
|
||||||
'../static/lib/jquery/dist/jquery.min.js',
|
'../static/dist/tower.concat.js',
|
||||||
'../static/lib/angular/angular.js',
|
'../static/lib/angular-mocks/angular-mocks.js',
|
||||||
'../static/lib/angular-route/angular-route.js',
|
'../static/lib/ember-cli-test-loader/test-loader.js',
|
||||||
'../static/lib/angular-resource/angular-resource.js',
|
'../static/dist/tests/**/*.js',
|
||||||
'../static/lib/angular-cookies/angular-cookies.js',
|
'../tests/unit.js'
|
||||||
'../static/lib/angular-sanitize/angular-sanitize.min.js',
|
|
||||||
'../static/lib/angular-md5/angular-md5.min.js',
|
|
||||||
'../static/lib/angular-codemirror/lib/AngularCodeMirror.js',
|
|
||||||
'../static/lib/timezone-js/src/date.js',
|
|
||||||
'../static/lib/angular-tz-extensions/packages/jstimezonedetect/jstz.min.js',
|
|
||||||
'../static/lib/underscore/underscore.js',
|
|
||||||
'../static/lib/rrule/lib/rrule.js',
|
|
||||||
'../static/lib/rrule/lib/nlp.js',
|
|
||||||
'../static/lib/angular-tz-extensions/lib/angular-tz-extensions.js',
|
|
||||||
'../static/lib/angular-scheduler/lib/angular-scheduler.min.js',
|
|
||||||
'../static/lib/jqueryui/ui/minified/jquery-ui.min.js',
|
|
||||||
'../static/lib/bootstrap/dist/js/bootstrap.min.js',
|
|
||||||
'../static/lib/js-yaml/dist/js-yaml.min.js',
|
|
||||||
'../static/lib/select2/select2.min.js',
|
|
||||||
'../static/lib/jsonlint/lib/jsonlint.js',
|
|
||||||
'../static/lib/codemirror/lib/codemirror.js',
|
|
||||||
'../static/lib/codemirror/mode/javascript/javascript.js',
|
|
||||||
'../static/lib/codemirror/mode/yaml/yaml.js',
|
|
||||||
'../static/lib/codemirror/addon/lint/lint.js',
|
|
||||||
'../static/lib/codemirror/addon/lint/json-lint.js',
|
|
||||||
'../static/lib/angular-codemirror/lib/yaml-lint.js',
|
|
||||||
'../static/lib/codemirror/addon/edit/closebrackets.js',
|
|
||||||
'../static/lib/codemirror/addon/edit/matchbrackets.js',
|
|
||||||
'../static/lib/codemirror/addon/selection/active-line.js',
|
|
||||||
'../static/lib/scrollto/lib/jquery-scrollto.js',
|
|
||||||
'../static/lib/socket.io-client/dist/socket.io.min.js',
|
|
||||||
'../static/lib/d3js/build/d3.v3.min.js',
|
|
||||||
'../static/lib/novus-nvd3/nv.d3.min.js',
|
|
||||||
'../static/lib/d3Donut/d3Donut.js',
|
|
||||||
'../static/lib/jPushMenu/jPushMenu.js',
|
|
||||||
'../static/lib/lrInfiniteScroll/lrInfiniteScroll.js',
|
|
||||||
'../static/lib/ansible/*.js',
|
|
||||||
'../static/js/config.js',
|
|
||||||
'../static/js/directives/_dashboard-graphs.js',
|
|
||||||
'../static/js/*/*.js',
|
|
||||||
'../static/js/app.js',
|
|
||||||
'../static/lib/angular-mocks/angular-mocks.js',
|
|
||||||
'./unit/*',
|
|
||||||
'./unit/**/*'
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
@@ -66,12 +26,6 @@ module.exports = function(config) {
|
|||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
// preprocess matching files before serving them to the browser
|
|
||||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
|
||||||
preprocessors: {
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// test results reporter to use
|
// test results reporter to use
|
||||||
// possible values: 'dots', 'progress'
|
// possible values: 'dots', 'progress'
|
||||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||||
|
|||||||
6
awx/ui/tests/unit.js
Normal file
6
awx/ui/tests/unit.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
window.$AnsibleConfig = null;
|
||||||
|
window.$basePath = '/static/';
|
||||||
|
|
||||||
|
var testLoader = require('ember-cli/test-loader');
|
||||||
|
|
||||||
|
testLoader.default.load();
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import Tower from 'tower/app';
|
||||||
|
|
||||||
describe('Job Status Graph Directive', function() {
|
describe('Job Status Graph Directive', function() {
|
||||||
var element, scope, httpBackend;
|
var element, scope, httpBackend;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user