diff --git a/.eslintrc.json b/.eslintrc.json index d100c37bb..9423106dc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -36,8 +36,8 @@ "__codeorigin/**", "coverage/**", "docs/_site/**", - "dist/**", "lib/**", + "qunit/**", "temp/**" ], "overrides": [ diff --git a/.gitignore b/.gitignore index 7d02cb3df..053cb5d1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ /.nyc_output /__codeorigin /coverage -/dist /node_modules -/browserstack-run.pid +/qunit /temp /docs/_site/ diff --git a/Gruntfile.js b/Gruntfile.js index 52c9c37d9..cc2d46aa1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -46,7 +46,7 @@ module.exports = function( grunt ) { "src-css": { src: "src/qunit.css", - dest: "dist/qunit.css" + dest: "qunit/qunit.css" } }, eslint: { diff --git a/RELEASE.md b/RELEASE.md index f2b96af01..307b82856 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -89,11 +89,6 @@ This guide walks you through the QUnit release. npm run build ``` - * Rename `dist/` to `qunit/`: - ``` - mv dist/ qunit/ - ``` - * Review the changes to the package and library files, compared to the previous release. ``` node build/review-package.js @LAST_VERSION diff --git a/build/tasks/test-on-node.js b/build/tasks/test-on-node.js index e6dbc2cff..9f3fe3a9b 100644 --- a/build/tasks/test-on-node.js +++ b/build/tasks/test-on-node.js @@ -18,7 +18,7 @@ module.exports = function( grunt ) { } // Refresh the QUnit global to be used in other tests - global.QUnit = requireFresh( "../../dist/qunit" ); + global.QUnit = requireFresh( "../../qunit/qunit.js" ); done( !totals.failed ); } ); @@ -33,7 +33,7 @@ module.exports = function( grunt ) { // Resolve current QUnit path and remove it from the require cache // to avoid stacking the QUnit logs. - var QUnit = requireFresh( "../../dist/qunit" ); + var QUnit = requireFresh( "../../qunit/qunit.js" ); // Expose QUnit to the global scope to be seen on the other tests. global.QUnit = QUnit; diff --git a/package.json b/package.json index 49ee9a545..1b01d9613 100644 --- a/package.json +++ b/package.json @@ -91,13 +91,13 @@ "authors": "grunt authors", "coverage": "npm run build:coverage && npm run coverage:_cli && npm run coverage:_main && nyc report", "coverage:_cli": "nyc --use-spawn-wrap --silent bin/qunit.js test/cli/*.js", - "coverage:_main": "nyc instrument --in-place dist/ && grunt connect:nolivereload qunit", + "coverage:_main": "nyc instrument --in-place qunit/ && grunt connect:nolivereload qunit", "coveralls": "npm run coverage && cat coverage/lcov.info | coveralls" }, "nyc": { "include": [ "bin/**", - "dist/**", + "qunit/**", "src/**" ], "reporter": [ diff --git a/rollup.config.js b/rollup.config.js index baaef96f3..1d0f7a364 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -12,7 +12,7 @@ const isCoverage = process.env.BUILD_TARGET === "coverage"; module.exports = { input: "src/qunit.js", output: { - file: "dist/qunit.js", + file: "qunit/qunit.js", sourcemap: isCoverage, format: "iife", exports: "none", diff --git a/src/cli/require-qunit.js b/src/cli/require-qunit.js index a6bbdf342..e73b43c6e 100644 --- a/src/cli/require-qunit.js +++ b/src/cli/require-qunit.js @@ -3,7 +3,19 @@ module.exports = function requireQUnit( resolve = require.resolve ) { try { - // First we attempt to find QUnit relative to the current working directory. + // For: + // + // - QUnit is installed as local dependency and invoked normally + // within the current project, e.g. via `npm test`, `npm run …`, + // or `node_modules/.bin/qunit`. + // The below will lead to the same package directory that + // the CLI command belonged to. + // + // - QUnit is installed both as local dependency in the current project, + // and also globally installed via npm by the end-user. + // If the user (accidentally) ran the CLI command from their global + // install, then we prefer to stil use the qunit library file from the + // current project's dependency. // eslint-disable-next-line node/no-missing-require const localQUnitPath = resolve( "qunit", { @@ -14,24 +26,25 @@ module.exports = function requireQUnit( resolve = require.resolve ) { delete require.cache[ localQUnitPath ]; return require( localQUnitPath ); } catch ( e ) { - try { + if ( e.code === "MODULE_NOT_FOUND" ) { - // Second, we use the globally installed QUnit - // eslint-disable-next-line node/no-unpublished-require, node/no-missing-require + // For: + // + // - QUnit is installed globally via npm by the end-user, and the + // the user ran this global CLI command in a project directory that + // does not have a qunit dependency installed. + // Use the library file relative to the global CLI command in that case. + // + // - We are running a local command from within the source directory + // of the QUnit project itself (e.g. qunit Git repository). + // Use the library file relative to this command, within the source directory. + // + // eslint-disable-next-line node/no-missing-require, node/no-unpublished-require delete require.cache[ resolve( "../../qunit/qunit" ) ]; // eslint-disable-next-line node/no-missing-require, node/no-unpublished-require return require( "../../qunit/qunit" ); - } catch ( e ) { - if ( e.code === "MODULE_NOT_FOUND" ) { - - // Finally, we use the local development version of QUnit - // eslint-disable-next-line node/no-unpublished-require, node/no-missing-require - delete require.cache[ resolve( "../../dist/qunit" ) ]; - // eslint-disable-next-line node/no-missing-require, node/no-unpublished-require - return require( "../../dist/qunit" ); - } - - throw e; } + + throw e; } }; diff --git a/test/amd.html b/test/amd.html index 9240a09aa..7154fff15 100644 --- a/test/amd.html +++ b/test/amd.html @@ -3,7 +3,7 @@ QUnit AMD Test Suite - + @@ -13,7 +13,7 @@ require.config( { paths: { - qunit: "../dist/qunit" + qunit: "../qunit/qunit" } } ); diff --git a/test/autostart.html b/test/autostart.html index b8873e8bf..ff19ddfb9 100644 --- a/test/autostart.html +++ b/test/autostart.html @@ -3,11 +3,11 @@ QUnit Autostart Test Suite - +
- + + + diff --git a/test/callbacks.html b/test/callbacks.html index 401ff03fb..187df4f4b 100644 --- a/test/callbacks.html +++ b/test/callbacks.html @@ -3,8 +3,8 @@ QUnit Callbacks Test Suite - - + + diff --git a/test/cli/require-qunit-test.js b/test/cli/require-qunit-test.js index eff2d08b0..276579caa 100644 --- a/test/cli/require-qunit-test.js +++ b/test/cli/require-qunit-test.js @@ -14,43 +14,30 @@ QUnit.module( "requireQUnit", function( hooks ) { process.chdir( cwd ); } ); - QUnit.test( "finds QUnit in the current working directory", function( assert ) { + QUnit.test( "finds QUnit package in the current working directory", function( assert ) { const requireQUnit = require( "../../src/cli/require-qunit" ); process.chdir( path.join( __dirname, "./fixtures/require-from-cwd" ) ); assert.propEqual( requireQUnit(), { version: "from-cwd" } ); } ); - QUnit.test( "finds globally installed QUnit", function( assert ) { + // For development mode invoked locally, + // or for global install without local dependency installed. + QUnit.test( "finds relative self", function( assert ) { const globalQUnit = { "version": "from-global" }; const requireQUnit = proxyquire( "../../src/cli/require-qunit", { "qunit": null, - "../../dist/qunit": null, "../../qunit/qunit": globalQUnit } ); assert.strictEqual( requireQUnit( resolveStub ), globalQUnit ); } ); - QUnit.test( "finds development mode QUnit", function( assert ) { - const devQUnit = { - "version": "from-dist" - }; - const requireQUnit = proxyquire( "../../src/cli/require-qunit", { - "qunit": null, - "../../qunit/qunit": null, - "../../dist/qunit": devQUnit - } ); - - assert.strictEqual( requireQUnit( resolveStub ), devQUnit ); - } ); - QUnit.test( "throws error if none of the modules are found", function( assert ) { const requireQUnit = proxyquire( "../../src/cli/require-qunit", { "qunit": null, - "../../qunit/qunit": null, - "../../dist/qunit": null + "../../qunit/qunit": null } ); assert.throws( requireQUnit, /Cannot find module/ ); diff --git a/test/events-filters.html b/test/events-filters.html index 45b9a7469..9749078b3 100644 --- a/test/events-filters.html +++ b/test/events-filters.html @@ -3,8 +3,8 @@ Events Filters - - + + diff --git a/test/events-in-test.html b/test/events-in-test.html index f3dc2b71a..07c08bb66 100644 --- a/test/events-in-test.html +++ b/test/events-in-test.html @@ -3,8 +3,8 @@ QUnit Events During Tests - - + + diff --git a/test/events.html b/test/events.html index 45affc874..479820d0f 100644 --- a/test/events.html +++ b/test/events.html @@ -3,8 +3,8 @@ QUnit Events Test Suite - - + + diff --git a/test/headless.html b/test/headless.html index fe2105f88..f44ad10c0 100644 --- a/test/headless.html +++ b/test/headless.html @@ -3,8 +3,8 @@ QUnit Headless Test Suite - - + + + + diff --git a/test/logs.html b/test/logs.html index 766824c19..99fc378a4 100644 --- a/test/logs.html +++ b/test/logs.html @@ -3,8 +3,8 @@ QUnit Logs Test Suite - - + + diff --git a/test/main/stack.js b/test/main/stack.js index dac20a2a3..21767841d 100644 --- a/test/main/stack.js +++ b/test/main/stack.js @@ -8,7 +8,7 @@ assert.true( /(\/|\\)test(\/|\\)main(\/|\\)stack\.js/.test( stack ) ); stack = QUnit.stack( 2 ); - assert.true( /(\/|\\)dist(\/|\\)qunit\.js/.test( stack ), "can use offset argument to return a different stacktrace line" ); + assert.true( /(\/|\\)qunit(\/|\\)qunit\.js/.test( stack ), "can use offset argument to return a different stacktrace line" ); assert.false( /\/test\/main\/stack\.js/.test( stack ), "stack with offset argument" ); } ); }() ); diff --git a/test/module-filter.html b/test/module-filter.html index a093f06af..d975a4524 100644 --- a/test/module-filter.html +++ b/test/module-filter.html @@ -3,8 +3,8 @@ QUnit Module Filter Test Suite - - + + diff --git a/test/module-skip.html b/test/module-skip.html index 4ff80205c..0573a3302 100644 --- a/test/module-skip.html +++ b/test/module-skip.html @@ -3,8 +3,8 @@ QUnit module Test Suite - - + + diff --git a/test/module-todo.html b/test/module-todo.html index c9804f77e..4730ab9d7 100644 --- a/test/module-todo.html +++ b/test/module-todo.html @@ -3,8 +3,8 @@ QUnit module Test Suite - - + + diff --git a/test/moduleId.html b/test/moduleId.html index 6ba8cacab..cac2c65b9 100644 --- a/test/moduleId.html +++ b/test/moduleId.html @@ -3,8 +3,8 @@ QUnit ModuleId Test Suite - - + + diff --git a/test/mozjs.js b/test/mozjs.js index 713ee04b6..71d54fa76 100644 --- a/test/mozjs.js +++ b/test/mozjs.js @@ -2,7 +2,7 @@ /* eslint-disable lines-around-comment */ /* global loadRelativeToScript */ -loadRelativeToScript( "../dist/qunit.js" ); +loadRelativeToScript( "../qunit/qunit.js" ); QUnit.on( "runStart", () => { print( "Running tests..." ); diff --git a/test/onerror/inside-test.html b/test/onerror/inside-test.html index 448bd0c8c..e03244a99 100644 --- a/test/onerror/inside-test.html +++ b/test/onerror/inside-test.html @@ -3,8 +3,8 @@ QUnit onerror tests - - + + diff --git a/test/onerror/outside-test.html b/test/onerror/outside-test.html index a5706f184..ecf09dbda 100644 --- a/test/onerror/outside-test.html +++ b/test/onerror/outside-test.html @@ -3,8 +3,8 @@ QUnit onerror tests - - + + diff --git a/test/overload.html b/test/overload.html index dd73ceb46..bbc25f9cd 100644 --- a/test/overload.html +++ b/test/overload.html @@ -3,8 +3,8 @@ QUnit Only Test Suite - - + + - +
diff --git a/test/performance-mark.html b/test/performance-mark.html index 31a2cad15..9f4bed7f6 100644 --- a/test/performance-mark.html +++ b/test/performance-mark.html @@ -3,8 +3,8 @@ QUnit Performance Test Suite - - + + diff --git a/test/preconfigured.html b/test/preconfigured.html index 0205b3f02..e73c14ab9 100644 --- a/test/preconfigured.html +++ b/test/preconfigured.html @@ -3,7 +3,7 @@ QUnit Preconfigured Test Suite - + - + diff --git a/test/regex-exclude-filter.html b/test/regex-exclude-filter.html index 00675ca29..6620899bd 100644 --- a/test/regex-exclude-filter.html +++ b/test/regex-exclude-filter.html @@ -3,8 +3,8 @@ QUnit Regex Exclude Filtering Test Suite - - + + diff --git a/test/regex-filter.html b/test/regex-filter.html index e4c550e38..40ffe0e81 100644 --- a/test/regex-filter.html +++ b/test/regex-filter.html @@ -3,8 +3,8 @@ QUnit Regex Filtering Test Suite - - + + diff --git a/test/reorder.html b/test/reorder.html index cc0a9d627..760a765bc 100644 --- a/test/reorder.html +++ b/test/reorder.html @@ -3,8 +3,8 @@ QUnit Reordering Functionality Works in Browser - - + + diff --git a/test/reorderError1.html b/test/reorderError1.html index d51a5d7d3..df99ce60e 100644 --- a/test/reorderError1.html +++ b/test/reorderError1.html @@ -3,8 +3,8 @@ QUnit - Asserts it does not skip tests after reordering - - + + + diff --git a/test/reorderError2.html b/test/reorderError2.html index 6dc2907d5..a5ca6fd95 100644 --- a/test/reorderError2.html +++ b/test/reorderError2.html @@ -3,8 +3,8 @@ QUnit - Asserts it does not skip tests after reordering - - + + + diff --git a/test/reporter-html/legacy-markup.html b/test/reporter-html/legacy-markup.html index 1e4e60b02..d7fe97d74 100644 --- a/test/reporter-html/legacy-markup.html +++ b/test/reporter-html/legacy-markup.html @@ -3,8 +3,8 @@ QUnit HTML Reporter - Legacy Markup - - + + diff --git a/test/reporter-html/no-qunit-element.html b/test/reporter-html/no-qunit-element.html index ca1425344..32e9ee9e2 100644 --- a/test/reporter-html/no-qunit-element.html +++ b/test/reporter-html/no-qunit-element.html @@ -3,8 +3,8 @@ QUnit HTML Reporter - No Markup - - + + + + diff --git a/test/reporter-html/window-onerror-preexisting-handler.html b/test/reporter-html/window-onerror-preexisting-handler.html index 622fd797e..a318cecd9 100644 --- a/test/reporter-html/window-onerror-preexisting-handler.html +++ b/test/reporter-html/window-onerror-preexisting-handler.html @@ -3,7 +3,7 @@ QUnit HTML Reporter - window.onerror tests with preexisting handler - + - + diff --git a/test/reporter-html/window-onerror.html b/test/reporter-html/window-onerror.html index f33ab217b..b5b54c5bd 100644 --- a/test/reporter-html/window-onerror.html +++ b/test/reporter-html/window-onerror.html @@ -3,8 +3,8 @@ QUnit HTML Reporter - window.onerror tests with no existing handler - - + + diff --git a/test/reporter-html/xhtml-escape-details-source.xhtml b/test/reporter-html/xhtml-escape-details-source.xhtml index 46598b0d0..3528717db 100644 --- a/test/reporter-html/xhtml-escape-details-source.xhtml +++ b/test/reporter-html/xhtml-escape-details-source.xhtml @@ -4,8 +4,8 @@ QUnit Main Test Suite - - + + diff --git a/test/reporter-html/xhtml-single-testid.xhtml b/test/reporter-html/xhtml-single-testid.xhtml index 351582632..eebc38370 100644 --- a/test/reporter-html/xhtml-single-testid.xhtml +++ b/test/reporter-html/xhtml-single-testid.xhtml @@ -4,8 +4,8 @@ QUnit Main Test Suite - - + + diff --git a/test/reporter-urlparams-hidepassed.html b/test/reporter-urlparams-hidepassed.html index 1b04dcf65..0cc1cd701 100644 --- a/test/reporter-urlparams-hidepassed.html +++ b/test/reporter-urlparams-hidepassed.html @@ -3,8 +3,8 @@ QUnit URL Parameters Test Suite - - + + diff --git a/test/reporter-urlparams.html b/test/reporter-urlparams.html index daa15e918..c73ba5f3b 100644 --- a/test/reporter-urlparams.html +++ b/test/reporter-urlparams.html @@ -3,8 +3,8 @@ QUnit URL Parameters Test Suite - - + + diff --git a/test/sandboxed-iframe-contents.html b/test/sandboxed-iframe-contents.html index 760e43650..637570513 100644 --- a/test/sandboxed-iframe-contents.html +++ b/test/sandboxed-iframe-contents.html @@ -3,8 +3,8 @@ QUnit in Sandboxed Iframe Test Suite - Inside Iframe - - + + diff --git a/test/seed.html b/test/seed.html index 3c35f5577..d76805694 100644 --- a/test/seed.html +++ b/test/seed.html @@ -3,8 +3,8 @@ QUnit Randomization Test Suite - - + + diff --git a/test/stack-errors.html b/test/stack-errors.html index ea961c439..9534b0037 100644 --- a/test/stack-errors.html +++ b/test/stack-errors.html @@ -3,8 +3,8 @@ QUnit Main Test Suite - - + + diff --git a/test/startError.html b/test/startError.html index 517ee2402..0fefa2a33 100644 --- a/test/startError.html +++ b/test/startError.html @@ -3,11 +3,11 @@ QUnit Start Error Test Suite - +
- + diff --git a/test/string-filter.html b/test/string-filter.html index 4a7ff71e2..ee8a87132 100644 --- a/test/string-filter.html +++ b/test/string-filter.html @@ -3,8 +3,8 @@ QUnit String Filtering Test Suite - - + + diff --git a/test/webWorker-worker.js b/test/webWorker-worker.js index e1f58210d..5ddd3addb 100644 --- a/test/webWorker-worker.js +++ b/test/webWorker-worker.js @@ -1,7 +1,7 @@ /* global importScripts */ /* eslint-env es6 */ importScripts( - "../dist/qunit.js", + "../qunit/qunit.js", "main/test.js", "main/assert.js", "main/assert/step.js", diff --git a/test/webWorker.html b/test/webWorker.html index 31379148b..a0440b0e8 100644 --- a/test/webWorker.html +++ b/test/webWorker.html @@ -3,8 +3,8 @@ QUnit Web Worker Test Suite - - + +