Skip to content

Commit 0f780ba

Browse files
authored
Build:Tests: Fix custom build tests, verify on Travis
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 future (jquery#4553) slim build: `custom:-ajax,-callbacks,-deferred,-effects` It also adds separate Travis jobs for the no-deprecated & slim builds. Closes jquerygh-4577
1 parent 1dad118 commit 0f780ba

26 files changed

+174
-84
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ npm-debug.log*
2121
/node_modules
2222

2323
/test/data/core/jquery-iterability-transpiled.js
24+
/test/data/qunit-fixture.js

.travis.yml

+14
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ matrix:
1717
addons:
1818
chrome: stable
1919
firefox: latest
20+
# Run tests against the slim build.
21+
- node_js: "12"
22+
env:
23+
- NPM_SCRIPT="test:slim"
24+
- BROWSERS="ChromeHeadless"
25+
addons:
26+
chrome: stable
27+
# Run tests against the no-deprecated build.
28+
- node_js: "12"
29+
env:
30+
- NPM_SCRIPT="test:no-deprecated"
31+
- BROWSERS="ChromeHeadless"
32+
addons:
33+
chrome: stable
2034
# Run ES module tests.
2135
- node_js: "12"
2236
env:

Gruntfile.js

+8-2
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"
@@ -314,7 +314,13 @@ module.exports = function( grunt ) {
314314
"karma:jsdom"
315315
] );
316316

