jquery/test/node_smoke_tests/lib/ensure_global_not_created.js
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

16 lines
490 B
JavaScript

"use strict";
const assert = require( "assert" );
// Ensure the jQuery property on global/window/module.exports/etc. was not
// created in a CommonJS environment.
// `global` is always checked in addition to passed parameters.
const ensureGlobalNotCreated = ( ...args ) => {
[ ...args, global ].forEach( function( object ) {
assert.strictEqual( object.jQuery, undefined,
"A jQuery global was created in a CommonJS environment." );
} );
};
module.exports = ensureGlobalNotCreated;