Commit Graph

151 Commits

Author SHA1 Message Date
Timmy Willison
ec8802bafe
Build: migrate most grunt tasks off of grunt (3.x)
Close gh-5330

- lint
- npmcopy
- build, minify, and process for distribution.
- new custom build command using yargs
- compare size of minified/gzip built files
- pretest scripts, including qunit-fixture, babel transpilation, and npmcopy
- node smoke tests
- promises aplus tests
- new watch task using nodemon, which runs `npm run build:all` on `src` changes.

Also:

- upgraded husky and added the new lint command
- updated lint config to use new "flat" config format.
	See https://eslint.org/docs/latest/use/configure/configuration-files-new
- Temporarily disabled one lint rule until flat config is
	supported by eslint-plugin-import.
	See https://github.com/import-js/eslint-plugin-import/issues/2556
- committed package-lock.json
- updated all test scripts to use the new build
- added an express test server that uses middleware-mockserver
	this can be used to run tests without karma
- build-all-variants is now build:all
- run pretest script in jenkins

---------

Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
2023-09-20 18:18:42 -04:00
Michał Gołębiowski-Owczarek
763ade6dda
Build: Generate the slim build on grunt & run compare_size on it
Summary of the changes:
* expand `node_smoke_tests` to test the full & slim builds
* run `compare_size` on all built minified files; don't run it anymore on
  unminified files where they don't provide lots of value

The main goal of this change is to make it easier to compare sizes of both the
full & slim builds between the `3.x-stable` & `main` branches.

Closes gh-5291
Ref gh-5255

(partially cherry-picked from commit 8be4c0e4f8)
2023-07-10 20:45:30 +02:00
Michał Gołębiowski-Owczarek
a288838c6f
CSS: Make the reliableTrDimensions support test work with Bootstrap CSS (3.x version)
Bootstrap 5 includes the following CSS on the page:

```css
*,
*::before,
*::after {
  box-sizing: border-box;
}
```

That threw our `reliableTrDimensions` support test off. This change fixes the
support test and adds a unit test ensuring support test values on a page
including Bootstrap 5 CSS are the same as on a page without it.

Fixes gh-5270
Closes gh-5279
Ref gh-5278
2023-07-10 18:26:45 +02:00
Michał Gołębiowski-Owczarek
da7057e9b0
Build: Run GitHub Action browser tests on Playwright WebKit
So far, we've been running browser tests on GitHub Actions in Chrome
and Firefox. Regular Safari is not available in GitHub Actions but
Playwright WebKit comes close to a dev version of Safari.

With this change, our GitHub CI & local test runs will invoke tests on
all actively developed browser engines on all PRs.

Also, our GitHub Actions browser tests are now running on Node.js 18.

Detection of the Playwright WebKit browser in support unit tests is done
by checking if the `test_browser` query parameter is set to `"Playwright"`;
this is a `karma-webkit-launcher` feature. Detecting that browser via
user agent as we normally do is hard as the UA on Linux is very similar
to a real Safari one but it actually uses a newer version of the engine.

In addition, we now allow to pass custom browsers when one needs it;
e.g., to run the tests in all three engines on Linux/macOS, run:
```
grunt && BROWSERS=ChromeHeadless,FirefoxHeadless,WebkitHeadless grunt karma:main
```

Closes gh-5190

