🌐 AI搜索 & 代理 主页
Skip to content

Commit 7591f23

Browse files
committed
Build:Tests: Fix custom build tests, verify on Travis; name Travis jobs
This commit fixes unit tests for the following builds: 1. The no-deprecated build: `custom:-deprecated` 2. The current slim build: `custom:-ajax,-effects` 3. The 4.0 (jquery#4553) slim build: `custom:-ajax,-callbacks,-deferred,-effects` It also adds separate Travis jobs for the no-deprecated & slim builds. Apart from that, add intuitive names to Travis jobs. Otherwise it's hard to see at a glance that a particular job is running on Firefox ESR, for example. Ref jquerygh-4577 Ref jquerygh-4596
1 parent 7a3cf9c commit 7591f23

26 files changed

+265
-178
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ npm-debug.log*
1919
/node_modules
2020

2121
/test/data/core/jquery-iterability-transpiled.js
22+
/test/data/qunit-fixture.js

.travis.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,37 @@ env:
99
- NPM_SCRIPT=test:browserless
1010
matrix:
1111
include:
12-
# Run browser tests only on one Node.js version to save time.
13-
- node_js: "12"
12+
- name: "Browser tests: full build, Chrome & Firefox stable"
13+
node_js: "12"
1414
env:
1515
- NPM_SCRIPT="test:browser"
1616
- BROWSERS="ChromeHeadless,FirefoxHeadless"
1717
addons:
1818
chrome: stable
1919
firefox: latest
20-
# Run AMD tests.
21-
- node_js: "12"
20+
- name: "Browser tests: slim build, Chrome stable"
21+
node_js: "12"
22+
env:
23+
- NPM_SCRIPT="test:slim"
24+
- BROWSERS="ChromeHeadless"
25+
addons:
26+
chrome: stable
27+
- name: "Browser tests: no-deprecated build, Chrome stable"
28+
node_js: "12"
29+
env:
30+
- NPM_SCRIPT="test:no-deprecated"
31+
- BROWSERS="ChromeHeadless"
32+
addons:
33+
chrome: stable
34+
- name: "Browser tests: AMD build, Chrome stable"
35+
node_js: "12"
2236
env:
2337
- NPM_SCRIPT="test:amd"
2438
- BROWSERS="ChromeHeadless"
2539
addons:
2640
chrome: stable
27-
# Run tests on Firefox ESR as well.
28-
- node_js: "12"
41+
- name: "Browser tests: full build, Firefox ESR"
42+
node_js: "12"
2943
env:
3044
- NPM_SCRIPT="test:browser"
3145
- BROWSERS="FirefoxHeadless"

Gruntfile.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = function( grunt ) {
4141
retainLines: true,
4242
plugins: [ "@babel/transform-for-of" ]
4343
},
44-
nodeSmokeTests: {
44+
tests: {
4545
files: {
4646
"test/data/core/jquery-iterability-transpiled.js":
4747
"test/data/core/jquery-iterability-transpiled-es6.js"
@@ -351,7 +351,13 @@ module.exports = function( grunt ) {
351351
"karma:jsdom"
352352
] );
353353

354+
grunt.registerTask( "test:prepare", [
355+
"qunit_fixture",
356+
"babel:tests"
357+
] );
358+
354359
grunt.registerTask( "test", [
360+
"test:prepare",
355361
"test:fast",
356362
"test:slow"
357363
] );
@@ -372,7 +378,7 @@ module.exports = function( grunt ) {
372378
"uglify",
373379
"remove_map_comment",
374380
"dist:*",
375-
"qunit_fixture",
381+
"test:prepare",
376382
"eslint:dist",
377383
"test:fast",
378384
"compare_size"

build/tasks/node_smoke_tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = ( grunt ) => {
44
const fs = require( "fs" );
55
const spawnTest = require( "./lib/spawn_test.js" );
66
const testsDir = "./test/node_smoke_tests/";
7-
const nodeSmokeTests = [ "babel:nodeSmokeTests" ];
7+
const nodeSmokeTests = [];
88

99
// Fire up all tests defined in test/node_smoke_tests/*.js in spawned sub-processes.
1010
// All the files under test/node_smoke_tests/*.js are supposed to exit with 0 code

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@
7272
"test:browserless": "grunt && grunt test:slow",
7373
"test:browser": "grunt && grunt karma:main",
7474
"test:amd": "grunt && grunt karma:amd",
75-
"test": "grunt && grunt test:slow && grunt karma:main && grunt karma:amd",
75+
"test:no-deprecated": "grunt test:prepare && grunt custom:-deprecated && grunt karma:main",
76+
"test:slim": "grunt test:prepare && grunt custom:slim && grunt karma:main",
77+
"test": "npm run test:slim && npm run test:no-deprecated && grunt && grunt test:slow && grunt karma:main && grunt karma:amd",
7678
"jenkins": "npm run test:browserless"
7779
},
7880
"commitplease": {

src/ajax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ define( [
88
"./ajax/var/rquery",
99

1010
"./core/init",
11-
"./ajax/parseXML",
11+
"./core/parseXML",
1212
"./event/trigger",
1313
"./deferred",
1414
"./serialize" // jQuery.param

src/jquery.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ define( [
2323
"./ajax/script",
2424
"./ajax/jsonp",
2525
"./ajax/load",
26+
"./core/parseXML",
27+
"./core/parseHTML",
2628
"./effects",
2729
"./effects/animatedSelector",
2830
"./offset",

test/data/core/dynamic_ready.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<script src="../../jquery.js"></script>
5+
<script src="../jquery-1.9.1.js"></script>
66
<script>var $j = jQuery.noConflict();</script>
77
<script src="../iframeTest.js"></script>
88
</head>

test/data/offset/absolute.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
<script src="../../jquery.js"></script>
1919
<script src="../iframeTest.js"></script>
2020
<script type="text/javascript" charset="utf-8">
21-
jQuery(function($) {
22-
$(".absolute").click(function() {
23-
$("#marker").css( $(this).offset() );
24-
var pos = $(this).position();
25-
$(this).css({ top: pos.top, left: pos.left });
21+
jQuery( function( $ ) {
22+
$( ".absolute" ).on( "click", function() {
23+
$( "#marker" ).css( $( this ).offset() );
24+
var pos = $( this ).position();
25+
$( this ).css( { top: pos.top, left: pos.left } );
2626
return false;
27-
});
27+
} );
2828
startIframeTest();
29-
});
29+
} );
3030
</script>
3131
</head>
3232
<body>

0 commit comments

Comments
 (0)