Skip to content

Commit e54957b

Browse files
committed
MAGETWO-32485: Merge initialization of all components on body element to one initialization file
- Fixes with pathes in spec_runner
1 parent f75077b commit e54957b

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

Gruntfile.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ module.exports = function (grunt) {
129129

130130
specRunner: {
131131
options: {
132-
shareDir: 'base',
133-
enableLogs: false
132+
shareDir: 'base'
134133
},
135134
backend: {
136135
options: {

dev/tests/js/framework/dev/tests/js/framework/spec_runner.js renamed to dev/tests/js/framework/spec_runner.js

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,12 @@ module.exports.init = function (grunt) {
1515
var connect = require('connect'),
1616
logger = require('morgan'),
1717
serveStatic = require('serve-static'),
18-
fs = require('fs');
18+
fs = require('fs'),
19+
root;
1920

20-
/**
21-
* Defines if passed file path exists
22-
*
23-
* @param {String} path
24-
* @return {Boolean}
25-
*/
26-
function exists(path) {
27-
return fs.existsSync(__dirname + path);
28-
}
29-
30-
/**
31-
* Restricts url's which lead to '/_SpecRunner.html', '/dev/tests' or '.grunt' folders from being modified
32-
*
33-
* @param {String} url
34-
* @return {Boolean}
35-
*/
36-
function canModify(url) {
37-
return url.match(/^\/(\.grunt)|(dev\/tests)|(_SpecRunner\.html)/) === null;
38-
}
21+
root = __dirname
22+
.replace('/dev/tests/js/framework', '')
23+
.replace('\\dev\\tests\\js\\framework', '');
3924

4025
grunt.registerMultiTask('specRunner', function () {
4126
var app = connect(),
@@ -158,10 +143,30 @@ module.exports.init = function (grunt) {
158143
}
159144
}
160145

161-
app.use(serveStatic(__dirname));
146+
app.use(serveStatic(root));
162147

163148
app.listen(options.port);
164149
});
150+
151+
/**
152+
* Defines if passed file path exists
153+
*
154+
* @param {String} path
155+
* @return {Boolean}
156+
*/
157+
function exists(path) {
158+
return fs.existsSync(root + path);
159+
}
160+
161+
/**
162+
* Restricts url's which lead to '/_SpecRunner.html', '/dev/tests' or '.grunt' folders from being modified
163+
*
164+
* @param {String} url
165+
* @return {Boolean}
166+
*/
167+
function canModify(url) {
168+
return url.match(/^\/(\.grunt)|(dev\/tests)|(dev\\tests)|(_SpecRunner\.html)/) === null;
169+
}
165170
};
166171

167172
/**

0 commit comments

Comments
 (0)