qunitx-cli 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.lock +0 -2
- package/lib/setup/file-watcher.js +32 -10
- package/package.json +1 -2
package/deno.lock
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
"npm:@types/ws@*": "8.18.1",
|
|
8
8
|
"npm:cheerio@*": "1.2.0",
|
|
9
9
|
"npm:chokidar@*": "5.0.0",
|
|
10
|
-
"npm:chokidar@5": "5.0.0",
|
|
11
10
|
"npm:cors@^2.8.6": "2.8.6",
|
|
12
11
|
"npm:esbuild@*": "0.27.4",
|
|
13
12
|
"npm:esbuild@~0.27.3": "0.27.4",
|
|
@@ -1323,7 +1322,6 @@
|
|
|
1323
1322
|
],
|
|
1324
1323
|
"packageJson": {
|
|
1325
1324
|
"dependencies": [
|
|
1326
|
-
"npm:chokidar@5",
|
|
1327
1325
|
"npm:cors@^2.8.6",
|
|
1328
1326
|
"npm:esbuild@~0.27.3",
|
|
1329
1327
|
"npm:express@^5.2.1",
|
|
@@ -1,20 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { stat } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
2
4
|
import { green, magenta, red, yellow } from '../utils/color.js';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
|
-
* Starts
|
|
7
|
+
* Starts `fs.watch` watchers for each lookup path and calls `onEventFunc` on JS/TS file changes, debounced via a flag.
|
|
8
|
+
* Uses `config.fsTree` to distinguish `unlink` (tracked file) from `unlinkDir` (directory) on deletion.
|
|
6
9
|
* @returns {object}
|
|
7
10
|
*/
|
|
8
11
|
export default function setupFileWatchers(testFileLookupPaths, config, onEventFunc, onFinishFunc) {
|
|
9
12
|
const extensions = config.extensions || ['js', 'ts'];
|
|
10
|
-
const fileWatchers = testFileLookupPaths.reduce((
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
13
|
+
const fileWatchers = testFileLookupPaths.reduce((watchers, watchPath) => {
|
|
14
|
+
let ready = false;
|
|
15
|
+
const watcher = fs.watch(watchPath, { recursive: true }, async (eventType, filename) => {
|
|
16
|
+
if (!ready || !filename) return;
|
|
17
|
+
const fullPath = path.join(watchPath, filename);
|
|
18
|
+
if (eventType === 'change') {
|
|
19
|
+
return handleWatchEvent(config, extensions, 'change', fullPath, onEventFunc, onFinishFunc);
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const s = await stat(fullPath);
|
|
23
|
+
handleWatchEvent(
|
|
24
|
+
config,
|
|
25
|
+
extensions,
|
|
26
|
+
s.isDirectory() ? 'addDir' : 'add',
|
|
27
|
+
fullPath,
|
|
28
|
+
onEventFunc,
|
|
29
|
+
onFinishFunc,
|
|
30
|
+
);
|
|
31
|
+
} catch {
|
|
32
|
+
const event = config.fsTree && fullPath in config.fsTree ? 'unlink' : 'unlinkDir';
|
|
33
|
+
handleWatchEvent(config, extensions, event, fullPath, onEventFunc, onFinishFunc);
|
|
34
|
+
}
|
|
17
35
|
});
|
|
36
|
+
setImmediate(() => {
|
|
37
|
+
ready = true;
|
|
38
|
+
});
|
|
39
|
+
return Object.assign(watchers, { [watchPath]: watcher });
|
|
18
40
|
}, {});
|
|
19
41
|
|
|
20
42
|
return {
|
|
@@ -28,7 +50,7 @@ export default function setupFileWatchers(testFileLookupPaths, config, onEventFu
|
|
|
28
50
|
}
|
|
29
51
|
|
|
30
52
|
/**
|
|
31
|
-
* Routes a
|
|
53
|
+
* Routes a file-system event to fsTree mutation and optional rebuild trigger.
|
|
32
54
|
* `unlinkDir` bypasses the extension filter so deleted directories always clean up fsTree.
|
|
33
55
|
* @returns {void}
|
|
34
56
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qunitx-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"description": "Browser runner for QUnitx: run your qunitx tests in google-chrome",
|
|
6
6
|
"main": "cli.js",
|
|
7
7
|
"author": "Izel Nakri",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"url": "https://github.com/izelnakri/qunitx-cli.git"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"chokidar": "^5.0.0",
|
|
47
46
|
"esbuild": "^0.27.3",
|
|
48
47
|
"picomatch": "^4.0.3",
|
|
49
48
|
"puppeteer": "^24.38.0",
|