Skip to content

Commit

Permalink
Merge pull request #76 from magento-vanilla/MAGETWO-33522
Browse files Browse the repository at this point in the history
[Vanilla] Improved JS Testing Infrastructure (MAGETWO-33522)
  • Loading branch information
vpelipenko committed Feb 3, 2015
2 parents daa5103 + 6fbb67f commit 7e07209
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
10 changes: 10 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,11 @@ module.exports = function (grunt) {
areaDir: 'frontend',
theme: 'blank'
}
},
lib: {
options: {
port: 8080
}
}
},

Expand All @@ -488,6 +493,8 @@ module.exports = function (grunt) {
template: require('grunt-template-jasmine-requirejs'),
ignoreEmpty: true
},
'lib-unit': specRunner.configure('unit', 'lib', 8080),
'lib-integration': specRunner.configure('integration', 'lib', 8080),
'backend-unit': specRunner.configure('unit', 'adminhtml', 8000),
'backend-integration': specRunner.configure('integration', 'adminhtml', 8000),
'frontend-unit': specRunner.configure('unit', 'frontend', 3000),
Expand Down Expand Up @@ -550,16 +557,19 @@ module.exports = function (grunt) {
// ---------------------------------------------

grunt.registerTask('spec', [
'specRunner:lib',
'specRunner:backend',
'specRunner:frontend'
]);

grunt.registerTask('unit', [
'jasmine:lib-unit',
'jasmine:backend-unit',
'jasmine:frontend-unit'
]);

grunt.registerTask('integration', [
'jasmine:lib-integration',
'jasmine:backend-integration',
'jasmine:frontend-integration'
]);
Expand Down
22 changes: 14 additions & 8 deletions dev/tests/js/framework/spec_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@
function buildConfig(type, dir, port) {
'use strict';

var isLib = dir === 'lib',
requireConfigs = ['<%= path.spec %>/require.config.js'],
specsRoot = '<%= path.spec %>/' + type,
specs = specsRoot + (isLib ? '/lib/**/*.js' : '/**/' + dir + '/**/*.js');

if (!isLib) {
requireConfigs.push('<%= path.spec %>/' + type + '/config/' + dir + '.js');
}

return {
src: '<%= path.spec %>/shim.js',
options: {
host: 'http://localhost:' + port,
specs: '<%= path.spec %>/' + type + '/**/' + dir + '/**/*.js',
specs: specs,
templateOptions: {
requireConfigFile: [
'<%= path.spec %>/require.config.js',
'<%= path.spec %>/' + type + '/config/' + dir + '.js'
]
requireConfigFile: requireConfigs
}
}
};
Expand Down Expand Up @@ -51,9 +57,9 @@ module.exports = function (grunt) {

options = this.options({
port: 3000,
theme: 'blank',
areaDir: 'adminhtml',
shareDir: 'base',
theme: null,
areaDir: null,
shareDir: null,
enableLogs: false,
middleware: null
});
Expand Down

0 comments on commit 7e07209

Please sign in to comment.