(cherry picked from commit b02a257f98)
2023-01-24 00:12:55 +01:00
Michał Gołębiowski-Owczarek
6306ca4994
Selector: Inline Sizzle into the selector module: 3.x version (#5113)
This commit removes Sizzle from jQuery, inlining its code & removing obsolete
workarounds where applicable.

The Sizzle AUTHORS.txt file has been merged with the jQuery one - people are
sorted by their first contributions to either of the two repositories.

The main `selector` module can be disabled in favor of `selector-native`
via:

    grunt custom:-selector

For backwards compatibility, the legacy `sizzle` alias is also supported (it
will be dropped in jQuery `4.0.0`):

    grunt custom:-selector

Sizzle tests have been ported to jQuery ones. Ones that are not compatible
with the `selector-native` module are disabled if the regular selector module
is excluded.

Backwards compatibility is still kept for all `Sizzle` utils - they continue to be
available under `jQuery.find` - but the primary implementation is now attached
directly to jQuery.

Some selector utils shared by `selector` & `selector-native` have been
extracted & deduplicated. `jQuery.text` and `jQuery.isXMLDoc` have been
moved to the `core` module.

The commit reduces the gzipped jQuery size by 851 bytes compared to the
`3.x-stable` branch.

Closes gh-5113
Ref gh-4395
Ref gh-4406
2022-12-14 01:41:31 +01:00
Michał Gołębiowski-Owczarek
9bc0df70be Build: Test on Node 17, update Grunt & karma-* packages
This adds testing on Node.js 17 in addition to the currently tested 10, 12, 14
and 16 versions.

Also, update Grunt & `karma-*` packages.

Testing in Karma on jsdom is broken in Node 17 at the moment; until we find
a fix, this change disables such testing on Node 17 or newer.

Node smoke tests & promises aplus tests are disabled on Node.js 10 as they
depend on jsdom and the latest jsdom version doesn't run properly on Node 10.

Closes gh-5023

(cherry picked from commit 2525cffc42)
2022-03-14 18:31:49 +01:00
Timmy Willison
5566988359
Build: remove travis.yml and travis mentions from core (#4984)
We've migrate jquery core to GH actions and have already disabled core builds on travis
2021-12-13 12:22:34 -05:00
ygj6
b39cfa1505 Build: Migrate CI to GitHub Actions
Closes gh-4800

(cherry picked from commit e23190e63c)
2021-12-01 00:03:59 +01:00
Michał Gołębiowski-Owczarek
a51eec7484 Tests: Make Karma browser timeout larger than the QUnit one
Since the default Karma browser no activity timeout was lower than the QUnit
timeout, a single timing out test was interrupting the whole test run of
a browser.

The QUnit timeout is set to 1 minute so I set the Karma one to 2 minutes.

Closes gh-4943

(cherry picked from commit 4fd6912bfd)
2021-10-30 00:57:20 +02:00
Michał Gołębiowski-Owczarek
752b8981f8 Build: Take core-js from the external directory as well
All the other files were already taken from the external directory.
The fact core-js was taken from node_modules broke IE core tests on TestSwarm.

Ref gh-4865
Ref gh-4870

(partially cherry picked from 345cd22e56)
2021-04-14 01:47:38 +02:00
Michał Gołębiowski-Owczarek
db43ef0bff Docs: Change JS Foundation mentions to OpenJS Foundation
Closes gh-4711

(cherry picked from 11611967ad)
2020-05-18 18:46:27 +02:00
Michał Gołębiowski-Owczarek
d525ae3416
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 (#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 gh-4577
Ref gh-4596
Closes gh-4600
2020-01-27 18:54:47 +01:00
Michał Gołębiowski-Owczarek
7a3cf9c03c Ajax: Deprecate AJAX event aliases, inline event/alias into deprecated
A new `src/deprecated` directory makes it possible to exclude some deprecated
APIs from a custom build when their respective "parent" module is excluded
without keeping that module outside of the `src/deprecated` directory or
the `src/deprecated.js` file.

Closes gh-4572

(cherry picked from 23d53928f3)
2020-01-21 14:26:35 +01:00
Michał Gołębiowski-Owczarek
37df5cdf4e Build: Lint the minified jQuery file as well
While we have absolutely no style-related expectations to our minified file,
we do care that it's valid ES 5.1. This is now verified.

Also, update grunt-eslint as a newer ESLint version is required to be able
to use "extends" inside of the "overrides" section.

Fixes gh-3075
Closes gh-4594
Ref gh-4598
2020-01-21 14:06:42 +01:00
Michał Gołębiowski-Owczarek
46c284b12b
Build: Make Karma work in AMD mode
Also, run such a suite in CI to make sure modules are working as expected
when used directly.

(partially cherry picked from 341c6d1b5a)
(partially cherry picked from 437f389a24)

Closes gh-4595
Ref gh-4550
Ref gh-4574
2020-01-21 13:26:47 +01:00
Michał Gołębiowski-Owczarek
471b004326 Build: Run tests on Travis only on browsers defined in the config
The environmental variable BROWSERS was being created but it wasn't read in the
list of browsers to pass to Karma.

Closes gh-4532

(cherry picked from commit bcbcdd2b2c)
2019-10-22 20:50:26 +02:00
Michał Gołębiowski-Owczarek
9f4204ecad Build: Drop workarounds for Node.js 6 in Gruntfile.js 2019-10-22 20:09:15 +02:00
Michał Gołębiowski-Owczarek
ad3c2efa10 Build: Run tests on Travis on FirefoxHeadless as well
Also, run them on both ChromeHeadless & FirefoxHeadless locally on
`grunt karma:main`.

Plus, so far, the chrome addons were installed for all the jobs, even
the ones that weren't used for browser testing. Changing that makes
those jobs faster.

(cherry-picked from 84835e68239ce55d1fc007b284e8ef4ed2817c2)
2019-10-22 20:07:56 +02:00
Michał Gołębiowski-Owczarek
ac2da4e6b9 Build: Require strict mode in Node.js scripts via ESLint
So far, only browser-based JS files were required to be in strict mode (in the
function form). This commit adds such a requirement to Node.js scripts where
the global form is preferred. All Node.js scripts in sloppy mode were
converted to strict mode.

Closes gh-4499

(cherry picked from commit bbad821c39)
2019-10-09 00:24:17 +02:00
Timmy Willison
3654bc831d
Tests: update npo.js and include unminified source instead
Close gh-4446
Ref gh-4445
2019-08-12 12:14:58 -04:00
Michał Gołębiowski-Owczarek
0ec25abba2
Build: Run the basic test suite in jsdom
The basic test suite is now run in jsdom on all supported Node.js versions
(8, 10 & 11 as of now).

Closes gh-4310
2019-03-11 20:03:54 +01:00
Michał Gołębiowski-Owczarek
6ced2639b5
Build: Update QUnit from 1.23.1 to 2.9.2
Closes gh-4307
2019-03-04 20:10:21 +01:00
Michał Gołębiowski-Owczarek
9cb124ed00
Build: Update jsdom; migrate a test with Symbol polyfill to an iframe test
So far, we've been testing that jQuery element iteration works with polyfilled
Symbol & transpiled for-of via a Node test with jsdom with the Symbol global
removed. Unfortunately, jsdom now requires Symbol to be present for its internal
functionality so such a test is no longer possible. Instead, it's been migrated
to an iframe test with transpiled JavaScript.

This PR also enables us to use ECMAScript 2017 or newer in Node.js code.

Closes gh-4305
2019-03-04 18:30:51 +01:00
abnud1
8751e9ef86 Build: Update most dependencies
The only packages not fully updated are:
- qunitjs & karma-qunit as that's a QUnit 2.x update that will require some
changes and we'll do that later
- jsdom as we need to first rewrite the test with the Symbol polyfill - newer
jsdom versions don't work with such a hacked Symbol instance
- sinon as the v2 -> v7 upgrade requires to update our unit tests
- uglify-js & grunt-contrib-uglify as latest uglify-js versions slightly worsen
the minified gzipped size

Closes gh-4227
Closes gh-4228
Closes gh-4230
Closes gh-4232
2019-02-19 13:05:09 +01:00
Timmy Willison
13d0be101f
Tests: add IE launcher for debugging IE11 on Windows 2018-11-27 14:28:57 -05:00
Richard Gibson
dfa92ccead
Tests: Allow Karma to load unminfied source
Closes gh-4128
2018-09-07 10:14:01 -04:00
Luis Emilio Velasco Sanchez
0ba8e38d0c Traversing: $.fn.contents() support for object
Fixes gh-4045
Closes gh-4046
2018-05-14 13:41:42 -04:00
Michał Gołębiowski-Owczarek
b95e0da68e
Build: Don't require sudo on Travis, use sandboxless headless Chrome
The Chrome sandbox doesn't work on Travis unless sudo is enabled. Instead,
we're disabling the Chrome sandbox.

Closes gh-4011
2018-03-19 18:12:23 +01:00
Oleg Gaydarenko
3652842404 Build: remove artefact from previous commit
Follow-up for 09684ba3f2
2018-03-07 11:33:39 +03:00
Oleg Gaydarenko
09684ba3f2 Build: Seasonal update of uglify and its options
raw     gz Compared to last run
 =      = dist/jquery.js
-294    -88 dist/jquery.min.js

Closes gh-3994
2018-03-05 20:53:57 +03:00
Timo Tijhof
7eec97aab3
Build: Add "-debug" suffix to name of karma debug tasks
Ref gh-3922
Close gh-3936
2018-01-17 11:04:38 -05:00
Timmy Willison
428ee4a624
Tests: correctly set sudo in travis config, not karma config 2018-01-16 11:17:33 -05:00
Timmy Willison
46ea7a3f0e
Tests: temporarily require sudo access for karma:main on travis
- This should fix the broken travis build on Node 8
- See https://github.com/travis-ci/travis-ci/issues/8836
2018-01-16 11:11:01 -05:00
Timmy Willison
c9efd11f47
Build: Fix UglifyJS output in Android 4.0; update uglify
- Thanks to @mgol for first pass

Fixes gh-3743
Close gh-3920
2018-01-08 11:48:24 -05:00
Timo Tijhof
ecd8ddea33
Tests: Add support for running unit tests via grunt with karma
- Update QUnit to 1.23.1
- Remove unused dl#dl from test/index.html
- Remove unused map#imgmap from test/index.html
- Ensure all urls to data use baseURI
- Add the 'grunt karma:main' task
  - customContextFile & customDebugFile
- Add 'npm run jenkins' script

Close gh-3744
Fixes gh-1999
2017-12-18 12:27:38 -05:00
Henry Zhu
90bac40a51 Build: Update to Babel 7, use for-of plugin instead of preset-es2015
Closes gh-3786
2017-09-25 19:02:19 +02:00
Timmy Willison
0bf499ca24
Build: fix uglify options for uglify update
- Uses new typeofs option for compression
- See https://github.com/mishoo/UglifyJS2/issues/2198

Close gh-3710
2017-07-10 11:52:44 -04:00
Michał Gołębiowski
d10ac0e532 Build: Drop support for building on Node.js 0.12
Node.js 0.12 is no longer supported by upstream. So far we had to keep
a workaround that would skip running ESLint there (or even load its task)
as it no longer supports Node.js <4; the same applied to Node smoke tests
as jsdom has also dropped support for those old Node versions. Those
workarounds have been removed now.

Ref 030191ae32
Closes gh-3478
2016-12-30 13:54:59 +01:00
Michał Gołębiowski
cbc8638c38 Build: ESLint setup improvements
1. Use the short name of the preset in the config.
2. Run ESLint first on non-minified files.
3. Explicitly specify environments in every config file (those settings cascade
which means we've been assuming a Node.js environment where we shouldn't have).
2016-12-19 02:07:03 +01:00
Timmy Willison
7fbab88110
Build: jQuery Foundation -> JS Foundation
Close gh-3414
2016-12-05 11:54:38 -05:00
Michał Gołębiowski
5b4cb0d337 Build: Stop testing on Node.js 0.10
Node.js 0.10 loses upstream support today (see https://github.com/nodejs/LTS/)
so let's stop testing against it as well.
2016-10-31 18:38:35 +01:00
Oleg Gaidarenko
308e4b534b Build: Simplify Gruntfile constructions
Fixes gh-3246
2016-08-02 20:58:01 +03:00
Michał Gołębiowski
edf7a43681 Build: Don't lint every file in dist/ (#3245)
Currently the "all" target for the eslint task includes way more than
the "dev" & "dist" targets combined and those 2 tasks are the one run in
`npm test`.
2016-07-26 03:22:53 +04:00
Michał Gołębiowski
030191ae32 Build: Skip running ESLint on Node.js 0.x
ESLint 3.0 drops support for Node.js older than 4.x. To be able to update
to this version and yet not block our contributors from building jQuery
on older Node.js (at least until it's supported by upstream) this commit
makes ESLint skipped on older Node; a proper message is displayed then.

Fixes gh-3222
2016-07-13 10:54:34 +02:00
Oleg Gaidarenko
25d8ccd111 Build: Improve ESLint configuration (#3188)
* Bump eslint-config-jquery package to 0.1.4 version

* Add subtask "dist" to "eslint" task and add it to the build task list

* Make gitignore globs more flexible for the "dist" folder

Fixes gh-3169
2016-06-22 19:41:57 +04:00
Oleg Gaidarenko
58c6ca9822 Build: ESLint details
Use eslint pragmas, fix new errors, etc

Closes gh-3148
2016-06-11 10:41:33 +03:00
Oleg Gaidarenko
f80ae67c53 Build: Switch from jscs+jshint to eslint 2016-06-11 10:39:51 +03:00
Michał Gołębiowski
d3a781d762 Build: Don't lint the built file in the husky precommit hook
The husky Git precommit hook was linting not only the source but also the
built file. Normally it's expected, we want to run basic checks on what's
built but in the precommit hook we're not building the file so we might
be linting some previous, broken version.

Fixes gh-3091
2016-04-29 10:36:57 +02:00
Richard Gibson
cf1497a58c Build: A more modest block-level function proposal
This reverts commit fa610da684.
2016-04-23 22:14:25 -04:00
Michał Gołębiowski
fa610da684 Build: Workaround strict mode violations caused by UglifyJS
This commit increases the gzipped size by 90 bytes so a better solution
is needed but, at the same time, it disables the very optimizations
that are causing strict mode violations in Firefox 45, Safari 9 & IE 10.

Refs 76084372c2
Refs mishoo/UglifyJS2#1052
2016-04-23 20:30:00 +02:00