test(jQuery): Run tests with jQuery 3

(cherry-picked from 859b1e300c)

Closes #14874
This commit is contained in:
Michał Gołębiowski
2016-07-06 14:05:39 +02:00
parent 0318761f7a
commit d9de526059
7 changed files with 51 additions and 41 deletions
+4 -1
View File
@@ -83,6 +83,7 @@ module.exports = function(grunt) {
tests: {
jqlite: 'karma-jqlite.conf.js',
jquery: 'karma-jquery.conf.js',
'jquery-2.2': 'karma-jquery-2.2.conf.js',
'jquery-2.1': 'karma-jquery-2.1.conf.js',
docs: 'karma-docs.conf.js',
modules: 'karma-modules.conf.js'
@@ -92,6 +93,7 @@ module.exports = function(grunt) {
autotest: {
jqlite: 'karma-jqlite.conf.js',
jquery: 'karma-jquery.conf.js',
'jquery-2.2': 'karma-jquery-2.2.conf.js',
'jquery-2.1': 'karma-jquery-2.1.conf.js',
modules: 'karma-modules.conf.js',
docs: 'karma-docs.conf.js'
@@ -364,10 +366,11 @@ module.exports = function(grunt) {
grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'jscs', 'package', 'test:unit', 'test:promises-aplus', 'tests:docs', 'test:protractor']);
grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
grunt.registerTask('test:jquery', 'Run the jQuery (latest) unit tests with Karma', ['tests:jquery']);
grunt.registerTask('test:jquery-2.2', 'Run the jQuery 2.2 unit tests with Karma', ['tests:jquery-2.2']);
grunt.registerTask('test:jquery-2.1', 'Run the jQuery 2.1 unit tests with Karma', ['tests:jquery-2.1']);
grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['build', 'tests:modules']);
grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['test:jqlite', 'test:jquery', 'test:jquery-2.1', 'test:modules']);
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['test:jqlite', 'test:jquery', 'test:jquery-2.2', 'test:jquery-2.1', 'test:modules']);
grunt.registerTask('test:protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'protractor:normal']);
grunt.registerTask('test:travis-protractor', 'Run the end to end tests with Protractor for Travis CI builds', ['connect:testserver', 'protractor:travis']);
grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor for Jenkins CI builds', ['webdriver', 'connect:testserver', 'protractor:jenkins']);
+11 -9
View File
@@ -237,15 +237,6 @@ var angularFiles = {
'@angularTest'
],
'karmaJqueryOld': [
'bower_components/jquery-2.1/dist/jquery.js',
'test/jquery_alias.js',
'@angularSrc',
'@angularSrcModules',
'@angularScenario',
'@angularTest'
],
'karmaJqueryExclude': [
'src/angular-bootstrap.js',
'src/ngScenario/angular-bootstrap.js',
@@ -254,6 +245,17 @@ var angularFiles = {
]
};
['2.1', '2.2'].forEach(function (jQueryVersion) {
angularFiles['karmaJquery' + jQueryVersion] = []
.concat(angularFiles.karmaJquery)
.map(function (path) {
if (path.startsWith('bower_components/jquery')) {
return path.replace(/^bower_components\/jquery/, 'bower_components/jquery-' + jQueryVersion);
}
return path;
});
});
angularFiles['angularSrcModules'] = [].concat(
angularFiles['angularModules']['ngAnimate'],
angularFiles['angularModules']['ngMessageFormat'],
+2 -1
View File
@@ -2,7 +2,8 @@
"name": "AngularJS",
"license": "MIT",
"devDependencies": {
"jquery": "2.2.3",
"jquery": "3.1.0",
"jquery-2.2": "jquery#2.2.4",
"jquery-2.1": "jquery#2.1.4",
"closure-compiler": "https://dl.google.com/closure-compiler/compiler-20140814.zip",
"ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.2.3/assets/ng-closure-runner.zip"
+2 -15
View File
@@ -1,18 +1,5 @@
'use strict';
var angularFiles = require('./angularFiles');
var sharedConfig = require('./karma-shared.conf');
var karmaConfigFactory = require('./karma-jquery.conf-factory');
module.exports = function(config) {
sharedConfig(config, {testName: 'AngularJS: jQuery', logFile: 'karma-jquery.log'});
config.set({
files: angularFiles.mergeFilesFor('karmaJqueryOld'),
exclude: angularFiles.mergeFilesFor('karmaJqueryExclude'),
junitReporter: {
outputFile: 'test_out/jquery.xml',
suite: 'jQuery'
}
});
};
module.exports = karmaConfigFactory('2.1');
+5
View File
@@ -0,0 +1,5 @@
'use strict';
var karmaConfigFactory = require('./karma-jquery.conf-factory');
module.exports = karmaConfigFactory('2.2');
+25
View File
@@ -0,0 +1,25 @@
'use strict';
var angularFiles = require('./angularFiles');
var sharedConfig = require('./karma-shared.conf');
module.exports = function (version) {
version = version || '';
return function(config) {
sharedConfig(config, {
testName: 'AngularJS: jQuery' + (version ? ' ' + version : ''),
logFile: 'karma-jquery' + version + '.log'
});
config.set({
files: angularFiles.mergeFilesFor('karmaJquery' + version),
exclude: angularFiles.mergeFilesFor('karmaJqueryExclude'),
junitReporter: {
outputFile: 'test_out/jquery.xml',
suite: 'jQuery'
}
});
};
};
+2 -15
View File
@@ -1,18 +1,5 @@
'use strict';
var angularFiles = require('./angularFiles');
var sharedConfig = require('./karma-shared.conf');
var karmaConfigFactory = require('./karma-jquery.conf-factory');
module.exports = function(config) {
sharedConfig(config, {testName: 'AngularJS: jQuery', logFile: 'karma-jquery.log'});
config.set({
files: angularFiles.mergeFilesFor('karmaJquery'),
exclude: angularFiles.mergeFilesFor('karmaJqueryExclude'),
junitReporter: {
outputFile: 'test_out/jquery.xml',
suite: 'jQuery'
}
});
};
module.exports = karmaConfigFactory();