@rstest/core 0.9.0 → 0.9.1
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/LICENSE.md +2 -2
- package/dist/0~130.js +0 -1
- package/dist/0~1472.js +1 -1
- package/dist/0~2173.js +20 -3
- package/dist/0~5835.js +18 -5
- package/dist/0~6588.js +1 -1
- package/dist/0~6923.js +11 -3
- package/dist/0~7583.js +3 -3
- package/dist/0~7882.js +18 -18
- package/dist/0~89.js +31 -11
- package/dist/0~9634.js +1 -1
- package/dist/0~9744.js +1014 -0
- package/dist/1157.js +1 -1
- package/dist/1294.js +1 -1
- package/dist/3160.js +16 -21
- package/dist/487.js +1 -1
- package/dist/6151.js +3013 -22
- package/dist/9131.js +154 -91
- package/dist/browser-runtime/389.js +3022 -38
- package/dist/index.d.ts +3 -0
- package/dist/mockRuntimeCode.js +15 -9
- package/dist/worker.js +4 -1
- package/package.json +7 -5
- package/dist/0~1240.js +0 -951
- package/dist/0~1981.js +0 -2
- package/dist/721.js +0 -8
package/LICENSE.md
CHANGED
|
@@ -748,7 +748,7 @@ Licensed under MIT license in the repository at LinusU/buffer-from.
|
|
|
748
748
|
|
|
749
749
|
### cac
|
|
750
750
|
|
|
751
|
-
Licensed under MIT license in the repository at
|
|
751
|
+
Licensed under MIT license in the repository at git+https://github.com/cacjs/cac.git.
|
|
752
752
|
|
|
753
753
|
> The MIT License (MIT)
|
|
754
754
|
>
|
|
@@ -1209,7 +1209,7 @@ Licensed under MIT license in the repository at git://github.com/paulmillr/readd
|
|
|
1209
1209
|
|
|
1210
1210
|
### rslog
|
|
1211
1211
|
|
|
1212
|
-
Licensed under MIT license in the repository at https://github.com/
|
|
1212
|
+
Licensed under MIT license in the repository at https://github.com/rstackjs/rslog.git.
|
|
1213
1213
|
|
|
1214
1214
|
> MIT License
|
|
1215
1215
|
>
|
package/dist/0~130.js
CHANGED
|
@@ -2,7 +2,6 @@ import "node:module";
|
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
3
|
import { AssertionError, strict } from "node:assert";
|
|
4
4
|
import { Console } from "node:console";
|
|
5
|
-
import "./721.js";
|
|
6
5
|
import { prettyTime, color } from "./3160.js";
|
|
7
6
|
const external_node_util_ = __webpack_require__("node:util");
|
|
8
7
|
const RealDate = Date;
|
package/dist/0~1472.js
CHANGED
|
@@ -4,7 +4,7 @@ import { pathToFileURL } from "./6198.js";
|
|
|
4
4
|
import "./1157.js";
|
|
5
5
|
import { logger as logger_logger, color } from "./3160.js";
|
|
6
6
|
async function loadBrowserModule(options = {}) {
|
|
7
|
-
const coreVersion = "0.9.
|
|
7
|
+
const coreVersion = "0.9.1";
|
|
8
8
|
const { projectRoots = [] } = options;
|
|
9
9
|
let browserModule;
|
|
10
10
|
let browserVersion;
|
package/dist/0~2173.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
+
import { logger as logger_logger, isTTY, color, clearScreen } from "./3160.js";
|
|
2
4
|
import { resolveShardedEntries, getTestEntries } from "./1157.js";
|
|
3
5
|
import { createCoverageProvider } from "./5734.js";
|
|
4
6
|
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
|
|
5
7
|
import { loadBrowserModule } from "./0~1472.js";
|
|
6
|
-
import { logger as logger_logger, isTTY, color, clearScreen } from "./3160.js";
|
|
7
8
|
const isCliShortcutsEnabled = ()=>isTTY('stdin');
|
|
8
9
|
async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFailedTests, runWithTestNamePattern, runWithFileFilters }) {
|
|
9
10
|
const { createInterface, emitKeypressEvents } = await import("node:readline");
|
|
@@ -32,6 +33,10 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
32
33
|
const onPromptKey = async (str, key)=>{
|
|
33
34
|
if (!isPrompting) return;
|
|
34
35
|
if (key.ctrl && 'c' === key.name) return void process.kill(process.pid, 'SIGINT');
|
|
36
|
+
if (key.ctrl && 'z' === key.name) {
|
|
37
|
+
if ('win32' !== process.platform) process.kill(process.pid, 'SIGTSTP');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
35
40
|
if ('return' === key.name || 'enter' === key.name) {
|
|
36
41
|
process.stdin.off('keypress', onPromptKey);
|
|
37
42
|
process.stdout.write('\n');
|
|
@@ -123,6 +128,10 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
123
128
|
const handleKeypress = (str, key)=>{
|
|
124
129
|
if (isPrompting) return;
|
|
125
130
|
if (key.ctrl && 'c' === key.name) return void process.kill(process.pid, 'SIGINT');
|
|
131
|
+
if (key.ctrl && 'z' === key.name) {
|
|
132
|
+
if ('win32' !== process.platform) process.kill(process.pid, 'SIGTSTP');
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
126
135
|
for (const shortcut of shortcuts)if (str === shortcut.key) {
|
|
127
136
|
clearCurrentInputLine();
|
|
128
137
|
shortcut.action();
|
|
@@ -145,6 +154,7 @@ async function setupCliShortcuts({ closeServer, runAll, updateSnapshot, runFaile
|
|
|
145
154
|
rl.close();
|
|
146
155
|
};
|
|
147
156
|
}
|
|
157
|
+
const external_node_os_ = __webpack_require__("node:os");
|
|
148
158
|
async function runBrowserModeTests(context, browserProjects, options) {
|
|
149
159
|
const projectRoots = browserProjects.map((p)=>p.rootPath);
|
|
150
160
|
const { validateBrowserConfig, runBrowserTests } = await loadBrowserModule({
|
|
@@ -153,6 +163,10 @@ async function runBrowserModeTests(context, browserProjects, options) {
|
|
|
153
163
|
validateBrowserConfig(context);
|
|
154
164
|
return runBrowserTests(context, options);
|
|
155
165
|
}
|
|
166
|
+
const getSignalExitCode = (signal)=>{
|
|
167
|
+
const signalNumber = external_node_os_.constants.signals[signal];
|
|
168
|
+
return 'number' == typeof signalNumber ? 128 + signalNumber : 1;
|
|
169
|
+
};
|
|
156
170
|
async function runTests(context) {
|
|
157
171
|
const browserProjects = context.projects.filter((project)=>project.normalizedConfig.browser.enabled);
|
|
158
172
|
const nodeProjects = context.projects.filter((project)=>!project.normalizedConfig.browser.enabled);
|
|
@@ -425,10 +439,11 @@ async function runTests(context) {
|
|
|
425
439
|
const handleSignal = async (signal)=>{
|
|
426
440
|
logger_logger.log(color.yellow(`\nReceived ${signal}, cleaning up...`));
|
|
427
441
|
await cleanup();
|
|
428
|
-
process.exit(
|
|
442
|
+
process.exit(getSignalExitCode(signal));
|
|
429
443
|
};
|
|
430
444
|
process.on('SIGINT', handleSignal);
|
|
431
445
|
process.on('SIGTERM', handleSignal);
|
|
446
|
+
process.on('SIGTSTP', handleSignal);
|
|
432
447
|
const afterTestsWatchRun = ()=>{
|
|
433
448
|
logger_logger.log(color.green(' Waiting for file changes...'));
|
|
434
449
|
if (enableCliShortcuts) if (snapshotManager.summary.unmatched) logger_logger.log(` ${color.dim('press')} ${color.yellow(color.bold('u'))} ${color.dim('to update snapshot')}${color.dim(', press')} ${color.bold('h')} ${color.dim('to show help')}\n`);
|
|
@@ -548,11 +563,12 @@ async function runTests(context) {
|
|
|
548
563
|
const handleSignal = async (signal)=>{
|
|
549
564
|
logger_logger.log(color.yellow(`\nReceived ${signal}, cleaning up...`));
|
|
550
565
|
await cleanup();
|
|
551
|
-
process.exit(
|
|
566
|
+
process.exit(getSignalExitCode(signal));
|
|
552
567
|
};
|
|
553
568
|
process.on('exit', unExpectedExit);
|
|
554
569
|
process.on('SIGINT', handleSignal);
|
|
555
570
|
process.on('SIGTERM', handleSignal);
|
|
571
|
+
process.on('SIGTSTP', handleSignal);
|
|
556
572
|
try {
|
|
557
573
|
await run();
|
|
558
574
|
isTeardown = true;
|
|
@@ -563,6 +579,7 @@ async function runTests(context) {
|
|
|
563
579
|
process.off('exit', unExpectedExit);
|
|
564
580
|
process.off('SIGINT', handleSignal);
|
|
565
581
|
process.off('SIGTERM', handleSignal);
|
|
582
|
+
process.off('SIGTSTP', handleSignal);
|
|
566
583
|
}
|
|
567
584
|
}
|
|
568
585
|
}
|
package/dist/0~5835.js
CHANGED
|
@@ -2,10 +2,10 @@ import "node:module";
|
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
3
|
import { logger as logger_logger } from "./3160.js";
|
|
4
4
|
import { createRequire as external_node_module_createRequire } from "./4881.js";
|
|
5
|
-
import { pathToFileURL } from "./6198.js";
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from "./6198.js";
|
|
6
6
|
import { node_vm, asModule, shouldInterop, interopModule } from "./0~3346.js";
|
|
7
7
|
import { posix } from "./7011.js";
|
|
8
|
-
const external_node_path_ = __webpack_require__("
|
|
8
|
+
const external_node_path_ = __webpack_require__("path");
|
|
9
9
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
10
10
|
const createRequire = (filename, distPath, rstestContext, assetFiles, interopDefault)=>{
|
|
11
11
|
const _require = (()=>{
|
|
@@ -38,9 +38,20 @@ const createRequire = (filename, distPath, rstestContext, assetFiles, interopDef
|
|
|
38
38
|
require.main = _require.main;
|
|
39
39
|
return require;
|
|
40
40
|
};
|
|
41
|
-
const defineRstestDynamicImport = ({ testPath, interopDefault, returnModule = false })=>async (specifier, importAttributes)=>{
|
|
41
|
+
const defineRstestDynamicImport = ({ testPath, interopDefault, returnModule = false, assetFiles })=>async (specifier, importAttributes)=>{
|
|
42
42
|
const resolvedPath = (0, external_node_path_.isAbsolute)(specifier) ? pathToFileURL(specifier) : import.meta.resolve(specifier, pathToFileURL(testPath));
|
|
43
43
|
const modulePath = 'string' == typeof resolvedPath ? resolvedPath : resolvedPath.pathname;
|
|
44
|
+
if (modulePath.endsWith('.wasm')) {
|
|
45
|
+
const normalizedPath = posix.normalize(modulePath.startsWith('file://') ? fileURLToPath(modulePath) : modulePath);
|
|
46
|
+
const content = assetFiles[normalizedPath];
|
|
47
|
+
if (content) {
|
|
48
|
+
const wasmBuffer = Buffer.from(content, 'base64');
|
|
49
|
+
const wasmModule = await WebAssembly.compile(wasmBuffer);
|
|
50
|
+
const wasmInstance = await WebAssembly.instantiate(wasmModule);
|
|
51
|
+
const exports = wasmInstance.exports;
|
|
52
|
+
return returnModule ? asModule(exports, exports) : exports;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
44
55
|
if (importAttributes?.with?.rstest) delete importAttributes.with.rstest;
|
|
45
56
|
if (modulePath.endsWith('.json')) {
|
|
46
57
|
const importedModule = await import(modulePath, {
|
|
@@ -106,7 +117,8 @@ const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles
|
|
|
106
117
|
},
|
|
107
118
|
__rstest_dynamic_import__: defineRstestDynamicImport({
|
|
108
119
|
testPath,
|
|
109
|
-
interopDefault
|
|
120
|
+
interopDefault,
|
|
121
|
+
assetFiles
|
|
110
122
|
}),
|
|
111
123
|
__dirname: fileDir,
|
|
112
124
|
__filename: testPath,
|
|
@@ -121,7 +133,8 @@ const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles
|
|
|
121
133
|
importModuleDynamically: (specifier, _referencer, importAttributes)=>defineRstestDynamicImport({
|
|
122
134
|
testPath,
|
|
123
135
|
interopDefault,
|
|
124
|
-
returnModule: true
|
|
136
|
+
returnModule: true,
|
|
137
|
+
assetFiles
|
|
125
138
|
})(specifier, importAttributes)
|
|
126
139
|
});
|
|
127
140
|
fn(...Object.values(context));
|
package/dist/0~6588.js
CHANGED
|
@@ -27,7 +27,7 @@ async function createChokidar(pathOrGlobs, root, options) {
|
|
|
27
27
|
}
|
|
28
28
|
return chokidar.watch(Array.from(watchFiles), options);
|
|
29
29
|
}
|
|
30
|
-
const external_node_path_ = __webpack_require__("
|
|
30
|
+
const external_node_path_ = __webpack_require__("path");
|
|
31
31
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
32
32
|
let cleaners = [];
|
|
33
33
|
const onBeforeRestart = (cleaner)=>{
|
package/dist/0~6923.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
3
|
import { logger as logger_logger } from "./3160.js";
|
|
4
|
-
import { pathToFileURL } from "./6198.js";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "./6198.js";
|
|
5
5
|
import { node_vm, interopModule, shouldInterop } from "./0~3346.js";
|
|
6
6
|
import { posix } from "./7011.js";
|
|
7
|
-
const external_node_path_ = __webpack_require__("
|
|
7
|
+
const external_node_path_ = __webpack_require__("path");
|
|
8
8
|
var loadEsModule_EsmMode = /*#__PURE__*/ function(EsmMode) {
|
|
9
9
|
EsmMode[EsmMode["Unknown"] = 0] = "Unknown";
|
|
10
10
|
EsmMode[EsmMode["Evaluated"] = 1] = "Evaluated";
|
|
@@ -15,8 +15,16 @@ const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
|
15
15
|
const defineRstestDynamicImport = ({ distPath, testPath, assetFiles, interopDefault, returnModule, esmMode })=>async (specifier, importAttributes)=>{
|
|
16
16
|
const currentDirectory = posix.dirname(distPath);
|
|
17
17
|
const joinedPath = isRelativePath(specifier) ? posix.join(currentDirectory, specifier) : specifier;
|
|
18
|
-
const
|
|
18
|
+
const normalizedPath = posix.normalize(joinedPath.startsWith('file://') ? fileURLToPath(joinedPath) : joinedPath);
|
|
19
|
+
const content = assetFiles[normalizedPath];
|
|
19
20
|
if (content) try {
|
|
21
|
+
if (specifier.endsWith('.wasm')) {
|
|
22
|
+
const wasmBuffer = Buffer.from(content, 'base64');
|
|
23
|
+
const wasmModule = await WebAssembly.compile(wasmBuffer);
|
|
24
|
+
const wasmInstance = await WebAssembly.instantiate(wasmModule);
|
|
25
|
+
const exports = wasmInstance.exports;
|
|
26
|
+
return returnModule ? await asModule(exports) : exports;
|
|
27
|
+
}
|
|
20
28
|
return await loadModule({
|
|
21
29
|
codeContent: content,
|
|
22
30
|
testPath,
|
package/dist/0~7583.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import "node:module";
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
4
|
import { lstat, open as promises_open, readdir, realpath as promises_realpath, stat as promises_stat } from "fs/promises";
|
|
5
|
+
import { EventEmitter } from "events";
|
|
6
|
+
import { Readable } from "node:stream";
|
|
5
7
|
import "./3160.js";
|
|
6
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";
|
|
7
|
-
|
|
8
|
-
import { EventEmitter } from "./9131.js";
|
|
9
|
-
const external_node_path_ = __webpack_require__("node:path");
|
|
9
|
+
const external_node_path_ = __webpack_require__("path");
|
|
10
10
|
const EntryTypes = {
|
|
11
11
|
FILE_TYPE: 'files',
|
|
12
12
|
DIR_TYPE: 'directories',
|
package/dist/0~7882.js
CHANGED
|
@@ -2,10 +2,10 @@ import "node:module";
|
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
3
|
import { determineAgent, color } from "./3160.js";
|
|
4
4
|
import { detect, resolveCommand } from "./9131.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Rt, dist_Wt, dist_Vt, R, Jt, be, Nt, Ct, Gt } from "./0~9744.js";
|
|
6
6
|
import "./1157.js";
|
|
7
7
|
const external_node_fs_ = __webpack_require__("node:fs");
|
|
8
|
-
const external_node_path_ = __webpack_require__("
|
|
8
|
+
const external_node_path_ = __webpack_require__("path");
|
|
9
9
|
function getUniqueBaseName(dir, baseName, ext) {
|
|
10
10
|
const fullPath = external_node_path_["default"].join(dir, `${baseName}${ext}`);
|
|
11
11
|
if (!external_node_fs_["default"].existsSync(fullPath)) return baseName;
|
|
@@ -348,16 +348,16 @@ async function createNonInteractive(cwd, projectInfo) {
|
|
|
348
348
|
async function createInteractive(cwd, projectInfo, isAgent) {
|
|
349
349
|
const { agent, language, testDir, framework, reactVersion } = projectInfo;
|
|
350
350
|
const effectiveFramework = 'react' === framework ? 'react' : 'vanilla';
|
|
351
|
-
|
|
351
|
+
dist_Wt(color.bgCyan(color.black(' rstest init browser ')));
|
|
352
352
|
const detectionLines = [];
|
|
353
353
|
if ('react' === framework && reactVersion) detectionLines.push(`${color.green('✓')} Found React ${reactVersion}`);
|
|
354
354
|
else if ('react' === framework) detectionLines.push(`${color.green('✓')} Found React`);
|
|
355
355
|
else detectionLines.push(`${color.yellow('⚠')} Framework not detected, will generate vanilla DOM example`);
|
|
356
356
|
detectionLines.push(`${color.green('✓')} Found ${'ts' === language ? 'TypeScript' : 'JavaScript'}`);
|
|
357
357
|
detectionLines.push(`${color.green('✓')} Test directory: ${testDir}/`);
|
|
358
|
-
|
|
359
|
-
if (isAgent)
|
|
360
|
-
const providerSelection = await
|
|
358
|
+
dist_Vt(detectionLines.join('\n'), 'Detecting project...');
|
|
359
|
+
if (isAgent) R.info(`AI Agent detected. For non-interactive mode, run:\n ${color.cyan('npx rstest init browser --yes')}`);
|
|
360
|
+
const providerSelection = await Jt({
|
|
361
361
|
message: 'Choose a browser provider (so far, only Playwright)',
|
|
362
362
|
options: [
|
|
363
363
|
{
|
|
@@ -367,13 +367,13 @@ async function createInteractive(cwd, projectInfo, isAgent) {
|
|
|
367
367
|
}
|
|
368
368
|
]
|
|
369
369
|
});
|
|
370
|
-
if (
|
|
371
|
-
|
|
370
|
+
if (Ct(providerSelection)) {
|
|
371
|
+
Nt('Operation cancelled.');
|
|
372
372
|
process.exit(0);
|
|
373
373
|
}
|
|
374
374
|
const provider = providerSelection;
|
|
375
375
|
const preview = computeFilePreview(cwd, projectInfo);
|
|
376
|
-
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.
|
|
376
|
+
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.1");
|
|
377
377
|
const depsList = Object.entries(deps).map(([name, version])=>`${name}@${version}`).join(', ');
|
|
378
378
|
const previewLines = [
|
|
379
379
|
`${color.cyan('+')} Create ${preview.configFile}`,
|
|
@@ -383,22 +383,22 @@ async function createInteractive(cwd, projectInfo, isAgent) {
|
|
|
383
383
|
' - Add "test:browser" script',
|
|
384
384
|
` - Add devDependencies: ${color.dim(depsList)}`
|
|
385
385
|
];
|
|
386
|
-
|
|
387
|
-
const confirmed = await
|
|
386
|
+
dist_Vt(previewLines.join('\n'), 'Changes to be made');
|
|
387
|
+
const confirmed = await Rt({
|
|
388
388
|
message: 'Proceed with these changes?',
|
|
389
389
|
initialValue: true
|
|
390
390
|
});
|
|
391
|
-
if (
|
|
392
|
-
|
|
391
|
+
if (Ct(confirmed) || !confirmed) {
|
|
392
|
+
Nt('Operation cancelled.');
|
|
393
393
|
process.exit(0);
|
|
394
394
|
}
|
|
395
|
-
const s =
|
|
395
|
+
const s = be();
|
|
396
396
|
s.start('Creating files...');
|
|
397
397
|
const createdFiles = await generateFiles(cwd, projectInfo, provider);
|
|
398
398
|
s.stop('Created files');
|
|
399
399
|
const fileLines = createdFiles.map((f)=>`${color.green('✓')} Created ${f}`);
|
|
400
400
|
fileLines.push(`${color.green('✓')} Updated package.json`);
|
|
401
|
-
|
|
401
|
+
dist_Vt(fileLines.join('\n'), 'Files');
|
|
402
402
|
const nextStepsLines = [
|
|
403
403
|
`${color.bold('1.')} Install dependencies:`,
|
|
404
404
|
` ${color.cyan(getInstallCommand(agent))}`,
|
|
@@ -409,8 +409,8 @@ async function createInteractive(cwd, projectInfo, isAgent) {
|
|
|
409
409
|
`${color.bold('3.')} Run your tests:`,
|
|
410
410
|
` ${color.cyan(getRunCommand(agent))}`
|
|
411
411
|
];
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
dist_Vt(nextStepsLines.join('\n'), 'Next steps');
|
|
413
|
+
Gt(color.green('Done! Happy testing with Rstest!'));
|
|
414
414
|
}
|
|
415
415
|
async function generateFiles(cwd, projectInfo, provider) {
|
|
416
416
|
const { language, testDir, framework } = projectInfo;
|
|
@@ -451,7 +451,7 @@ async function generateFiles(cwd, projectInfo, provider) {
|
|
|
451
451
|
updatePackageJsonScripts(cwd, {
|
|
452
452
|
'test:browser': 'rstest --config=rstest.browser.config.ts'
|
|
453
453
|
});
|
|
454
|
-
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.
|
|
454
|
+
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.1");
|
|
455
455
|
updatePackageJsonDevDeps(cwd, deps);
|
|
456
456
|
return createdFiles;
|
|
457
457
|
}
|
package/dist/0~89.js
CHANGED
|
@@ -601,7 +601,7 @@ async function runGlobalTeardown() {
|
|
|
601
601
|
process.exitCode = 1;
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
|
-
const external_node_path_ = __webpack_require__("
|
|
604
|
+
const external_node_path_ = __webpack_require__("path");
|
|
605
605
|
const RUNTIME_CHUNK_NAME = 'runtime';
|
|
606
606
|
const requireShim = `// Rstest ESM shims
|
|
607
607
|
import __rstest_shim_module__ from 'node:module';
|
|
@@ -618,6 +618,7 @@ const pluginBasic = (context)=>({
|
|
|
618
618
|
});
|
|
619
619
|
api.modifyEnvironmentConfig((config, { mergeEnvironmentConfig, name })=>{
|
|
620
620
|
const { normalizedConfig: { resolve, source, output, tools, dev, testEnvironment }, outputModule, rootPath } = context.projects.find((p)=>p.environmentName === name);
|
|
621
|
+
const distRootDir = context.projects.length > 1 ? `${TEMP_RSTEST_OUTPUT_DIR}/${name}` : TEMP_RSTEST_OUTPUT_DIR;
|
|
621
622
|
return mergeEnvironmentConfig(config, {
|
|
622
623
|
tools,
|
|
623
624
|
resolve,
|
|
@@ -632,6 +633,7 @@ const pluginBasic = (context)=>({
|
|
|
632
633
|
}
|
|
633
634
|
},
|
|
634
635
|
output: {
|
|
636
|
+
assetPrefix: '',
|
|
635
637
|
manifest: `${name}-manifest.json`,
|
|
636
638
|
sourceMap: {
|
|
637
639
|
js: 'source-map'
|
|
@@ -641,7 +643,7 @@ const pluginBasic = (context)=>({
|
|
|
641
643
|
js: '[name].mjs'
|
|
642
644
|
} : void 0,
|
|
643
645
|
distPath: {
|
|
644
|
-
root:
|
|
646
|
+
root: distRootDir
|
|
645
647
|
}
|
|
646
648
|
},
|
|
647
649
|
tools: {
|
|
@@ -727,19 +729,37 @@ const pluginCSSFilter = ()=>({
|
|
|
727
729
|
const emitCss = environment.config.output.emitCss ?? 'web' === target;
|
|
728
730
|
if (!emitCss) {
|
|
729
731
|
const ruleIds = [
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
732
|
+
[
|
|
733
|
+
CHAIN_ID.RULE.CSS,
|
|
734
|
+
CHAIN_ID.ONE_OF.CSS_MAIN
|
|
735
|
+
],
|
|
736
|
+
[
|
|
737
|
+
CHAIN_ID.RULE.SASS,
|
|
738
|
+
'sass'
|
|
739
|
+
],
|
|
740
|
+
[
|
|
741
|
+
CHAIN_ID.RULE.LESS,
|
|
742
|
+
'less'
|
|
743
|
+
],
|
|
744
|
+
[
|
|
745
|
+
CHAIN_ID.RULE.STYLUS,
|
|
746
|
+
'stylus'
|
|
747
|
+
]
|
|
734
748
|
];
|
|
735
|
-
for (const ruleId of ruleIds){
|
|
749
|
+
for (const [ruleId, mainId] of ruleIds){
|
|
736
750
|
if (!chain.module.rules.has(ruleId)) continue;
|
|
737
|
-
const rule = chain.module.rule(ruleId).oneOf(
|
|
751
|
+
const rule = chain.module.rule(ruleId).oneOf(mainId);
|
|
738
752
|
if (!rule.uses.has(CHAIN_ID.USE.CSS)) continue;
|
|
739
753
|
const cssLoaderOptions = rule.use(CHAIN_ID.USE.CSS).get('options');
|
|
740
|
-
if (cssLoaderOptions.modules
|
|
754
|
+
if (!cssLoaderOptions.modules || 'object' == typeof cssLoaderOptions.modules && false === cssLoaderOptions.modules.auto) continue;
|
|
755
|
+
const clonedOptions = {
|
|
756
|
+
...cssLoaderOptions,
|
|
757
|
+
importLoaders: (cssLoaderOptions.importLoaders || 0) + 1
|
|
758
|
+
};
|
|
759
|
+
rule.use(CHAIN_ID.USE.CSS).options(clonedOptions);
|
|
760
|
+
rule.use('rstest-css-pre-filter').loader(external_node_path_["default"].join(css_filter_dirname, 'cssFilterLoader.mjs')).options({
|
|
741
761
|
modules: cssLoaderOptions.modules
|
|
742
|
-
}).after(
|
|
762
|
+
}).after(mainId);
|
|
743
763
|
}
|
|
744
764
|
}
|
|
745
765
|
}
|
|
@@ -1200,7 +1220,7 @@ const createRsbuildServer = async ({ globTestSourceEntries, setupFiles, globalSe
|
|
|
1200
1220
|
const entries = Object.keys(manifest.entries);
|
|
1201
1221
|
for (const entry of entries){
|
|
1202
1222
|
const data = manifest.entries[entry];
|
|
1203
|
-
entryFiles[entry] = ((data?.initial?.js || []).concat(data?.async?.js || []) || []).map((file)=>posix.join(outputPath, file));
|
|
1223
|
+
entryFiles[entry] = ((data?.initial?.js || []).concat(data?.async?.js || []).concat(data?.assets?.filter((asset)=>!asset.endsWith('.map')) || []) || []).map((file)=>file.startsWith(outputPath) ? file : posix.join(outputPath, file));
|
|
1204
1224
|
}
|
|
1205
1225
|
return entryFiles;
|
|
1206
1226
|
};
|
package/dist/0~9634.js
CHANGED
|
@@ -4,7 +4,7 @@ import { logger as logger_logger, getTaskNameWithPrefix, color, bgColor } from "
|
|
|
4
4
|
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
|
|
5
5
|
import { getTestEntries, resolveShardedEntries, prettyTestPath, ROOT_SUITE_NAME } from "./1157.js";
|
|
6
6
|
const external_node_fs_ = __webpack_require__("node:fs");
|
|
7
|
-
const external_node_path_ = __webpack_require__("
|
|
7
|
+
const external_node_path_ = __webpack_require__("path");
|
|
8
8
|
const collectNodeTests = async ({ context, nodeProjects, globTestSourceEntries })=>{
|
|
9
9
|
const { getSetupFiles } = await import("./6973.js").then((mod)=>({
|
|
10
10
|
getSetupFiles: mod.getSetupFiles
|