@rstest/core 0.8.1 → 0.8.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~1472.js +1 -1
- package/dist/0~2173.js +64 -25
- package/dist/0~2255.js +1 -1
- package/dist/0~4403.js +3 -2
- package/dist/0~5835.js +1 -1
- package/dist/0~6588.js +1 -1
- package/dist/0~6923.js +1 -1
- package/dist/0~7583.js +2 -2
- package/dist/0~7882.js +7 -578
- package/dist/0~89.js +11 -6
- package/dist/0~9634.js +22 -8
- package/dist/1157.js +49 -5
- package/dist/3160.js +3 -3
- package/dist/487.js +2 -2
- package/dist/6151.js +12 -8
- package/dist/6973.js +1 -1
- package/dist/9131.js +1307 -18
- package/dist/browser-runtime/2~907.js +0 -2
- package/dist/browser-runtime/389.js +13 -11
- package/dist/browser-runtime/index.d.ts +100 -111
- package/dist/browser-runtime/rslib-runtime.js +0 -2
- package/dist/browser.d.ts +156 -110
- package/dist/browser.js +1 -0
- package/dist/index.d.ts +100 -110
- package/dist/worker.d.ts +99 -110
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/browser-runtime/2~907.js.map +0 -1
- package/dist/browser-runtime/389.js.map +0 -1
- package/dist/browser-runtime/rslib-runtime.js.map +0 -1
package/dist/0~1472.js
CHANGED
|
@@ -5,7 +5,7 @@ import { pathToFileURL } from "./6198.js";
|
|
|
5
5
|
import "./1157.js";
|
|
6
6
|
import { logger as logger_logger, color } from "./3160.js";
|
|
7
7
|
async function loadBrowserModule(options = {}) {
|
|
8
|
-
const coreVersion = "0.8.
|
|
8
|
+
const coreVersion = "0.8.2";
|
|
9
9
|
const { projectRoots = [] } = options;
|
|
10
10
|
let browserModule;
|
|
11
11
|
let browserVersion;
|
package/dist/0~2173.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import { getTestEntries } from "./1157.js";
|
|
3
|
+
import { resolveShardedEntries, getTestEntries } from "./1157.js";
|
|
4
4
|
import { createCoverageProvider } from "./5734.js";
|
|
5
5
|
import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
|
|
6
6
|
import { loadBrowserModule } from "./0~1472.js";
|
|
@@ -156,26 +156,35 @@ async function runBrowserModeTests(context, browserProjects, options) {
|
|
|
156
156
|
async function runTests(context) {
|
|
157
157
|
const browserProjects = context.projects.filter((project)=>project.normalizedConfig.browser.enabled);
|
|
158
158
|
const nodeProjects = context.projects.filter((project)=>!project.normalizedConfig.browser.enabled);
|
|
159
|
-
const
|
|
160
|
-
const
|
|
159
|
+
const hasBrowserProjects = browserProjects.length > 0;
|
|
160
|
+
const hasNodeProjects = nodeProjects.length > 0;
|
|
161
161
|
const isWatchMode = 'watch' === context.command;
|
|
162
|
-
const shouldUnifyReporter = !isWatchMode &&
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
162
|
+
const shouldUnifyReporter = !isWatchMode && hasBrowserProjects && hasNodeProjects;
|
|
163
|
+
if (hasBrowserProjects && !hasNodeProjects) {
|
|
164
|
+
const { coverage } = context.normalizedConfig;
|
|
165
|
+
if (coverage.enabled) logger_logger.log(` ${color.gray('Coverage enabled with')} %s\n`, color.yellow(coverage.provider));
|
|
166
|
+
const browserResult = await runBrowserModeTests(context, browserProjects, {
|
|
167
|
+
skipOnTestRunEnd: false
|
|
168
|
+
});
|
|
169
|
+
if (coverage.enabled && browserResult?.results) {
|
|
170
|
+
const coverageProvider = await createCoverageProvider(coverage, context.rootPath);
|
|
171
|
+
if (coverageProvider) {
|
|
172
|
+
const { generateCoverage } = await import("./0~4403.js").then((mod)=>({
|
|
173
|
+
generateCoverage: mod.generateCoverage
|
|
174
|
+
}));
|
|
175
|
+
await generateCoverage(context, browserResult.results, coverageProvider);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
172
178
|
return;
|
|
173
179
|
}
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
const
|
|
180
|
+
let browserResultPromise;
|
|
181
|
+
const allProjects = context.projects;
|
|
182
|
+
const { rootPath, reporters, snapshotManager, command, normalizedConfig } = context;
|
|
183
|
+
const { coverage, shard } = normalizedConfig;
|
|
184
|
+
const entriesCache = await resolveShardedEntries(context) || new Map();
|
|
177
185
|
const globTestSourceEntries = async (name)=>{
|
|
178
|
-
|
|
186
|
+
if (!isWatchMode && shard && entriesCache.has(name)) return entriesCache.get(name).entries;
|
|
187
|
+
const { include, exclude, includeSource, root } = allProjects.find((p)=>p.environmentName === name).normalizedConfig;
|
|
179
188
|
const entries = await getTestEntries({
|
|
180
189
|
include,
|
|
181
190
|
exclude: exclude.patterns,
|
|
@@ -190,6 +199,28 @@ async function runTests(context) {
|
|
|
190
199
|
});
|
|
191
200
|
return entries;
|
|
192
201
|
};
|
|
202
|
+
let browserProjectsToRun = browserProjects;
|
|
203
|
+
let nodeProjectsToRun = nodeProjects;
|
|
204
|
+
if (shard) {
|
|
205
|
+
browserProjectsToRun = browserProjects.filter((p)=>Object.keys(entriesCache.get(p.environmentName)?.entries || {}).length > 0);
|
|
206
|
+
nodeProjectsToRun = nodeProjects.filter((p)=>Object.keys(entriesCache.get(p.environmentName)?.entries || {}).length > 0);
|
|
207
|
+
}
|
|
208
|
+
const hasBrowserTestsToRun = browserProjectsToRun.length > 0;
|
|
209
|
+
const hasNodeTestsToRun = nodeProjectsToRun.length > 0;
|
|
210
|
+
if (hasBrowserTestsToRun) {
|
|
211
|
+
const browserEntries = new Map();
|
|
212
|
+
if (shard) for (const p of browserProjectsToRun)browserEntries.set(p.environmentName, entriesCache.get(p.environmentName));
|
|
213
|
+
browserResultPromise = runBrowserModeTests(context, browserProjectsToRun, {
|
|
214
|
+
skipOnTestRunEnd: shouldUnifyReporter,
|
|
215
|
+
shardedEntries: shard ? browserEntries : void 0
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (!hasNodeTestsToRun) {
|
|
219
|
+
if (browserResultPromise) await browserResultPromise;
|
|
220
|
+
if (hasBrowserTestsToRun) return;
|
|
221
|
+
if (!hasNodeProjects) return;
|
|
222
|
+
}
|
|
223
|
+
const projects = nodeProjectsToRun;
|
|
193
224
|
const { getSetupFiles } = await import("./6973.js").then((mod)=>({
|
|
194
225
|
getSetupFiles: mod.getSetupFiles
|
|
195
226
|
}));
|
|
@@ -214,17 +245,21 @@ async function runTests(context) {
|
|
|
214
245
|
projects: projects.map((p)=>p.normalizedConfig)
|
|
215
246
|
},
|
|
216
247
|
isWatchMode,
|
|
217
|
-
globTestSourceEntries
|
|
218
|
-
if (entriesCache.has(name)) return entriesCache.get(name).entries;
|
|
219
|
-
return globTestSourceEntries(name);
|
|
220
|
-
},
|
|
248
|
+
globTestSourceEntries,
|
|
221
249
|
setupFiles,
|
|
222
250
|
globalSetupFiles,
|
|
223
251
|
rsbuildInstance,
|
|
224
252
|
rootPath
|
|
225
253
|
});
|
|
226
254
|
const entryFiles = Array.from(entriesCache.values()).reduce((acc, entry)=>acc.concat(Object.values(entry.entries) || []), []);
|
|
227
|
-
const
|
|
255
|
+
const getRecommendWorkerCount = ()=>{
|
|
256
|
+
const nodeEntries = Array.from(entriesCache.entries()).filter(([key])=>{
|
|
257
|
+
const project = projects.find((p)=>p.environmentName === key);
|
|
258
|
+
return project?.normalizedConfig.browser.enabled !== true;
|
|
259
|
+
});
|
|
260
|
+
return nodeEntries.flatMap(([_key, entry])=>Object.values(entry.entries) || []).length;
|
|
261
|
+
};
|
|
262
|
+
const recommendWorkerCount = 'watch' === command ? 1 / 0 : getRecommendWorkerCount();
|
|
228
263
|
const pool = await createPool({
|
|
229
264
|
context,
|
|
230
265
|
recommendWorkerCount
|
|
@@ -302,6 +337,8 @@ async function runTests(context) {
|
|
|
302
337
|
const results = returns.flatMap((r)=>r.results);
|
|
303
338
|
const testResults = returns.flatMap((r)=>r.testResults);
|
|
304
339
|
const errors = returns.flatMap((r)=>r.errors || []);
|
|
340
|
+
if (shouldUnifyReporter && browserResult?.results) results.push(...browserResult.results);
|
|
341
|
+
if (shouldUnifyReporter && browserResult?.testResults) testResults.push(...browserResult.testResults);
|
|
305
342
|
context.updateReporterResultState(results, testResults, currentDeletedEntries);
|
|
306
343
|
const nodeHasFailure = results.some((r)=>'fail' === r.status) || errors.length;
|
|
307
344
|
const browserHasFailure = shouldUnifyReporter && browserResult?.hasFailure;
|
|
@@ -310,13 +347,15 @@ async function runTests(context) {
|
|
|
310
347
|
else logger_logger.log(color.yellow('No test files found.'));
|
|
311
348
|
else {
|
|
312
349
|
const code = context.normalizedConfig.passWithNoTests ? 0 : 1;
|
|
313
|
-
|
|
350
|
+
const message = `No test files found, exiting with code ${code}.`;
|
|
351
|
+
if (0 === code) logger_logger.log(color.yellow(message));
|
|
352
|
+
else logger_logger.error(color.red(message));
|
|
314
353
|
process.exitCode = code;
|
|
315
354
|
}
|
|
316
355
|
if ('all' === mode) {
|
|
317
356
|
if (context.fileFilters?.length) logger_logger.log(color.gray('filter: '), context.fileFilters.join(color.gray(', ')));
|
|
318
|
-
|
|
319
|
-
if (
|
|
357
|
+
allProjects.forEach((p)=>{
|
|
358
|
+
if (allProjects.length > 1) {
|
|
320
359
|
logger_logger.log('');
|
|
321
360
|
logger_logger.log(color.gray('project:'), p.name);
|
|
322
361
|
}
|
package/dist/0~2255.js
CHANGED
|
@@ -2,7 +2,7 @@ import 'module';
|
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
4
|
import "./3160.js";
|
|
5
|
-
const external_node_fs_ = __webpack_require__("
|
|
5
|
+
const external_node_fs_ = __webpack_require__("fs");
|
|
6
6
|
const pluginCoverageCore = (coverageOptions)=>({
|
|
7
7
|
name: 'rstest:coverage-core',
|
|
8
8
|
setup: (api)=>{
|
package/dist/0~4403.js
CHANGED
|
@@ -53,12 +53,13 @@ async function generateCoverage(context, results, coverageProvider) {
|
|
|
53
53
|
});
|
|
54
54
|
if (!thresholdResult.success) {
|
|
55
55
|
logger_logger.log('');
|
|
56
|
-
logger_logger.
|
|
56
|
+
logger_logger.stderr(thresholdResult.message);
|
|
57
57
|
process.exitCode = 1;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
} catch (error) {
|
|
61
|
-
logger_logger.
|
|
61
|
+
logger_logger.stderr('Failed to generate coverage reports:', error);
|
|
62
|
+
process.exitCode = 1;
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
async function generateCoverageForUntestedFiles(environmentName, uncoveredFiles, coverageMap, coverageProvider) {
|
package/dist/0~5835.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createRequire as external_node_module_createRequire } from "./4881.js";
|
|
|
6
6
|
import { pathToFileURL } from "./6198.js";
|
|
7
7
|
import { node_vm, asModule, shouldInterop, interopModule } from "./0~3346.js";
|
|
8
8
|
import { posix } from "./7011.js";
|
|
9
|
-
const external_node_path_ = __webpack_require__("
|
|
9
|
+
const external_node_path_ = __webpack_require__("path");
|
|
10
10
|
let latestAssetFiles = {};
|
|
11
11
|
const updateLatestAssetFiles = (assetFiles)=>{
|
|
12
12
|
latestAssetFiles = assetFiles;
|
package/dist/0~6588.js
CHANGED
|
@@ -28,7 +28,7 @@ async function createChokidar(pathOrGlobs, root, options) {
|
|
|
28
28
|
}
|
|
29
29
|
return chokidar.watch(Array.from(watchFiles), options);
|
|
30
30
|
}
|
|
31
|
-
const external_node_path_ = __webpack_require__("
|
|
31
|
+
const external_node_path_ = __webpack_require__("path");
|
|
32
32
|
let cleaners = [];
|
|
33
33
|
const onBeforeRestart = (cleaner)=>{
|
|
34
34
|
cleaners.push(cleaner);
|
package/dist/0~6923.js
CHANGED
|
@@ -5,7 +5,7 @@ import { logger as logger_logger } from "./3160.js";
|
|
|
5
5
|
import { pathToFileURL } from "./6198.js";
|
|
6
6
|
import { node_vm, interopModule, shouldInterop } 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
|
var loadEsModule_EsmMode = /*#__PURE__*/ function(EsmMode) {
|
|
10
10
|
EsmMode[EsmMode["Unknown"] = 0] = "Unknown";
|
|
11
11
|
EsmMode[EsmMode["Evaluated"] = 1] = "Evaluated";
|
package/dist/0~7583.js
CHANGED
|
@@ -7,7 +7,7 @@ import "./3160.js";
|
|
|
7
7
|
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";
|
|
8
8
|
import { Readable } from "./0~1981.js";
|
|
9
9
|
import { EventEmitter } from "./9131.js";
|
|
10
|
-
const external_node_path_ = __webpack_require__("
|
|
10
|
+
const external_node_path_ = __webpack_require__("path");
|
|
11
11
|
const EntryTypes = {
|
|
12
12
|
FILE_TYPE: 'files',
|
|
13
13
|
DIR_TYPE: 'directories',
|
|
@@ -221,7 +221,7 @@ function readdirp(root, options = {}) {
|
|
|
221
221
|
options.root = root;
|
|
222
222
|
return new ReaddirpStream(options);
|
|
223
223
|
}
|
|
224
|
-
const external_node_fs_ = __webpack_require__("
|
|
224
|
+
const external_node_fs_ = __webpack_require__("fs");
|
|
225
225
|
const external_node_os_ = __webpack_require__("node:os");
|
|
226
226
|
const STR_DATA = 'data';
|
|
227
227
|
const STR_END = 'end';
|