Skip to content

Commit dbd56db

Browse files
committed
Merge pull request #198 from magento-vanilla/MAGETWO-35118
[Vanilla] Improved JavaScript Testing Environment
2 parents 6d0fb7a + 83fd23d commit dbd56db

File tree

101 files changed

+398
-433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+398
-433
lines changed

Gruntfile.js

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,24 @@ 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

13-
require('./dev/tools/grunt/tasks/mage-minify')(grunt);
14-
require('time-grunt')(grunt);
15+
[
16+
taskDir + '/mage-minify',
17+
taskDir + '/deploy',
18+
'time-grunt'
19+
].forEach(function (task) {
20+
require(task)(grunt);
21+
});
1522

1623
require('load-grunt-config')(grunt, {
17-
configPath: path.join(process.cwd(), 'dev/tools/grunt/configs'),
24+
configPath: path.join(__dirname, configDir),
1825
init: true,
1926
loadGruntTasks: {
2027
pattern: [
21-
'grunt-*',
22-
'!grunt-template-jasmine-requirejs'
28+
'grunt-*'
2329
]
2430
}
2531
});
@@ -78,24 +84,6 @@ module.exports = function (grunt) {
7884
'clean:pub'
7985
],
8086

81-
spec: [
82-
'specRunner:lib',
83-
'specRunner:backend',
84-
'specRunner:frontend'
85-
],
86-
87-
unit: [
88-
'jasmine:lib-unit',
89-
'jasmine:backend-unit',
90-
'jasmine:frontend-unit'
91-
],
92-
93-
integration: [
94-
'jasmine:lib-integration',
95-
'jasmine:backend-integration',
96-
'jasmine:frontend-integration'
97-
],
98-
9987
'legacy-build': [
10088
'mage-minify:legacy'
10189
],
@@ -104,7 +92,15 @@ module.exports = function (grunt) {
10492
'usebanner:documentationCss',
10593
'usebanner:documentationLess',
10694
'usebanner:documentationHtml'
107-
]
95+
],
96+
97+
spec: function (theme) {
98+
var runner = require('./dev/tests/js/jasmine/spec_runner');
99+
100+
runner.init(grunt, { theme: theme });
101+
102+
grunt.task.run(runner.getTasks());
103+
}
108104
}, function (task, name) {
109105
grunt.registerTask(name, task);
110106
});
File renamed without changes.

dev/tests/js/jsTestDriver.php.dist renamed to dev/tests/js/JsTestDriver/jsTestDriver.php.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
return array(
1212
'server' => 'http://localhost:9876',
1313
'load' => array(
14-
'/dev/tests/js/framework',
14+
'/dev/tests/js/JsTestDriver/framework',
1515
'/lib/web/mage/webapi.js',
1616
'/lib/web/mage/validation/validation.js',
1717
'/app/code/Magento/DesignEditor/view/adminhtml/web/js/infinitescroll.js',
@@ -33,6 +33,6 @@ return array(
3333
'/lib/web/mage/gallery-fullscreen.js',
3434
'/lib/web/mage/zoom.js',
3535
),
36-
'test' => array('/dev/tests/js/testsuite'),
36+
'test' => array('/dev/tests/js/JsTestDriver/testsuite'),
3737
'JsTestDriver' => '{{path_to_jstestdriver_jar}}'
3838
);

dev/tests/js/jsTestDriverOrder.php renamed to dev/tests/js/JsTestDriver/jsTestDriverOrder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'/lib/web/underscore.js',
1515
'/lib/web/mage/template.js',
1616
'/lib/web/jquery/jquery-ui-1.9.2.js',
17-
'/dev/tests/js/framework/requirejs-util.js',
17+
'/dev/tests/js/JsTestDriver/framework/requirejs-util.js',
1818
'/lib/web/jquery/jquery.cookie.js',
1919
'/lib/web/mage/apply/main.js',
2020
'/lib/web/mage/mage.js',

dev/tests/js/run_js_tests.php renamed to dev/tests/js/JsTestDriver/run_js_tests.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* See COPYING.txt for license details.
77
*/
88

9-
define('RELATIVE_APP_ROOT', '../../..');
10-
require __DIR__ . '/../../../app/autoload.php';
9+
define('RELATIVE_APP_ROOT', '../../../..');
10+
require __DIR__ . '/../../../../app/autoload.php';
1111

1212
$userConfig = normalize('jsTestDriver.php');
1313
$defaultConfig = normalize('jsTestDriver.php.dist');

dev/tests/js/framework/spec_runner.js

Lines changed: 0 additions & 200 deletions
This file was deleted.

dev/tests/js/spec/assets/apply/index.js renamed to dev/tests/js/jasmine/assets/apply/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55
define([
6-
'tests/tools',
6+
'tests/assets/tools',
77
'tests/assets/apply/components/fn',
88
'text!./config.json',
99
'text!./templates/node.html'

dev/tests/js/spec/assets/script/index.js renamed to dev/tests/js/jasmine/assets/script/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55
define([
6-
'tests/tools',
6+
'tests/assets/tools',
77
'text!./config.json',
88
'text!./templates/selector.html',
99
'text!./templates/virtual.html'

dev/tests/js/spec/assets/text/config.js renamed to dev/tests/js/jasmine/assets/text/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ define(function () {
88
return {
99
local: {
1010
path: 'text!tests/assets/text/local.html',
11-
result: '<span>Local Template</span>'
11+
result: '<!--\n/**\n * Copyright © 2015 Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\n-->\n<span>Local Template</span>'
1212
},
1313
external: {
1414
path: 'text!tests/assets/text/external.html',
15-
result: '<span>External Template</span>'
15+
result: '<!--\n/**\n * Copyright © 2015 Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\n-->\n<span>External Template</span>'
1616
}
1717
};
1818
});
File renamed without changes.

dev/tests/js/jasmine/require.conf.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright © 2015 Magento. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
'use strict';
7+
8+
require.config({
9+
baseUrl: './',
10+
bundles: {
11+
'mage/requirejs/static': [
12+
'buildTools',
13+
'jsbuild',
14+
'statistician',
15+
'text'
16+
]
17+
},
18+
paths: {
19+
'tests': 'dev/tests/js/jasmine'
20+
},
21+
config: {
22+
jsbuild: {
23+
'dev/tests/js/jasmine/assets/jsbuild/local.js': 'define([], function () {\'use strict\'; return \'internal module\'; });'
24+
},
25+
text: {
26+
'dev/tests/js/jasmine/assets/text/local.html': '<!--\n/**\n * Copyright © 2015 Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\n-->\n<span>Local Template</span>'
27+
}
28+
},
29+
deps: [
30+
'mage/requirejs/static'
31+
]
32+
});

0 commit comments

Comments
 (0)