Comparing version
@@ -5,7 +5,7 @@ { | ||
"description": "The powerful, easy-to-use testing framework.", | ||
"version": "2.17.2", | ||
"version": "2.18.0", | ||
"homepage": "https://qunitjs.com", | ||
"author": { | ||
"name": "OpenJS Foundation and other contributors", | ||
"url": "https://github.com/qunitjs/qunit/blob/2.17.2/AUTHORS.txt" | ||
"url": "https://github.com/qunitjs/qunit/blob/2.18.0/AUTHORS.txt" | ||
}, | ||
@@ -46,3 +46,3 @@ "repository": { | ||
"commander": "7.2.0", | ||
"node-watch": "0.7.2", | ||
"node-watch": "0.7.3", | ||
"tiny-glob": "0.2.9" | ||
@@ -65,3 +65,2 @@ }, | ||
"eslint-plugin-qunit": "^6.2.0", | ||
"execa": "0.8.0", | ||
"fixturify": "^2.1.1", | ||
@@ -87,7 +86,7 @@ "fuzzysort": "^1.1.4", | ||
"build:coverage": "rollup -c --environment BUILD_TARGET:coverage && grunt copy:src-css", | ||
"test": "npm run test:lint && npm run build && grunt test && bin/qunit.js test/cli/*.js", | ||
"test": "npm run test:lint && npm run build && grunt test && node bin/qunit.js test/cli/*.js", | ||
"test:lint": "eslint --cache .", | ||
"test:main": "npm run build && grunt test", | ||
"test:cli": "npm run build && bin/qunit.js test/main/ test/cli/*.js", | ||
"test:integration": "npm run build && bin/qunit.js test/integration/*.js", | ||
"test:cli": "npm run build && node bin/qunit.js test/main/ test/cli/*.js", | ||
"test:integration": "npm run build && node bin/qunit.js test/integration/*.js", | ||
"build:dev": "node build/watch.js", | ||
@@ -94,0 +93,0 @@ "browserstack": "browserstack-runner -v", |
"use strict"; | ||
const path = require( "path" ); | ||
const url = require( "url" ); | ||
@@ -10,3 +11,4 @@ const requireFromCWD = require( "./require-from-cwd" ); | ||
const RESTART_DEBOUNCE_LENGTH = 200; | ||
const DEBOUNCE_WATCH_LENGTH = 60; | ||
const DEBOUNCE_RESTART_LENGTH = 200 - DEBOUNCE_WATCH_LENGTH; | ||
@@ -87,3 +89,7 @@ const changedPendingPurge = []; | ||
( !nodeVint || nodeVint >= 72 ) ) { | ||
await import( filePath ); // eslint-disable-line node/no-unsupported-features/es-syntax | ||
// filePath is an absolute file path here (per path.resolve above). | ||
// On Windows, Node.js enforces that absolute paths via ESM use valid URLs, | ||
// e.g. file-protocol) https://github.com/qunitjs/qunit/issues/1667 | ||
await import( url.pathToFileURL( filePath ) ); // eslint-disable-line node/no-unsupported-features/es-syntax | ||
} else { | ||
@@ -158,3 +164,3 @@ throw e; | ||
run.abort( () => run.apply( null, args ) ); | ||
}, RESTART_DEBOUNCE_LENGTH ); | ||
}, DEBOUNCE_RESTART_LENGTH ); | ||
}; | ||
@@ -180,3 +186,3 @@ | ||
run.watch = function watch() { | ||
run.watch = function watch( _, options ) { | ||
const watch = require( "node-watch" ); | ||
@@ -186,9 +192,31 @@ const args = Array.prototype.slice.call( arguments ); | ||
QUnit = requireQUnit(); | ||
global.QUnit = QUnit; | ||
options.requires.forEach( requireFromCWD ); | ||
// Include TypeScript when in use (automatically via require.extensions), | ||
// https://github.com/qunitjs/qunit/issues/1669. | ||
// | ||
// Include ".json" (part of require.extensions) for test suites that use a data files, | ||
// and for changes to package.json that may affect how a file is parsed (e.g. type=module). | ||
// | ||
// Include ".cjs" and ".mjs", which Node.js doesn't expose via require.extensions by default. | ||
// | ||
// eslint-disable-next-line node/no-deprecated-api | ||
const includeExts = Object.keys( require.extensions ).concat( [ ".cjs", ".mjs" ] ); | ||
const ignoreDirs = [ ".git", "node_modules" ]; | ||
const watcher = watch( baseDir, { | ||
persistent: true, | ||
recursive: true, | ||
delay: 0, | ||
filter: ( fullpath ) => { | ||
return !/\/node_modules\//.test( fullpath ) && | ||
/\.js$/.test( fullpath ); | ||
// Bare minimum delay, we have another debounce in run.restart(). | ||
delay: DEBOUNCE_WATCH_LENGTH, | ||
filter: ( fullpath, skip ) => { | ||
if ( /\/node_modules\//.test( fullpath ) || | ||
ignoreDirs.includes( path.basename( fullpath ) ) | ||
) { | ||
return skip; | ||
} | ||
return includeExts.includes( path.extname( fullpath ) ); | ||
} | ||
@@ -195,0 +223,0 @@ }, ( event, fullpath ) => { |
@@ -20,3 +20,5 @@ "use strict"; | ||
const gitIgnore = fs.readFileSync( gitFilePath, "utf8" ); | ||
return gitIgnore.trim().split( "\n" ); | ||
// Account for Windows-style line endings | ||
return gitIgnore.trim().split( /\r?\n/ ); | ||
} | ||
@@ -23,0 +25,0 @@ return []; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
283499
2.78%30
-3.23%7105
2.57%+ Added
- Removed
Updated