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 (#4553) slim build: `custom:-ajax,-callbacks,-deferred,-effects` It also adds separate Travis jobs for the no-deprecated & slim builds. Closes gh-4577
1 parent 1dad118 commit 0f780ba

26 files changed

+174
-84
lines changed

‎.gitignore

Lines changed: 1 addition & 0 deletions
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

Lines changed: 14 additions & 0 deletions
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

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"
@@ -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

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

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)