Last active
December 12, 2015 06:39
-
-
Save jhiemer/4731013 to your computer and use it in GitHub Desktop.
Testacular Configuration for AngularJS in usage with require.js
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
'use strict'; | |
require.config({ | |
paths: { | |
underscore: '../libs/underscore/underscore', | |
angular: '../libs/angular/angular.min', | |
angularResource: '../libs/angular/angular-resource.min', | |
angularCookies: '../libs/angular/angular-cookies.min', | |
text: '../libs/require/text', | |
moment: '../libs/moment/moment.min', | |
}, | |
shim: { | |
'angular' : {'exports' : 'angular'}, | |
'angular-resource' : {deps:['angular']}, | |
'underscore': {exports: '_'} | |
}, | |
priority: [ | |
"angular" | |
], | |
urlArgs: 'v=0.1' | |
}); | |
require([ | |
'angular', | |
'angularResource', | |
'angularCookies', | |
'moment', | |
'app', | |
'routes', | |
etc... | |
], function(angular, app) { | |
angular.element(document).ready(function () { | |
angular.bootstrap(document, ['myApp']); | |
}); | |
}); |
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
(function (window, require) { | |
"use strict"; | |
var file, requireModules; | |
requireModules = []; | |
for (file in window.__testacular__.files) { | |
if (window.__testacular__.files.hasOwnProperty(file)) { | |
if (file.substring(file.length - 7, file.length) === 'Spec.js') { | |
requireModules.push(file); | |
} | |
} | |
} | |
requireModules.push("app"); | |
requireModules.push("mocks"); | |
require({ | |
baseUrl:'/base/app/js', | |
paths:{ | |
'angular':'../libs/angular/angular', | |
'mocks':'../../test/libs/angular/angular-mocks' | |
}, | |
shim:{ | |
'angular' : {'exports' : 'angular'}, | |
'mocks':{ deps:['angular'], exports:'mocks' } | |
} | |
}, requireModules, function () { | |
console.log("Trying to start Testacular"); | |
window.__testacular__.start(); | |
}, function (err) { | |
console.log(err); | |
}); | |
}(window, require)); |
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
-app | |
-js | |
- controller | |
- directives | |
- ... | |
- app.js | |
- main.js | |
- routes.js | |
-libs | |
- angular | |
- require | |
-scripts | |
-test.sh | |
-test | |
- libs | |
- angular | |
- unit | |
... |
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
basePath = '../'; | |
files = [ | |
JASMINE, | |
JASMINE_ADAPTER, | |
REQUIRE, | |
REQUIRE_ADAPTER, | |
{pattern:'app/libs/angular/angular.js', included:false}, | |
{pattern:'test/libs/angular/angular-mocks.js', included:false}, | |
{pattern:'app/js/**/*', included:false}, //Produktionscode | |
{pattern:'test/unit/**/*.js', included:false}, //Testcode | |
'test/main-test.js' //requireJS-Konfiguration | |
]; | |
autoWatch = true; | |
browsers = ['Chrome']; | |
junitReporter = { | |
outputFile: 'test_out/unit.xml', | |
suite: 'unit' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment