Skip to content

Commit 7e07209

Browse files
committed
Merge pull request #76 from magento-vanilla/MAGETWO-33522
[Vanilla] Improved JS Testing Infrastructure (MAGETWO-33522)
2 parents daa5103 + 6fbb67f commit 7e07209

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

Gruntfile.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,11 @@ module.exports = function (grunt) {
480480
areaDir: 'frontend',
481481
theme: 'blank'
482482
}
483+
},
484+
lib: {
485+
options: {
486+
port: 8080
487+
}
483488
}
484489
},
485490

@@ -488,6 +493,8 @@ module.exports = function (grunt) {
488493
template: require('grunt-template-jasmine-requirejs'),
489494
ignoreEmpty: true
490495
},
496+
'lib-unit': specRunner.configure('unit', 'lib', 8080),
497+
'lib-integration': specRunner.configure('integration', 'lib', 8080),
491498
'backend-unit': specRunner.configure('unit', 'adminhtml', 8000),
492499
'backend-integration': specRunner.configure('integration', 'adminhtml', 8000),
493500
'frontend-unit': specRunner.configure('unit', 'frontend', 3000),
@@ -550,16 +557,19 @@ module.exports = function (grunt) {
550557
// ---------------------------------------------
551558

552559
grunt.registerTask('spec', [
560+
'specRunner:lib',
553561
'specRunner:backend',
554562
'specRunner:frontend'
555563
]);
556564

557565
grunt.registerTask('unit', [
566+
'jasmine:lib-unit',
558567
'jasmine:backend-unit',
559568
'jasmine:frontend-unit'
560569
]);
561570

562571
grunt.registerTask('integration', [
572+
'jasmine:lib-integration',
563573
'jasmine:backend-integration',
564574
'jasmine:frontend-integration'
565575
]);

dev/tests/js/framework/spec_runner.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,22 @@
1313
function buildConfig(type, dir, port) {
1414
'use strict';
1515

16+
var isLib = dir === 'lib',
17+
requireConfigs = ['<%= path.spec %>/require.config.js'],
18+
specsRoot = '<%= path.spec %>/' + type,
19+
specs = specsRoot + (isLib ? '/lib/**/*.js' : '/**/' + dir + '/**/*.js');
20+
21+
if (!isLib) {
22+
requireConfigs.push('<%= path.spec %>/' + type + '/config/' + dir + '.js');
23+
}
24+
1625
return {
1726
src: '<%= path.spec %>/shim.js',
1827
options: {
1928
host: 'http://localhost:' + port,
20-
specs: '<%= path.spec %>/' + type + '/**/' + dir + '/**/*.js',
29+
specs: specs,
2130
templateOptions: {
22-
requireConfigFile: [
23-
'<%= path.spec %>/require.config.js',
24-
'<%= path.spec %>/' + type + '/config/' + dir + '.js'
25-
]
31+
requireConfigFile: requireConfigs
2632
}
2733
}
2834
};
@@ -51,9 +57,9 @@ module.exports = function (grunt) {
5157

5258
options = this.options({
5359
port: 3000,
54-
theme: 'blank',
55-
areaDir: 'adminhtml',
56-
shareDir: 'base',
60+
theme: null,
61+
areaDir: null,
62+
shareDir: null,
5763
enableLogs: false,
5864
middleware: null
5965
});

0 commit comments

Comments
 (0)