Commit Graph

379 Commits

Author SHA1 Message Date
Timmy Willison
ef434cd8d3
Tests: migrate testing infrastructure to minimal dependencies
This is a complete rework of our testing infrastructure. The main goal is to modernize and drop deprecated or undermaintained dependencies (specifically, grunt, karma, and testswarm). We've achieved that by limiting our dependency list to ones that are unlikely to drop support any time soon. The new dependency list includes:

- `qunit` (our trusty unit testing library)
- `selenium-webdriver` (for spinning up local browsers)
- `express` (for starting a test server and adding middleware)
  - express middleware includes uses of `body-parser` and `raw-body`
- `yargs` (for constructing a CLI with pretty help text)
- BrowserStack (for running each of our QUnit modules separately in all of our supported browsers)
  - `browserstack-local` (for opening a local tunnel. This is the same package still currently used in the new Browserstack SDK)
  - We are not using any other BrowserStack library. The newest BrowserStack SDK does not fit our needs (and isn't open source). Existing libraries, such as `node-browserstack` or `browserstack-runner`, either do not quite fit our needs, are under-maintained and out-of-date, or are not robust enough to meet all of our requirements. We instead call the [BrowserStack REST API](https://github.com/browserstack/api) directly.

**BrowserStack**
- automatically retries individual modules in case of test failure(s)
- automatically attempts to re-establish broken tunnels
- automatically refreshes the page in case a test run has stalled
- Browser workers are reused when running isolated modules in the same browser
- runs all browsers concurrently and uses as many sessions as are available under the BrowserStack plan. It will wait for available sessions if there are none.
- supports filtering the available list of browsers by browser name, browser version, device, OS, and OS version (see `npm run test:unit -- --list-browsers` for more info). It will retrieve the latest matching browser available if any of those parameters are not specified. Supports latest and latest-\d+ in place of browser version.
- cleans up after itself (closes the local tunnel, stops the test server, etc.)
- Requires `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` environment variables.

**Selenium**
- supports running any local browser as long as the driver is installed, including support for headless mode in Chrome, FF, and Edge
- supports running `basic` tests on the latest [jsdom](https://github.com/jsdom/jsdom#readme), which can be seen in action in this PR (see `test:browserless`)
- Node tests will run as before in PRs and all non-dependabot branches, but now includes tests on real Safari in a GH actions macos image instead of playwright-webkit.
- can run multiple browsers and multiple modules concurrently

Other notes:
- Stale dependencies have been removed and all remaining dependencies have been upgraded with a few exceptions:
  - `sinon`: stopped supporting IE in version 10. But, `sinon` has been updated to 9.x.
  - `husky`: latest does not support Node 10 and runs on `npm install`. Needed for now until git builds are migrated to GitHub Actions.
  - `rollup`: latest does not support Node 10. Needed for now until git builds are migrated to GitHub Actions.
- BrowserStack tests are set to run on each `main` branch commit
- `debug` mode leaves Selenium browsers open whether they pass or fail and leaves browsers with test failures open on BrowserStack. The latter is to avoid leaving open too many sessions.
- This PR includes a workflow to dispatch BrowserStack runs on-demand
- The Node version used for most workflow tests has been upgraded to 20.x
- updated supportjQuery to 3.7.1

Run `npm run test:unit -- --help` for CLI documentation

Close gh-5427
2024-03-05 13:53:39 -05:00
Timmy Willison
ba6ba5a4c1
Release: use buildDefaultFiles directly and pass version (#5409)
- also add the ability to pass VERSION in env to test final builds
- adjust sha regex to account for lack of shas
- set the version on the dist package.json

Close gh-5408
2024-02-06 10:16:05 -05:00
Timmy Willison
0360ec8e62
Release: remove scripts and dev deps from dist package.json
- this became necessary due to the addition of the prepare script
- scripts aren't needed and don't work in the dist repo

Close gh-5405
2024-02-05 10:38:19 -05:00
Timmy Willison
0dd6490b79
Release: update build command in Release.generateArtifacts
Close gh-5400
2024-01-31 09:18:57 -05:00
Timmy Willison
23a3171dab
Build: migrate grunt authors to a custom script
- the new script pulls all authors from the Sizzle repo
- added temporary grunt task for releases

Close gh-5396
2024-01-22 22:12:33 -05:00
Michał Gołębiowski-Owczarek
e84886aa37
Build: Update ESLint-related packages, fix linting errors (3.x version)
The main change is the new rule in `eslint-config-jquery`:
`template-curly-spacing`.

Closes gh-5348
Ref jquery/eslint-config-jquery#21
Ref gh-5347
2023-11-02 00:48:05 +01:00
Timmy Willison
ce52a5dbb0
Build: sort branches in compare_size; last run last
Close gh-5334
2023-09-21 17:47:18 -04:00
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
Timmy Willison
399b201bb3
Release: revert change that broke release
763ade6dda (diff-ba51b2c9ce2527b1f191cb2c210748a4f18cccc38893f7ffe1597fb1d23ce027L72)

The above change did not work because makeArchives was
not made to return a Promise
2023-08-28 09:31:17 -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
Timmy Willison
3b7bf19998
Release: add support for md5 sums in windows
Close gh-5220
2023-03-09 20:19:28 +00:00
Timmy Willison
37b04d5aba
Build: remove stale Insight package from custom builds
Close gh-5181
2022-12-20 20:53:36 +00: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
76edd26ebb Docs: Update the README of the published package
The previous details were showing their age, e.g. mentions about browsers
not supporting ES2015. The story with ES modules is more complex as it's also
about loaders but to keep the README simple, let's just make it more up to date
with typical usage.

Closes gh-5108

(cherry picked from commit edccabf10d)
2022-10-03 22:56:17 +02:00
Simon Legner
410d5cf0c3 Docs: Update webpack website in README
Webpack has migrated to https://webpack.js.org/ since version 2.

Closes gh-5037

(cherry picked from commit 01819bc3bc)
2022-07-12 17:17:18 +02:00
Michał Gołębiowski-Owczarek
bc16512879
Tests: Exclude tests based on compilation flags, not API presence (3.x version)
Introduces a new test API, `includesModule`. The method returns whether
a particular module like "ajax" or "deprecated" is included in the current
jQuery build; it handles the slim build as well. The util was created so that
we don't treat presence of particular APIs to decide whether to run a test as
then if we accidentally remove an API, the tests would still not fail.

Closes gh-5071
Fixes gh-5069
Ref gh-5046

(partially cherry picked from commit fae5fee8b4)
2022-07-12 17:12:27 +02:00
Timmy Willison
aed59da0c9
Release: remove the need to install grunt globally 2021-03-01 17:48:55 -05:00
Timmy Willison
8b50fbe75d
Release: drop the need for npm as a local dependency
- Not meant to be used like that anymore
2021-03-01 17:41:18 -05:00
Timmy Willison
a21a4b2de7
Release: upgrade release dependencies 2021-03-01 16:48:41 -05:00
Michał Gołębiowski-Owczarek
627c573ac6 Build: Rename master to main across the repository
The default branch was updated, this updates the remaining occurrences in code
& comments.

Closes gh-4838

(cherry picked from commit 8ae477a432)
2021-02-05 23:21:21 +01:00
Michał Gołębiowski-Owczarek
25407dcaf5 Build: Update eslint-config-jquery, fix linting violations
Closes gh-4696
Ref jquery/eslint-config-jquery#15
Ref jquery/eslint-config-jquery#16

(cherry picked from commit ef4d6ca6c3)
2020-05-18 22:40:42 +02:00
Pierre Grimaud
ea3766c081 Docs: Fix typos
Closes gh-4686

(cherry picked from commit 1a7332ce83)
2020-04-29 21:18:55 +02:00
Michał Gołębiowski-Owczarek
f7fed7eec2 Docs: Update the link to the jsdom repository
Closes gh-4684

(cherry picked from commit a62309e01b)
2020-04-25 20:48:34 +02:00
Jonathan
763dd3fefa Docs: Use https for hyperlinks in README
Closes gh-4673

(cherry picked from commit 73415da25d)
2020-04-17 11:48:38 +02:00
Michał Gołębiowski-Owczarek
524bcf39da Release: Use an in-repository dist README fixture
Use a dist README fixture kept in the jQuery repository instead of modifying
an existing one. This makes the jQuery repository the single source of truth
when it comes to jQuery releases and it makes it easier to make changes to
README without worrying how it will affect older jQuery lines.

The commit also ES6ifies build/release.js & build/release/dist.js

Closes gh-4614

(cherry picked from commit 358b769a00)
2020-03-02 22:48:29 +01: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
4cbdc745cc Build: Create a grunt custom:slim alias for the Slim build
Closes gh-4578

(cherry-picked from 9b9ed469b4)
2020-01-07 16:45:22 +01: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
Michał Gołębiowski-Owczarek
c7a5e1bd79 Build: Support jquery-release --dry-run flag
Without this change passing `--dry-run` to jquery-release still pushes to the
jquery-dist repository which is dangerous as one can assume `--dry-run` to be
safe from external side effects.

Close gh-4498

(cherry picked from commit d7d0b52bda)
2019-10-05 18:50:18 +02:00
Michał Gołębiowski-Owczarek
279d2e979e Build: Stop copying src/core.js to dist on release
File `src/core.js` has started erroneously being copied to `dist/` in gh-2981.

Fixes gh-4489
Closes gh-4492
Ref gh-2979
Ref gh-2981

(cherry picked from commit 9a4d980639)
2019-10-04 16:13:58 +02:00
Michał Gołębiowski-Owczarek
d7e13f128a Build: ESLint: forbid unused function parameters
This commit requires all function parameters to be used, not just the last one.
In cases where that's not possible as we need to match an external API, there's
an escape hatch of prefixing an unused argument with `_`.

This change makes it easier to catch unused AMD dependencies and unused
parameters in internal functions the API of which we may change at will, among
other things.

Unused AMD dependencies have been removed as part of this commit.

Closes gh-4381

(cherry-picked from 438b1a3e8a)
2019-09-26 01:59:57 +02:00
Michał Gołębiowski-Owczarek
36b59c9661 Build: Fix the regex parsing AMD var-modules (#4389)
The previous regex caused the final jQuery binary to have syntax errors for
var-modules with names starting with "return". For example, the following module
wouldn't work when the file is named `returnTrue.js`:

```js
define( function() {
	"use strict";
	return function returnTrue() {
		return true;
	};
} );
```

Closes gh-4389

(cherry picked from commit 9ec09c3b4a)
2019-09-26 01:18:22 +02:00
Michał Gołębiowski-Owczarek
84b6a0beb1
Build: Remove manual QUnit fixture resetting
It was needed when QUnit 1.x one used but we've since upgraded to QUnit 2.x.

Closes gh-4312
Ref gh-4307
2019-03-11 17:25:48 +01:00
Michał Gołębiowski-Owczarek
ca9356ecce
Build: Make Promises/A+ tests use the dot reporter instead of the default
The default reporter is very verbose as it prints all the test names it
encounters. We already use the dot reporter for Karma tests.

Closes gh-4313
2019-03-11 16:06:17 +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
Dave Methvin
6c38ebbd47 Build: Remove CRLF line endings to fix builds on Windows
Close gh-3929
2018-01-09 10:50:09 -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
Michał Gołębiowski-Owczarek
56e891dea1 Tests: Make Node tests work for paths with spaces in them
Without this patch Jenkins tests fail as jQuery job names there contain spaces,
e.g. "jQuery Core".

Closes gh-3821
2017-10-18 17:44:50 +02:00
Michał Gołębiowski-Owczarek
81be78e380 Build: increase timeout in Promises/A+ tests 10 times
The promises-aplus-tests sets up a default 200 ms Mocha timeout. This makes
our tests randomly fail on Jenkins. 2 seconds will be safer.

Closes gh-3791
2017-09-25 19:27:50 +02:00
Michał Gołębiowski-Owczarek
781647b182 Build: Drop cross-spawn, use child_process.spawn shell option 2017-09-25 19:27:50 +02:00
Timmy Willison
f8faf1489e
Release: edit dist README version on release
Fixes gh-3574
2017-03-17 12:38:23 -04:00
Timmy Willison
0f52adc81f
Release: md5sum -> md5 -r for MAC 2017-03-16 14:59:57 -04:00
Timmy Willison
47caeaecd9
Release: update release dependencies 2017-03-15 14:57:20 -04:00
Timmy Willison
0588d0ce35
Build: Keep deprecated module in slim
Fixes gh-3237
Close gh-3533
2017-02-13 10:53:04 -05:00
Michał Gołębiowski
4e50967725 Build: Make the @CODE-replacing regex more robust
The code replacing @CODE in wrapper.js was written so that it expected
both the code and the next line to start in the first column. This commit
adjusts the regex so to get rid of that assumption and to work properly
regardless of number of lines with comments after this block.

While this is technically not necessary for our code, contributors sometimes
re-format the wrapper file in their pull requests and the error
messages they get don't tell them what's the real problem with their code.

Closes gh-3429
2016-12-05 18:43:10 +01:00
Timmy Willison
51c29dc1fe
Release: fix quotes for releasing on Windows 2016-09-22 18:18:25 -04:00
Dave Methvin
37f1da6b91 Build: Make sourcemap updates in two .replace() passes
Fixes gh-3260
Closes gh-3321
2016-09-19 13:03:32 -04:00
Timmy Willison
52e24471c8
Core: expose noConflict in AMD mode
- For compability reasons, we had already added the global
  in AMD mode, but without noConflict. This adds back noConflict
  to AMD (which fixes noConflict mode in the tests).

Fixes gh-2930
2016-08-15 11:54:55 -04:00
Michał Gołębiowski
6e605afb1f Build: Fix the regex removing the ESLint comment from wrapper.js
The new regex from after the switch from JSHint to ESLint wasn't catching
the ESLint pragma correctly.

Also, the spacing of the pragma comment was updated to match other comments.
2016-07-13 10:49:13 +02: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