Commit Graph

9 Commits

Author SHA1 Message Date
Michał Gołębiowski-Owczarek
bbad821c39
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
2019-10-09 00:17:55 +02: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
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
781647b182 Build: Drop cross-spawn, use child_process.spawn shell option 2017-09-25 19:27:50 +02:00
Michał Gołębiowski
dbb2daa8c3 Build: Don't install jsdom 3 on Node.js 0.10 & 0.12 by default
jsdom 3 requires Python & Visual Studio on Windows which is a significant
barrier to contributors. Newer jsdom versions don't require pre-compiling
but work only on io.js. This commit installs the new jsdom everywhere (it
does install in old Node.js, it just won't work) and executes Node-related
tests only on newer Nodes or if a working jsdom version is installed. The
latter can be achieved by running the `old_jsdom` task.

Node.js is merging with io.js soon so this will become a smaller problem over
time.

One drawback is our Jenkins setup runs on Node 0.10 so it won't be running
Node tests anymore. We have Travis set up on io.js, though so all PRs
have those tests run. When the new LTS Node.js arrives (as it soon merges
with io.js) we should update our Jenkins infrastructure so that it runs on this
new version.

Fixes gh-2519
Closes gh-2526
2015-09-08 17:42:38 +02:00
Michał Gołębiowski
bb026fc12c Core: Make jQuery objects iterable
Make iterating over jQuery objects possible using ES 2015 for-of:

    for ( node of $( "<div id=narwhal>" ) ) {
        console.log( node.id ); // "narwhal"
    }

Fixes gh-1693
2015-06-13 23:14:36 +02:00
Michał Gołębiowski
9c8a3ecdc4 Build: Refactor Node smoke tests
Utilize the assert module, avoid inline JSHint comments.
2015-06-13 23:08:19 +02:00
Timmy Willison
5c3101fee6 Build: use different versions of jsdom for Node and iojs testing
Fixes gh-2266
2015-05-07 09:57:59 -07:00
Michał Gołębiowski
ab40725879 Core: Test all factory use cases from intro.js
There is a lot of logic in intro.js; now we test four cases:
1. (implicitly, via QUnit tests) A real browser with window being the global
2. Browserify where there are both global & window variables.
3. Node with jsdom where window is passed manually to the jQuery factory.
4. Pure Node with incorrect window passed; jQuery should throw then.

Previously the second & fourth case was not tested and the third was tested
in a way that interfered with the main test environment.

We now also test if in the Browserify case we're not creating a jQuery global
by default.

Fixes gh-2181
Closes gh-2234
2015-04-27 22:44:47 +02:00