Skip to content

Commit

Permalink
Merge pull request #198 from magento-vanilla/MAGETWO-35118
Browse files Browse the repository at this point in the history
[Vanilla] Improved JavaScript Testing Environment
  • Loading branch information
vpelipenko committed Mar 31, 2015
2 parents 6d0fb7a + 83fd23d commit dbd56db
Show file tree
Hide file tree
Showing 101 changed files with 398 additions and 433 deletions.
46 changes: 21 additions & 25 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@ module.exports = function (grunt) {
'use strict';

var _ = require('underscore'),
path = require('path');
path = require('path'),
configDir = './dev/tools/grunt/configs',
taskDir = './dev/tools/grunt/tasks';

require('./dev/tools/grunt/tasks/mage-minify')(grunt);
require('time-grunt')(grunt);
[
taskDir + '/mage-minify',
taskDir + '/deploy',
'time-grunt'
].forEach(function (task) {
require(task)(grunt);
});

require('load-grunt-config')(grunt, {
configPath: path.join(process.cwd(), 'dev/tools/grunt/configs'),
configPath: path.join(__dirname, configDir),
init: true,
loadGruntTasks: {
pattern: [
'grunt-*',
'!grunt-template-jasmine-requirejs'
'grunt-*'
]
}
});
Expand Down Expand Up @@ -78,24 +84,6 @@ module.exports = function (grunt) {
'clean:pub'
],

spec: [
'specRunner:lib',
'specRunner:backend',
'specRunner:frontend'
],

unit: [
'jasmine:lib-unit',
'jasmine:backend-unit',
'jasmine:frontend-unit'
],

integration: [
'jasmine:lib-integration',
'jasmine:backend-integration',
'jasmine:frontend-integration'
],

'legacy-build': [
'mage-minify:legacy'
],
Expand All @@ -104,7 +92,15 @@ module.exports = function (grunt) {
'usebanner:documentationCss',
'usebanner:documentationLess',
'usebanner:documentationHtml'
]
],

spec: function (theme) {
var runner = require('./dev/tests/js/jasmine/spec_runner');

runner.init(grunt, { theme: theme });

grunt.task.run(runner.getTasks());
}
}, function (task, name) {
grunt.registerTask(name, task);
});
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
return array(
'server' => 'http://localhost:9876',
'load' => array(
'/dev/tests/js/framework',
'/dev/tests/js/JsTestDriver/framework',
'/lib/web/mage/webapi.js',
'/lib/web/mage/validation/validation.js',
'/app/code/Magento/DesignEditor/view/adminhtml/web/js/infinitescroll.js',
Expand All @@ -33,6 +33,6 @@ return array(
'/lib/web/mage/gallery-fullscreen.js',
'/lib/web/mage/zoom.js',
),
'test' => array('/dev/tests/js/testsuite'),
'test' => array('/dev/tests/js/JsTestDriver/testsuite'),
'JsTestDriver' => '{{path_to_jstestdriver_jar}}'
);
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'/lib/web/underscore.js',
'/lib/web/mage/template.js',
'/lib/web/jquery/jquery-ui-1.9.2.js',
'/dev/tests/js/framework/requirejs-util.js',
'/dev/tests/js/JsTestDriver/framework/requirejs-util.js',
'/lib/web/jquery/jquery.cookie.js',
'/lib/web/mage/apply/main.js',
'/lib/web/mage/mage.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* See COPYING.txt for license details.
*/

define('RELATIVE_APP_ROOT', '../../..');
require __DIR__ . '/../../../app/autoload.php';
define('RELATIVE_APP_ROOT', '../../../..');
require __DIR__ . '/../../../../app/autoload.php';

$userConfig = normalize('jsTestDriver.php');
$defaultConfig = normalize('jsTestDriver.php.dist');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
200 changes: 0 additions & 200 deletions dev/tests/js/framework/spec_runner.js

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* See COPYING.txt for license details.
*/
define([
'tests/tools',
'tests/assets/tools',
'tests/assets/apply/components/fn',
'text!./config.json',
'text!./templates/node.html'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* See COPYING.txt for license details.
*/
define([
'tests/tools',
'tests/assets/tools',
'text!./config.json',
'text!./templates/selector.html',
'text!./templates/virtual.html'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ define(function () {
return {
local: {
path: 'text!tests/assets/text/local.html',
result: '<span>Local Template</span>'
result: '<!--\n/**\n * Copyright © 2015 Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\n-->\n<span>Local Template</span>'
},
external: {
path: 'text!tests/assets/text/external.html',
result: '<span>External Template</span>'
result: '<!--\n/**\n * Copyright © 2015 Magento. All rights reserved.\n * See COPYING.txt for license details.\n */\n-->\n<span>External Template</span>'
}
};
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions dev/tests/js/jasmine/require.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

'use strict';

require.config({
baseUrl: './',
bundles: {
'mage/requirejs/static': [
'buildTools',
'jsbuild',
'statistician',
'text'
]
},
paths: {
'tests': 'dev/tests/js/jasmine'
},
config: {
jsbuild: {
'dev/tests/js/jasmine/assets/jsbuild/local.js': 'define([], function () {\'use strict\'; return \'internal module\'; });'
},
text: {
'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>'
}
},
deps: [
'mage/requirejs/static'
]
});
Loading

0 comments on commit dbd56db

Please sign in to comment.