317+
grunt.registerTask( "test:prepare", [
318+
"qunit_fixture",
319+
"babel:tests"
320+
] );
321+
317322
grunt.registerTask( "test", [
323+
"test:prepare",
318324
"test:fast",
319325
"test:slow"
320326
] );
@@ -336,7 +342,7 @@ module.exports = function( grunt ) {
336342
"uglify",
337343
"remove_map_comment",
338344
"dist:*",
339-
"qunit_fixture",
345+
"test:prepare",
340346
"eslint:dist",
341347
"test:fast",
342348
"compare_size"

build/tasks/node_smoke_tests.js

+1-1
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

+3-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@
7474
"test:browser": "grunt && grunt karma:main",
7575
"test:esmodules": "grunt && grunt karma:esmodules",
7676
"test:amd": "grunt && grunt karma:amd",
77-
"test": "grunt && grunt test:slow && grunt karma:main && grunt karma:esmodules && grunt karma:amd",
77+
"test:no-deprecated": "grunt test:prepare && grunt custom:-deprecated && grunt karma:main",
78+
"test:slim": "grunt test:prepare && grunt custom:slim && grunt karma:main",
79+
"test": "npm run test:slim && npm run test:no-deprecated && grunt && grunt test:slow && grunt karma:main && grunt karma:esmodules && grunt karma:amd",
7880
"jenkins": "npm run test:browserless"
7981
},
8082
"commitplease": {

src/ajax.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import nonce from "./ajax/var/nonce.js";
66
import rquery from "./ajax/var/rquery.js";
77

88
import "./core/init.js";
9-
import "./ajax/parseXML.js";
9+
import "./core/parseXML.js";
1010
import "./event/trigger.js";
1111
import "./deferred.js";
1212
import "./serialize.js"; // jQuery.param
File renamed without changes.

src/jquery.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ import "./ajax.js";
2121
import "./ajax/xhr.js";
2222
import "./ajax/script.js";
2323
import "./ajax/jsonp.js";
24-
import "./core/parseHTML.js";
2524
import "./ajax/load.js";
25+
import "./core/parseXML.js";
26+
import "./core/parseHTML.js";
2627
import "./event/ajax.js";
2728
import "./effects.js";
2829
import "./effects/animatedSelector.js";

test/data/core/dynamic_ready.html

+1-1
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

+7-7
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>

test/data/offset/body.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
<script src="../../jquery.js"></script>
1313
<script src="../iframeTest.js"></script>
1414
<script type="text/javascript" charset="utf-8">
15-
jQuery(function($) {
16-
$("body").click(function() {
17-
$("marker").css( $(this).offset() );
15+
jQuery( function( $ ) {
16+
$( "body" ).on( "click", function() {
17+
$( "#marker" ).css( $( this ).offset() );
1818
return false;
19-
});
19+
} );
2020
startIframeTest();
21-
});
21+
} );
2222
</script>
2323
</head>
2424
<body>

test/data/offset/fixed.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
<script src="../../jquery.js"></script>
1616
<script src="../iframeTest.js"></script>
1717
<script type="text/javascript" charset="utf-8">
18-
jQuery(function($) {
19-
window.scrollTo(1000,1000);
20-
$(".fixed").click(function() {
21-
$("#marker").css( $(this).offset() );
18+
jQuery( function( $ ) {
19+
window.scrollTo( 1000, 1000 );
20+
$( ".fixed" ).on( "click", function() {
21+
$( "#marker" ).css( $( this ).offset() );
2222
return false;
2323
});
2424
startIframeTest();

test/data/offset/relative.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
<script src="../../jquery.js"></script>
1515
<script src="../iframeTest.js"></script>
1616
<script type="text/javascript" charset="utf-8">
17-
jQuery(function($) {
18-
$(".relative").click(function() {
19-
$("#marker").css( $(this).offset() );
20-
var pos = $(this).position();
21-
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
17+
jQuery( function( $ ) {
18+
$( ".relative" ).on( "click", function() {
19+
$( "#marker" ).css( $( this ).offset() );
20+
var pos = $( this ).position();
21+
$( this ).css( { position: 'absolute', top: pos.top, left: pos.left } );
2222
return false;
23-
});
23+
} );
2424
startIframeTest();
25-
});
25+
} );
2626
</script>
2727
</head>
2828
<body>

test/data/offset/scroll.html

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
<script src="../../jquery.js"></script>
1818
<script src="../iframeTest.js"></script>
1919
<script type="text/javascript" charset="utf-8">
20-
jQuery(function($) {
21-
window.scrollTo(1000,1000);
22-
$("#scroll-1")[0].scrollLeft = 5;
23-
$("#scroll-1")[0].scrollTop = 5;
24-
$(".scroll").click(function() {
25-
$("#marker").css( $(this).offset() );
20+
jQuery( function( $ ) {
21+
window.scrollTo( 1000, 1000 );
22+
$( "#scroll-1" )[ 0 ].scrollLeft = 5;
23+
$( "#scroll-1" )[ 0 ].scrollTop = 5;
24+
$( ".scroll" ).on( "click", function() {
25+
$( "#marker" ).css( $( this ).offset() );
2626
return false;
27-
});
27+
} );
2828
startIframeTest();
29-
});
29+
} );
3030
</script>
3131
</head>
3232
<body>

test/data/offset/static.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
<script src="../../jquery.js"></script>
1414
<script src="../iframeTest.js"></script>
1515
<script type="text/javascript" charset="utf-8">
16-
jQuery(function($) {
17-
$(".static").click(function() {
18-
$("#marker").css( $(this).offset() );
19-
var pos = $(this).position();
20-
$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
16+
jQuery( function( $ ) {
17+
$( ".static" ).on( "click", function() {
18+
$( "#marker" ).css( $( this ).offset() );
19+
var pos = $( this ).position();
20+
$( this ).css( { position: 'absolute', top: pos.top, left: pos.left } );
2121
return false;
22-
});
22+
} );
2323
startIframeTest();
24-
});
24+
} );
2525
</script>
2626
</head>
2727
<body>

test/data/offset/table.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
<script src="../../jquery.js"></script>
1414
<script src="../iframeTest.js"></script>
1515
<script type="text/javascript" charset="utf-8">
16-
jQuery(function($) {
17-
$("table, th, td").click(function() {
18-
$("#marker").css( $(this).offset() );
16+
jQuery( function( $ ) {
17+
$( "table, th, td" ).on( "click", function() {
18+
$( "#marker" ).css( $( this ).offset() );
1919
return false;
20-
});
20+
} );
2121
startIframeTest();
22-
});
22+
} );
2323
</script>
2424
</head>
2525
<body>

0 commit comments

Comments
 (0)