Skip to content

Commit 7dbe3f8

Browse files
author
Mykhailo Miroshnikov
committed
MAGETWO-35118: JavaScript Unit Test Framework supports theme feature
- Massive changes
1 parent 78c3b12 commit 7dbe3f8

File tree

28 files changed

+229
-58
lines changed

28 files changed

+229
-58
lines changed

Gruntfile.js

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@ module.exports = function (grunt) {
88
'use strict';
99

1010
var _ = require('underscore'),
11-
path = require('path');
11+
path = require('path'),
12+
configDir = './dev/tools/grunt/configs',
13+
taskDir = './dev/tools/grunt/tasks';
1214

1315
[
14-
'./dev/tools/grunt/tasks/mage-minify',
15-
'./dev/tools/grunt/tasks/deploy',
16+
taskDir + '/mage-minify',
17+
taskDir + '/deploy',
1618
'time-grunt'
1719
].forEach(function (task) {
1820
require(task)(grunt);
1921
});
2022

2123
require('load-grunt-config')(grunt, {
22-
configPath: path.join(process.cwd(), 'dev/tools/grunt/configs'),
24+
configPath: path.join(__dirname, configDir),
2325
init: true,
2426
loadGruntTasks: {
2527
pattern: [
@@ -85,10 +87,27 @@ module.exports = function (grunt) {
8587
'usebanner:documentationHtml'
8688
],
8789

88-
spec: [
89-
'connect:frontend',
90-
'jasmine:frontend'
91-
]
90+
spec: function (theme) {
91+
var tasks = [],
92+
themes = require(configDir + '/themes');
93+
94+
function tasksFor(theme) {
95+
return [
96+
'connect:' + theme,
97+
'jasmine:' + theme
98+
];
99+
}
100+
101+
if (!theme) {
102+
Object.keys(themes).forEach(function (theme) {
103+
tasks = tasks.concat(tasksFor(theme));
104+
});
105+
} else {
106+
tasks = tasksFor(theme);
107+
}
108+
109+
grunt.task.run(tasks);
110+
}
92111
}, function (task, name) {
93112
grunt.registerTask(name, task);
94113
});

0 commit comments

Comments
 (0)