diff --git a/Gruntfile.js b/Gruntfile.js index 05ef19e2e5c317dafde9ca5be9edd690f33c12f8..52e8da6cb725d77e9b6654749010e6862c41c485 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -480,6 +480,11 @@ module.exports = function (grunt) { areaDir: 'frontend', theme: 'blank' } + }, + lib: { + options: { + port: 8080 + } } }, @@ -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), @@ -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' ]); diff --git a/dev/tests/js/framework/spec_runner.js b/dev/tests/js/framework/spec_runner.js index 0cd028c43851d7983247889f4ade463123339425..66a7d3d6abb856a12f0fcdbb6ba77025efe32d68 100644 --- a/dev/tests/js/framework/spec_runner.js +++ b/dev/tests/js/framework/spec_runner.js @@ -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 } } }; @@ -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 });