@rstest/core 0.9.1 → 0.9.2
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/dist/{0~89.js → 0~8843.js} +20 -24
- package/dist/{0~1472.js → 0~browserLoader.js} +5 -5
- package/dist/{0~7882.js → 0~browser~1.js} +32 -33
- package/dist/{0~8426.js → 0~checkThresholds.js} +2 -2
- package/dist/{0~130.js → 0~console.js} +15 -16
- package/dist/{0~9744.js → 0~dist.js} +57 -57
- package/dist/{0~7583.js → 0~esm.js} +66 -68
- package/dist/{0~4403.js → 0~generate.js} +5 -6
- package/dist/{0~4809.js → 0~happyDom.js} +2 -2
- package/dist/{0~3346.js → 0~interop.js} +0 -1
- package/dist/{0~62.js → 0~jsdom.js} +2 -2
- package/dist/{0~262.js → 0~lib.js} +4 -1
- package/dist/{0~9634.js → 0~listTests.js} +14 -23
- package/dist/{0~6923.js → 0~loadEsModule.js} +7 -7
- package/dist/{0~5835.js → 0~loadModule.js} +11 -11
- package/dist/{0~6907.js → 0~magic-string.es.js} +2 -1
- package/dist/{0~2255.js → 0~plugin.js} +2 -4
- package/dist/{0~6588.js → 0~restart.js} +7 -11
- package/dist/{0~2173.js → 0~runTests.js} +11 -20
- package/dist/{487.js → 1255.js} +22 -15
- package/dist/{6151.js → 1949.js} +15 -15
- package/dist/{6973.js → 255.js} +7 -8
- package/dist/{9131.js → 3145.js} +75 -404
- package/dist/{1157.js → 4411.js} +35 -35
- package/dist/{4484.js → 5040.js} +1 -2
- package/dist/{3160.js → 6830.js} +389 -81
- package/dist/7011.js +1 -1
- package/dist/{1294.js → 7552.js} +28 -22
- package/dist/{5734.js → 7704.js} +6 -5
- package/dist/browser-runtime/{2~907.js → 2~magic-string.es.js} +18 -11
- package/dist/browser-runtime/{389.js → 723.js} +39 -44
- package/dist/browser-runtime/{389.js.LICENSE.txt → 723.js.LICENSE.txt} +0 -22
- package/dist/browser-runtime/index.js +1 -1
- package/dist/browser-runtime/rslib-runtime.js +11 -3
- package/dist/browser.js +9 -7
- package/dist/globalSetupWorker.js +4 -13
- package/dist/index.js +2 -2
- package/dist/rslib-runtime.js +5 -8
- package/dist/worker.js +19 -45
- package/package.json +6 -6
- package/dist/3160.js.LICENSE.txt +0 -21
- package/dist/4881.js +0 -2
- package/dist/6198.js +0 -2
- /package/dist/{0~7583.js.LICENSE.txt → 0~esm.js.LICENSE.txt} +0 -0
- /package/dist/{0~3062.js → 0~utils.js} +0 -0
- /package/dist/{6151.js.LICENSE.txt → 1949.js.LICENSE.txt} +0 -0
- /package/dist/{4597.js → 1983.js} +0 -0
- /package/dist/{1294.js.LICENSE.txt → 7552.js.LICENSE.txt} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*!
|
|
1
|
+
/*! LICENSE: 0~esm.js.LICENSE.txt */
|
|
2
2
|
import "node:module";
|
|
3
|
-
import {
|
|
4
|
-
import { lstat, open as promises_open, readdir, realpath as
|
|
3
|
+
import { stat as external_node_fs_stat, unwatchFile, watch, watchFile } from "node:fs";
|
|
4
|
+
import { lstat as promises_lstat, open as promises_open, readdir, realpath as external_fs_promises_realpath, stat as promises_stat } from "fs/promises";
|
|
5
5
|
import { EventEmitter } from "events";
|
|
6
|
+
import { basename as external_node_path_basename, dirname as external_node_path_dirname, extname, isAbsolute, join, normalize, relative as external_node_path_relative, resolve as external_node_path_resolve, sep } from "node:path";
|
|
7
|
+
import { lstat, readdir as promises_readdir, realpath as promises_realpath, stat as external_node_fs_promises_stat } from "node:fs/promises";
|
|
6
8
|
import { Readable } from "node:stream";
|
|
7
|
-
import "
|
|
8
|
-
import { readdir as promises_readdir, lstat as promises_lstat, promises_stat as promises_promises_stat, realpath as external_node_fs_promises_realpath } from "./1157.js";
|
|
9
|
-
const external_node_path_ = __webpack_require__("path");
|
|
9
|
+
import { type as external_node_os_type } from "node:os";
|
|
10
10
|
const EntryTypes = {
|
|
11
11
|
FILE_TYPE: 'files',
|
|
12
12
|
DIR_TYPE: 'directories',
|
|
@@ -78,7 +78,7 @@ class ReaddirpStream extends Readable {
|
|
|
78
78
|
const { root, type } = opts;
|
|
79
79
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
80
80
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
81
|
-
const statMethod = opts.lstat ?
|
|
81
|
+
const statMethod = opts.lstat ? lstat : external_node_fs_promises_stat;
|
|
82
82
|
if (wantBigintFsStats) this._stat = (path)=>statMethod(path, {
|
|
83
83
|
bigint: true
|
|
84
84
|
});
|
|
@@ -87,7 +87,7 @@ class ReaddirpStream extends Readable {
|
|
|
87
87
|
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
88
88
|
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
89
89
|
this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
|
|
90
|
-
this._root = (
|
|
90
|
+
this._root = external_node_path_resolve(root);
|
|
91
91
|
this._isDirent = !opts.alwaysStat;
|
|
92
92
|
this._statsProp = this._isDirent ? 'dirent' : 'stats';
|
|
93
93
|
this._rdOptions = {
|
|
@@ -161,9 +161,9 @@ class ReaddirpStream extends Readable {
|
|
|
161
161
|
let entry;
|
|
162
162
|
const basename = this._isDirent ? dirent.name : dirent;
|
|
163
163
|
try {
|
|
164
|
-
const fullPath = (
|
|
164
|
+
const fullPath = external_node_path_resolve(join(path, basename));
|
|
165
165
|
entry = {
|
|
166
|
-
path: (
|
|
166
|
+
path: external_node_path_relative(this._root, fullPath),
|
|
167
167
|
fullPath,
|
|
168
168
|
basename
|
|
169
169
|
};
|
|
@@ -186,12 +186,12 @@ class ReaddirpStream extends Readable {
|
|
|
186
186
|
if (stats && stats.isSymbolicLink()) {
|
|
187
187
|
const full = entry.fullPath;
|
|
188
188
|
try {
|
|
189
|
-
const entryRealPath = await
|
|
190
|
-
const entryRealPathStats = await
|
|
189
|
+
const entryRealPath = await promises_realpath(full);
|
|
190
|
+
const entryRealPathStats = await lstat(entryRealPath);
|
|
191
191
|
if (entryRealPathStats.isFile()) return 'file';
|
|
192
192
|
if (entryRealPathStats.isDirectory()) {
|
|
193
193
|
const len = entryRealPath.length;
|
|
194
|
-
if (full.startsWith(entryRealPath) && full.substr(len, 1) ===
|
|
194
|
+
if (full.startsWith(entryRealPath) && full.substr(len, 1) === sep) {
|
|
195
195
|
const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
|
196
196
|
recursiveError.code = RECURSIVE_ERROR_CODE;
|
|
197
197
|
return this._onError(recursiveError);
|
|
@@ -220,8 +220,6 @@ function readdirp(root, options = {}) {
|
|
|
220
220
|
options.root = root;
|
|
221
221
|
return new ReaddirpStream(options);
|
|
222
222
|
}
|
|
223
|
-
const external_node_fs_ = __webpack_require__("node:fs");
|
|
224
|
-
const external_node_os_ = __webpack_require__("node:os");
|
|
225
223
|
const STR_DATA = 'data';
|
|
226
224
|
const STR_END = 'end';
|
|
227
225
|
const STR_CLOSE = 'close';
|
|
@@ -231,7 +229,7 @@ const isWindows = 'win32' === pl;
|
|
|
231
229
|
const isMacos = 'darwin' === pl;
|
|
232
230
|
const isLinux = 'linux' === pl;
|
|
233
231
|
const isFreeBSD = 'freebsd' === pl;
|
|
234
|
-
const isIBMi = 'OS400' === (
|
|
232
|
+
const isIBMi = 'OS400' === external_node_os_type();
|
|
235
233
|
const EVENTS = {
|
|
236
234
|
ALL: 'all',
|
|
237
235
|
READY: 'ready',
|
|
@@ -246,7 +244,7 @@ const EVENTS = {
|
|
|
246
244
|
const EV = EVENTS;
|
|
247
245
|
const THROTTLE_MODE_WATCH = 'watch';
|
|
248
246
|
const statMethods = {
|
|
249
|
-
lstat:
|
|
247
|
+
lstat: promises_lstat,
|
|
250
248
|
stat: promises_stat
|
|
251
249
|
};
|
|
252
250
|
const KEY_LISTENERS = 'listeners';
|
|
@@ -520,7 +518,7 @@ const binaryExtensions = new Set([
|
|
|
520
518
|
'zip',
|
|
521
519
|
'zipx'
|
|
522
520
|
]);
|
|
523
|
-
const isBinaryPath = (filePath)=>binaryExtensions.has(
|
|
521
|
+
const isBinaryPath = (filePath)=>binaryExtensions.has(extname(filePath).slice(1).toLowerCase());
|
|
524
522
|
const foreach = (val, fn)=>{
|
|
525
523
|
if (val instanceof Set) val.forEach(fn);
|
|
526
524
|
else fn(val);
|
|
@@ -550,10 +548,10 @@ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
|
|
550
548
|
emitRaw(rawEvent, evPath, {
|
|
551
549
|
watchedPath: path
|
|
552
550
|
});
|
|
553
|
-
if (evPath && path !== evPath) fsWatchBroadcast(
|
|
551
|
+
if (evPath && path !== evPath) fsWatchBroadcast(external_node_path_resolve(path, evPath), KEY_LISTENERS, join(path, evPath));
|
|
554
552
|
};
|
|
555
553
|
try {
|
|
556
|
-
return
|
|
554
|
+
return watch(path, {
|
|
557
555
|
persistent: options.persistent
|
|
558
556
|
}, handleEvent);
|
|
559
557
|
} catch (error) {
|
|
@@ -621,7 +619,7 @@ const setFsWatchFileListener = (path, fullPath, options, handlers)=>{
|
|
|
621
619
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
622
620
|
const copts = cont && cont.options;
|
|
623
621
|
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
|
624
|
-
|
|
622
|
+
unwatchFile(fullPath);
|
|
625
623
|
cont = void 0;
|
|
626
624
|
}
|
|
627
625
|
if (cont) {
|
|
@@ -632,7 +630,7 @@ const setFsWatchFileListener = (path, fullPath, options, handlers)=>{
|
|
|
632
630
|
listeners: listener,
|
|
633
631
|
rawEmitters: rawEmitter,
|
|
634
632
|
options,
|
|
635
|
-
watcher:
|
|
633
|
+
watcher: watchFile(fullPath, options, (curr, prev)=>{
|
|
636
634
|
foreach(cont.rawEmitters, (rawEmitter)=>{
|
|
637
635
|
rawEmitter(EV.CHANGE, fullPath, {
|
|
638
636
|
curr,
|
|
@@ -650,7 +648,7 @@ const setFsWatchFileListener = (path, fullPath, options, handlers)=>{
|
|
|
650
648
|
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
651
649
|
if (isEmptySet(cont.listeners)) {
|
|
652
650
|
FsWatchFileInstances.delete(fullPath);
|
|
653
|
-
|
|
651
|
+
unwatchFile(fullPath);
|
|
654
652
|
cont.options = cont.watcher = void 0;
|
|
655
653
|
Object.freeze(cont);
|
|
656
654
|
}
|
|
@@ -663,11 +661,11 @@ class NodeFsHandler {
|
|
|
663
661
|
}
|
|
664
662
|
_watchWithNodeFs(path, listener) {
|
|
665
663
|
const opts = this.fsw.options;
|
|
666
|
-
const directory =
|
|
667
|
-
const basename =
|
|
664
|
+
const directory = external_node_path_dirname(path);
|
|
665
|
+
const basename = external_node_path_basename(path);
|
|
668
666
|
const parent = this.fsw._getWatchedDir(directory);
|
|
669
667
|
parent.add(basename);
|
|
670
|
-
const absolutePath =
|
|
668
|
+
const absolutePath = external_node_path_resolve(path);
|
|
671
669
|
const options = {
|
|
672
670
|
persistent: opts.persistent
|
|
673
671
|
};
|
|
@@ -689,8 +687,8 @@ class NodeFsHandler {
|
|
|
689
687
|
}
|
|
690
688
|
_handleFile(file, stats, initialAdd) {
|
|
691
689
|
if (this.fsw.closed) return;
|
|
692
|
-
const dirname =
|
|
693
|
-
const basename =
|
|
690
|
+
const dirname = external_node_path_dirname(file);
|
|
691
|
+
const basename = external_node_path_basename(file);
|
|
694
692
|
const parent = this.fsw._getWatchedDir(dirname);
|
|
695
693
|
let prevStats = stats;
|
|
696
694
|
if (parent.has(basename)) return;
|
|
@@ -734,7 +732,7 @@ class NodeFsHandler {
|
|
|
734
732
|
this.fsw._incrReadyCount();
|
|
735
733
|
let linkPath;
|
|
736
734
|
try {
|
|
737
|
-
linkPath = await
|
|
735
|
+
linkPath = await external_fs_promises_realpath(path);
|
|
738
736
|
} catch (e) {
|
|
739
737
|
this.fsw._emitReady();
|
|
740
738
|
return true;
|
|
@@ -757,7 +755,7 @@ class NodeFsHandler {
|
|
|
757
755
|
this.fsw._symlinkPaths.set(full, true);
|
|
758
756
|
}
|
|
759
757
|
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
760
|
-
directory =
|
|
758
|
+
directory = join(directory, '');
|
|
761
759
|
throttler = this.fsw._throttle('readdir', directory, 1000);
|
|
762
760
|
if (!throttler) return;
|
|
763
761
|
const previous = this.fsw._getWatchedDir(wh.path);
|
|
@@ -773,7 +771,7 @@ class NodeFsHandler {
|
|
|
773
771
|
return;
|
|
774
772
|
}
|
|
775
773
|
const item = entry.path;
|
|
776
|
-
let path =
|
|
774
|
+
let path = join(directory, item);
|
|
777
775
|
current.add(item);
|
|
778
776
|
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) return;
|
|
779
777
|
if (this.fsw.closed) {
|
|
@@ -782,7 +780,7 @@ class NodeFsHandler {
|
|
|
782
780
|
}
|
|
783
781
|
if (item === target || !target && !previous.has(item)) {
|
|
784
782
|
this.fsw._incrReadyCount();
|
|
785
|
-
path =
|
|
783
|
+
path = join(dir, external_node_path_relative(dir, path));
|
|
786
784
|
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
|
787
785
|
}
|
|
788
786
|
}).on(EV.ERROR, this._boundHandleError);
|
|
@@ -804,10 +802,10 @@ class NodeFsHandler {
|
|
|
804
802
|
});
|
|
805
803
|
}
|
|
806
804
|
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
|
|
807
|
-
const parentDir = this.fsw._getWatchedDir(
|
|
808
|
-
const tracked = parentDir.has(
|
|
805
|
+
const parentDir = this.fsw._getWatchedDir(external_node_path_dirname(dir));
|
|
806
|
+
const tracked = parentDir.has(external_node_path_basename(dir));
|
|
809
807
|
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) this.fsw._emit(EV.ADD_DIR, dir, stats);
|
|
810
|
-
parentDir.add(
|
|
808
|
+
parentDir.add(external_node_path_basename(dir));
|
|
811
809
|
this.fsw._getWatchedDir(dir);
|
|
812
810
|
let throttler;
|
|
813
811
|
let closer;
|
|
@@ -845,21 +843,21 @@ class NodeFsHandler {
|
|
|
845
843
|
const follow = this.fsw.options.followSymlinks;
|
|
846
844
|
let closer;
|
|
847
845
|
if (stats.isDirectory()) {
|
|
848
|
-
const absPath =
|
|
849
|
-
const targetPath = follow ? await
|
|
846
|
+
const absPath = external_node_path_resolve(path);
|
|
847
|
+
const targetPath = follow ? await external_fs_promises_realpath(path) : path;
|
|
850
848
|
if (this.fsw.closed) return;
|
|
851
849
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
852
850
|
if (this.fsw.closed) return;
|
|
853
851
|
if (absPath !== targetPath && void 0 !== targetPath) this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
854
852
|
} else if (stats.isSymbolicLink()) {
|
|
855
|
-
const targetPath = follow ? await
|
|
853
|
+
const targetPath = follow ? await external_fs_promises_realpath(path) : path;
|
|
856
854
|
if (this.fsw.closed) return;
|
|
857
|
-
const parent =
|
|
855
|
+
const parent = external_node_path_dirname(wh.watchPath);
|
|
858
856
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
859
857
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
860
858
|
closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
|
|
861
859
|
if (this.fsw.closed) return;
|
|
862
|
-
if (void 0 !== targetPath) this.fsw._symlinkPaths.set(
|
|
860
|
+
if (void 0 !== targetPath) this.fsw._symlinkPaths.set(external_node_path_resolve(path), targetPath);
|
|
863
861
|
} else closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
864
862
|
ready();
|
|
865
863
|
if (closer) this.fsw._addPathCloser(path, closer);
|
|
@@ -894,9 +892,9 @@ function createPattern(matcher) {
|
|
|
894
892
|
if ('object' == typeof matcher && null !== matcher) return (string)=>{
|
|
895
893
|
if (matcher.path === string) return true;
|
|
896
894
|
if (matcher.recursive) {
|
|
897
|
-
const relative =
|
|
895
|
+
const relative = external_node_path_relative(matcher.path, string);
|
|
898
896
|
if (!relative) return false;
|
|
899
|
-
return !relative.startsWith('..') && !
|
|
897
|
+
return !relative.startsWith('..') && !isAbsolute(relative);
|
|
900
898
|
}
|
|
901
899
|
return false;
|
|
902
900
|
};
|
|
@@ -904,7 +902,7 @@ function createPattern(matcher) {
|
|
|
904
902
|
}
|
|
905
903
|
function normalizePath(path) {
|
|
906
904
|
if ('string' != typeof path) throw new Error('string expected');
|
|
907
|
-
path =
|
|
905
|
+
path = normalize(path);
|
|
908
906
|
path = path.replace(/\\/g, '/');
|
|
909
907
|
let prepend = false;
|
|
910
908
|
if (path.startsWith('//')) prepend = true;
|
|
@@ -941,14 +939,14 @@ const toUnix = (string)=>{
|
|
|
941
939
|
if (prepend) str = SLASH + str;
|
|
942
940
|
return str;
|
|
943
941
|
};
|
|
944
|
-
const normalizePathToUnix = (path)=>toUnix(
|
|
942
|
+
const normalizePathToUnix = (path)=>toUnix(normalize(toUnix(path)));
|
|
945
943
|
const normalizeIgnored = (cwd = '')=>(path)=>{
|
|
946
|
-
if ('string' == typeof path) return normalizePathToUnix(
|
|
944
|
+
if ('string' == typeof path) return normalizePathToUnix(isAbsolute(path) ? path : join(cwd, path));
|
|
947
945
|
return path;
|
|
948
946
|
};
|
|
949
947
|
const getAbsolutePath = (path, cwd)=>{
|
|
950
|
-
if (
|
|
951
|
-
return
|
|
948
|
+
if (isAbsolute(path)) return path;
|
|
949
|
+
return join(cwd, path);
|
|
952
950
|
};
|
|
953
951
|
const EMPTY_SET = Object.freeze(new Set());
|
|
954
952
|
class DirEntry {
|
|
@@ -971,7 +969,7 @@ class DirEntry {
|
|
|
971
969
|
try {
|
|
972
970
|
await readdir(dir);
|
|
973
971
|
} catch (err) {
|
|
974
|
-
if (this._removeWatcher) this._removeWatcher(
|
|
972
|
+
if (this._removeWatcher) this._removeWatcher(external_node_path_dirname(dir), external_node_path_basename(dir));
|
|
975
973
|
}
|
|
976
974
|
}
|
|
977
975
|
has(item) {
|
|
@@ -1002,7 +1000,7 @@ class WatchHelper {
|
|
|
1002
1000
|
const watchPath = path;
|
|
1003
1001
|
this.path = path = path.replace(REPLACER_RE, '');
|
|
1004
1002
|
this.watchPath = watchPath;
|
|
1005
|
-
this.fullWatchPath =
|
|
1003
|
+
this.fullWatchPath = external_node_path_resolve(watchPath);
|
|
1006
1004
|
this.dirParts = [];
|
|
1007
1005
|
this.dirParts.forEach((parts)=>{
|
|
1008
1006
|
if (parts.length > 1) parts.pop();
|
|
@@ -1011,7 +1009,7 @@ class WatchHelper {
|
|
|
1011
1009
|
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
|
1012
1010
|
}
|
|
1013
1011
|
entryPath(entry) {
|
|
1014
|
-
return
|
|
1012
|
+
return join(this.watchPath, external_node_path_relative(this.watchPath, entry.fullPath));
|
|
1015
1013
|
}
|
|
1016
1014
|
filterPath(entry) {
|
|
1017
1015
|
const { stats } = entry;
|
|
@@ -1118,7 +1116,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1118
1116
|
})).then((results)=>{
|
|
1119
1117
|
if (this.closed) return;
|
|
1120
1118
|
results.forEach((item)=>{
|
|
1121
|
-
if (item) this.add(
|
|
1119
|
+
if (item) this.add(external_node_path_dirname(item), external_node_path_basename(_origAdd || item));
|
|
1122
1120
|
});
|
|
1123
1121
|
});
|
|
1124
1122
|
return this;
|
|
@@ -1128,9 +1126,9 @@ class FSWatcher extends EventEmitter {
|
|
|
1128
1126
|
const paths = unifyPaths(paths_);
|
|
1129
1127
|
const { cwd } = this.options;
|
|
1130
1128
|
paths.forEach((path)=>{
|
|
1131
|
-
if (!
|
|
1132
|
-
if (cwd) path =
|
|
1133
|
-
path =
|
|
1129
|
+
if (!isAbsolute(path) && !this._closers.has(path)) {
|
|
1130
|
+
if (cwd) path = join(cwd, path);
|
|
1131
|
+
path = external_node_path_resolve(path);
|
|
1134
1132
|
}
|
|
1135
1133
|
this._closePath(path);
|
|
1136
1134
|
this._addIgnoredPath(path);
|
|
@@ -1167,7 +1165,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1167
1165
|
getWatched() {
|
|
1168
1166
|
const watchList = {};
|
|
1169
1167
|
this._watched.forEach((entry, dir)=>{
|
|
1170
|
-
const key = this.options.cwd ?
|
|
1168
|
+
const key = this.options.cwd ? external_node_path_relative(this.options.cwd, dir) : dir;
|
|
1171
1169
|
const index = key || ONE_DOT;
|
|
1172
1170
|
watchList[index] = entry.getChildren().sort();
|
|
1173
1171
|
});
|
|
@@ -1180,8 +1178,8 @@ class FSWatcher extends EventEmitter {
|
|
|
1180
1178
|
async _emit(event, path, stats) {
|
|
1181
1179
|
if (this.closed) return;
|
|
1182
1180
|
const opts = this.options;
|
|
1183
|
-
if (isWindows) path =
|
|
1184
|
-
if (opts.cwd) path =
|
|
1181
|
+
if (isWindows) path = normalize(path);
|
|
1182
|
+
if (opts.cwd) path = external_node_path_relative(opts.cwd, path);
|
|
1185
1183
|
const args = [
|
|
1186
1184
|
path
|
|
1187
1185
|
];
|
|
@@ -1232,7 +1230,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1232
1230
|
if (isThrottled) return this;
|
|
1233
1231
|
}
|
|
1234
1232
|
if (opts.alwaysStat && void 0 === stats && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
1235
|
-
const fullPath = opts.cwd ?
|
|
1233
|
+
const fullPath = opts.cwd ? join(opts.cwd, path) : path;
|
|
1236
1234
|
let stats;
|
|
1237
1235
|
try {
|
|
1238
1236
|
stats = await promises_stat(fullPath);
|
|
@@ -1284,11 +1282,11 @@ class FSWatcher extends EventEmitter {
|
|
|
1284
1282
|
const pollInterval = awf.pollInterval;
|
|
1285
1283
|
let timeoutHandler;
|
|
1286
1284
|
let fullPath = path;
|
|
1287
|
-
if (this.options.cwd && !
|
|
1285
|
+
if (this.options.cwd && !isAbsolute(path)) fullPath = join(this.options.cwd, path);
|
|
1288
1286
|
const now = new Date();
|
|
1289
1287
|
const writes = this._pendingWrites;
|
|
1290
1288
|
function awaitWriteFinishFn(prevStat) {
|
|
1291
|
-
(
|
|
1289
|
+
external_node_fs_stat(fullPath, (err, curStat)=>{
|
|
1292
1290
|
if (err || !writes.has(path)) {
|
|
1293
1291
|
if (err && 'ENOENT' !== err.code) awfEmit(err);
|
|
1294
1292
|
return;
|
|
@@ -1339,7 +1337,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1339
1337
|
return new WatchHelper(path, this.options.followSymlinks, this);
|
|
1340
1338
|
}
|
|
1341
1339
|
_getWatchedDir(directory) {
|
|
1342
|
-
const dir =
|
|
1340
|
+
const dir = external_node_path_resolve(directory);
|
|
1343
1341
|
if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
|
|
1344
1342
|
return this._watched.get(dir);
|
|
1345
1343
|
}
|
|
@@ -1348,8 +1346,8 @@ class FSWatcher extends EventEmitter {
|
|
|
1348
1346
|
return Boolean(256 & Number(stats.mode));
|
|
1349
1347
|
}
|
|
1350
1348
|
_remove(directory, item, isDirectory) {
|
|
1351
|
-
const path =
|
|
1352
|
-
const fullPath =
|
|
1349
|
+
const path = join(directory, item);
|
|
1350
|
+
const fullPath = external_node_path_resolve(path);
|
|
1353
1351
|
isDirectory = null != isDirectory ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
|
|
1354
1352
|
if (!this._throttle('remove', path, 100)) return;
|
|
1355
1353
|
if (!isDirectory && 1 === this._watched.size) this.add(directory, item, true);
|
|
@@ -1361,7 +1359,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1361
1359
|
parent.remove(item);
|
|
1362
1360
|
if (this._symlinkPaths.has(fullPath)) this._symlinkPaths.delete(fullPath);
|
|
1363
1361
|
let relPath = path;
|
|
1364
|
-
if (this.options.cwd) relPath =
|
|
1362
|
+
if (this.options.cwd) relPath = external_node_path_relative(this.options.cwd, path);
|
|
1365
1363
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
1366
1364
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
1367
1365
|
if (event === EVENTS.ADD) return;
|
|
@@ -1374,8 +1372,8 @@ class FSWatcher extends EventEmitter {
|
|
|
1374
1372
|
}
|
|
1375
1373
|
_closePath(path) {
|
|
1376
1374
|
this._closeFile(path);
|
|
1377
|
-
const dir =
|
|
1378
|
-
this._getWatchedDir(dir).remove(
|
|
1375
|
+
const dir = external_node_path_dirname(path);
|
|
1376
|
+
this._getWatchedDir(dir).remove(external_node_path_basename(path));
|
|
1379
1377
|
}
|
|
1380
1378
|
_closeFile(path) {
|
|
1381
1379
|
const closers = this._closers.get(path);
|
|
@@ -1415,9 +1413,9 @@ class FSWatcher extends EventEmitter {
|
|
|
1415
1413
|
return stream;
|
|
1416
1414
|
}
|
|
1417
1415
|
}
|
|
1418
|
-
function
|
|
1416
|
+
function esm_watch(paths, options = {}) {
|
|
1419
1417
|
const watcher = new FSWatcher(options);
|
|
1420
1418
|
watcher.add(paths);
|
|
1421
1419
|
return watcher;
|
|
1422
1420
|
}
|
|
1423
|
-
export { watch };
|
|
1421
|
+
export { esm_watch as watch };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { isDynamicPattern, glob } from "./
|
|
3
|
-
import { normalize, logger as logger_logger } from "./
|
|
2
|
+
import { isDynamicPattern, glob } from "./4411.js";
|
|
3
|
+
import { normalize, logger as logger_logger } from "./6830.js";
|
|
4
4
|
const getIncludedFiles = async (coverage, rootPath, fs)=>{
|
|
5
5
|
const ignoredPatterns = coverage.exclude?.filter((item)=>isDynamicPattern(item) || item.startsWith(rootPath) || item.startsWith('./'));
|
|
6
6
|
const allFiles = await glob(coverage.include, {
|
|
@@ -41,9 +41,7 @@ async function generateCoverage(context, results, coverageProvider) {
|
|
|
41
41
|
}
|
|
42
42
|
await coverageProvider.generateReports(finalCoverageMap, coverage);
|
|
43
43
|
if (coverage.thresholds) {
|
|
44
|
-
const { checkThresholds } = await import("./0~
|
|
45
|
-
checkThresholds: mod.checkThresholds
|
|
46
|
-
}));
|
|
44
|
+
const { checkThresholds } = await import("./0~checkThresholds.js");
|
|
47
45
|
const thresholdResult = checkThresholds({
|
|
48
46
|
coverageMap: finalCoverageMap,
|
|
49
47
|
coverageProvider,
|
|
@@ -71,4 +69,5 @@ async function generateCoverageForUntestedFiles(environmentName, uncoveredFiles,
|
|
|
71
69
|
coverageMap.addFileCoverage(coverageData);
|
|
72
70
|
});
|
|
73
71
|
}
|
|
74
|
-
|
|
72
|
+
var generate_getIncludedFiles = void 0;
|
|
73
|
+
export { generateCoverage, generate_getIncludedFiles as getIncludedFiles };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { checkPkgInstalled } from "./
|
|
3
|
-
import { installGlobal, addDefaultErrorHandler } from "./0~
|
|
2
|
+
import { checkPkgInstalled } from "./7552.js";
|
|
3
|
+
import { installGlobal, addDefaultErrorHandler } from "./0~utils.js";
|
|
4
4
|
const environment = {
|
|
5
5
|
name: 'happy-dom',
|
|
6
6
|
setup: async (global, options = {})=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { checkPkgInstalled } from "./
|
|
3
|
-
import { installGlobal, addDefaultErrorHandler } from "./0~
|
|
2
|
+
import { checkPkgInstalled } from "./7552.js";
|
|
3
|
+
import { installGlobal, addDefaultErrorHandler } from "./0~utils.js";
|
|
4
4
|
const environment = {
|
|
5
5
|
name: 'jsdom',
|
|
6
6
|
setup: async (global, options)=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
-
import "./
|
|
3
|
+
import "./6830.js";
|
|
4
4
|
__webpack_require__.add({
|
|
5
5
|
"../../node_modules/.pnpm/js-tokens@4.0.0/node_modules/js-tokens/index.js" (__unused_rspack_module, exports) {
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -1340,3 +1340,6 @@ __webpack_require__.add({
|
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
1342
|
});
|
|
1343
|
+
const lib = __webpack_require__("../../node_modules/.pnpm/@babel+code-frame@7.29.0/node_modules/@babel/code-frame/lib/index.js");
|
|
1344
|
+
var codeFrameColumns = lib.codeFrameColumns;
|
|
1345
|
+
export { codeFrameColumns };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~
|
|
5
|
-
import { getTestEntries, resolveShardedEntries, prettyTestPath, ROOT_SUITE_NAME } from "./
|
|
6
|
-
|
|
7
|
-
const external_node_path_ = __webpack_require__("path");
|
|
2
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, isAbsolute, join, relative } from "node:path";
|
|
4
|
+
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~8843.js";
|
|
5
|
+
import { getTestEntries, resolveShardedEntries, prettyTestPath, ROOT_SUITE_NAME } from "./4411.js";
|
|
6
|
+
import { logger as logger_logger, getTaskNameWithPrefix, color, bgColor } from "./6830.js";
|
|
8
7
|
const collectNodeTests = async ({ context, nodeProjects, globTestSourceEntries })=>{
|
|
9
|
-
const { getSetupFiles } = await import("./
|
|
10
|
-
getSetupFiles: mod.getSetupFiles
|
|
11
|
-
}));
|
|
8
|
+
const { getSetupFiles } = await import("./255.js");
|
|
12
9
|
if (0 === nodeProjects.length) return {
|
|
13
10
|
list: [],
|
|
14
11
|
getSourceMap: async ()=>null,
|
|
@@ -103,9 +100,7 @@ const collectBrowserTests = async ({ context, browserProjects, shardedEntries })
|
|
|
103
100
|
list: [],
|
|
104
101
|
close: async ()=>void 0
|
|
105
102
|
};
|
|
106
|
-
const { loadBrowserModule } = await import("./0~
|
|
107
|
-
loadBrowserModule: mod.loadBrowserModule
|
|
108
|
-
}));
|
|
103
|
+
const { loadBrowserModule } = await import("./0~browserLoader.js");
|
|
109
104
|
const projectRoots = browserProjects.map((p)=>p.rootPath);
|
|
110
105
|
const { validateBrowserConfig, listBrowserTests } = await loadBrowserModule({
|
|
111
106
|
projectRoots
|
|
@@ -215,12 +210,10 @@ async function listTests(context, { filesOnly, json, printLocation, includeSuite
|
|
|
215
210
|
const hasError = list.some((file)=>file.errors?.length) || errors.length;
|
|
216
211
|
const showProject = context.projects.length > 1;
|
|
217
212
|
if (hasError) {
|
|
218
|
-
const { printError } = await import("./
|
|
219
|
-
printError: mod.error_printError
|
|
220
|
-
}));
|
|
213
|
+
const { printError } = await import("./3145.js");
|
|
221
214
|
process.exitCode = 1;
|
|
222
215
|
for (const file of list){
|
|
223
|
-
const relativePath =
|
|
216
|
+
const relativePath = relative(rootPath, file.testPath);
|
|
224
217
|
if (file.errors?.length) {
|
|
225
218
|
logger_logger.log(`${bgColor('bgRed', ' FAIL ')} ${relativePath}`);
|
|
226
219
|
for (const error of file.errors)await printError(error, async (name)=>{
|
|
@@ -230,9 +223,7 @@ async function listTests(context, { filesOnly, json, printLocation, includeSuite
|
|
|
230
223
|
}
|
|
231
224
|
}
|
|
232
225
|
if (errors.length) {
|
|
233
|
-
const { printError } = await import("./
|
|
234
|
-
printError: mod.error_printError
|
|
235
|
-
}));
|
|
226
|
+
const { printError } = await import("./3145.js");
|
|
236
227
|
for (const error of errors || []){
|
|
237
228
|
logger_logger.stderr(bgColor('bgRed', ' Unhandled Error '));
|
|
238
229
|
await printError(error, async (name)=>{
|
|
@@ -262,14 +253,14 @@ async function listTests(context, { filesOnly, json, printLocation, includeSuite
|
|
|
262
253
|
if (json && 'false' !== json) {
|
|
263
254
|
const content = JSON.stringify(tests, null, 2);
|
|
264
255
|
if (true !== json && 'true' !== json) {
|
|
265
|
-
const jsonPath =
|
|
266
|
-
|
|
256
|
+
const jsonPath = isAbsolute(json) ? json : join(rootPath, json);
|
|
257
|
+
mkdirSync(dirname(jsonPath), {
|
|
267
258
|
recursive: true
|
|
268
259
|
});
|
|
269
|
-
|
|
260
|
+
writeFileSync(jsonPath, content);
|
|
270
261
|
} else logger_logger.log(content);
|
|
271
262
|
} else for (const test of tests){
|
|
272
|
-
let shortPath =
|
|
263
|
+
let shortPath = relative(rootPath, test.file);
|
|
273
264
|
if (test.location && printLocation) shortPath = `${shortPath}:${test.location.line}:${test.location.column}`;
|
|
274
265
|
logger_logger.log(test.name ? `${color.dim(`${shortPath} > `)}${test.name}` : prettyTestPath(shortPath));
|
|
275
266
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
2
|
+
import { isAbsolute } from "node:path";
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
+
import node_vm from "node:vm";
|
|
5
|
+
import { logger as logger_logger } from "./6830.js";
|
|
6
6
|
import { posix } from "./7011.js";
|
|
7
|
-
|
|
7
|
+
import { interopModule, shouldInterop } from "./0~interop.js";
|
|
8
8
|
var loadEsModule_EsmMode = /*#__PURE__*/ function(EsmMode) {
|
|
9
9
|
EsmMode[EsmMode["Unknown"] = 0] = "Unknown";
|
|
10
10
|
EsmMode[EsmMode["Evaluated"] = 1] = "Evaluated";
|
|
@@ -37,7 +37,7 @@ const defineRstestDynamicImport = ({ distPath, testPath, assetFiles, interopDefa
|
|
|
37
37
|
} catch (err) {
|
|
38
38
|
logger_logger.error(`load file ${joinedPath} failed:\n`, err instanceof Error ? err.message : err);
|
|
39
39
|
}
|
|
40
|
-
const resolvedPath =
|
|
40
|
+
const resolvedPath = isAbsolute(specifier) ? pathToFileURL(specifier) : import.meta.resolve(specifier, pathToFileURL(testPath));
|
|
41
41
|
const modulePath = 'string' == typeof resolvedPath ? resolvedPath : resolvedPath.pathname;
|
|
42
42
|
if (importAttributes?.with?.rstest) delete importAttributes.with.rstest;
|
|
43
43
|
if (modulePath.endsWith('.json')) {
|
|
@@ -155,4 +155,4 @@ const loadModule = async ({ codeContent, distPath, testPath, assetFiles, interop
|
|
|
155
155
|
return ns.default && ns.default instanceof Promise ? ns.default : ns;
|
|
156
156
|
};
|
|
157
157
|
const clearModuleCache = ()=>esmCache.clear();
|
|
158
|
-
export { asModule, clearModuleCache, loadEsModule_EsmMode, loadModule };
|
|
158
|
+
export { asModule, clearModuleCache, loadEsModule_EsmMode as EsmMode, loadModule };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { isAbsolute } from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
import node_vm from "node:vm";
|
|
6
|
+
import { logger as logger_logger } from "./6830.js";
|
|
7
7
|
import { posix } from "./7011.js";
|
|
8
|
-
|
|
8
|
+
import { interopModule, asModule, shouldInterop } from "./0~interop.js";
|
|
9
9
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
10
|
-
const
|
|
10
|
+
const loadModule_createRequire = (filename, distPath, rstestContext, assetFiles, interopDefault)=>{
|
|
11
11
|
const _require = (()=>{
|
|
12
12
|
try {
|
|
13
|
-
return
|
|
13
|
+
return createRequire(filename);
|
|
14
14
|
} catch (_err) {
|
|
15
|
-
return
|
|
15
|
+
return createRequire(distPath);
|
|
16
16
|
}
|
|
17
17
|
})();
|
|
18
18
|
const require = (id)=>{
|
|
@@ -39,7 +39,7 @@ const createRequire = (filename, distPath, rstestContext, assetFiles, interopDef
|
|
|
39
39
|
return require;
|
|
40
40
|
};
|
|
41
41
|
const defineRstestDynamicImport = ({ testPath, interopDefault, returnModule = false, assetFiles })=>async (specifier, importAttributes)=>{
|
|
42
|
-
const resolvedPath =
|
|
42
|
+
const resolvedPath = isAbsolute(specifier) ? pathToFileURL(specifier) : import.meta.resolve(specifier, pathToFileURL(testPath));
|
|
43
43
|
const modulePath = 'string' == typeof resolvedPath ? resolvedPath : resolvedPath.pathname;
|
|
44
44
|
if (modulePath.endsWith('.wasm')) {
|
|
45
45
|
const normalizedPath = posix.normalize(modulePath.startsWith('file://') ? fileURLToPath(modulePath) : modulePath);
|
|
@@ -108,7 +108,7 @@ const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles
|
|
|
108
108
|
const context = {
|
|
109
109
|
module: localModule,
|
|
110
110
|
exports: localModule.exports,
|
|
111
|
-
require:
|
|
111
|
+
require: loadModule_createRequire(testPath, distPath, rstestContext, assetFiles, interopDefault),
|
|
112
112
|
readWasmFile: (wasmPath, callback)=>{
|
|
113
113
|
const joinedPath = isRelativePath(wasmPath) ? posix.join(posix.dirname(distPath), wasmPath) : wasmPath;
|
|
114
114
|
const content = assetFiles[posix.normalize(joinedPath)];
|