@rstest/core 0.9.5 → 0.9.6

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/1255.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "node:module";
2
- import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
3
- import * as __rspack_external_node_path_c5b9b54f from "node:path";
4
- import { __webpack_require__ } from "./rslib-runtime.js";
2
+ import { __webpack_require__ } from "./0~rslib-runtime.js";
3
+ import { createRequire as __rspack_createRequire } from "node:module";
4
+ const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
5
5
  __webpack_require__.add({
6
6
  "../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js" (module) {
7
7
  var toString = Object.prototype.toString;
@@ -36,10 +36,10 @@ __webpack_require__.add({
36
36
  "../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js" (module, exports, __webpack_require__) {
37
37
  module = __webpack_require__.nmd(module);
38
38
  var SourceMapConsumer = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js").YK;
39
- var path = __webpack_require__("path?7a8d");
39
+ var path = __webpack_require__("path?37f5");
40
40
  var fs;
41
41
  try {
42
- fs = __webpack_require__("fs?6bb1");
42
+ fs = __webpack_require__("fs?cdbd");
43
43
  if (!fs.existsSync || !fs.readFileSync) fs = null;
44
44
  } catch (err) {}
45
45
  var bufferFrom = __webpack_require__("../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js");
@@ -741,7 +741,7 @@ __webpack_require__.add({
741
741
  }
742
742
  return mappings;
743
743
  };
744
- exports.SourceMapConsumer = SourceMapConsumer;
744
+ exports.YK = SourceMapConsumer;
745
745
  function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
746
746
  var sourceMap = aSourceMap;
747
747
  if ('string' == typeof aSourceMap) sourceMap = util.parseSourceMapInput(aSourceMap);
@@ -1729,14 +1729,14 @@ __webpack_require__.add({
1729
1729
  },
1730
1730
  "../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js" (__unused_rspack_module, exports, __webpack_require__) {
1731
1731
  __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-generator.js").x;
1732
- exports.YK = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-consumer.js").SourceMapConsumer;
1732
+ exports.YK = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-consumer.js").YK;
1733
1733
  __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-node.js");
1734
1734
  },
1735
- "fs?6bb1" (module) {
1736
- module.exports = __rspack_external_node_fs_5ea92f0c;
1735
+ "fs?cdbd" (module) {
1736
+ module.exports = __rspack_createRequire_require("fs");
1737
1737
  },
1738
- "path?7a8d" (module) {
1739
- module.exports = __rspack_external_node_path_c5b9b54f;
1738
+ "path?37f5" (module) {
1739
+ module.exports = __rspack_createRequire_require("path");
1740
1740
  }
1741
1741
  });
1742
1742
  const gracefulExit = process.execArgv.some((execArg)=>execArg.startsWith('--perf') || execArg.startsWith('--prof') || execArg.startsWith('--cpu-prof') || execArg.startsWith('--heap-prof') || execArg.startsWith('--diagnostic-dir'));
package/dist/3145.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- import { __webpack_require__ } from "./rslib-runtime.js";
3
2
  import node_fs, { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
4
3
  import { loadConfig, mergeRsbuildConfig } from "@rsbuild/core";
5
4
  import { stripVTControlCharacters } from "node:util";
@@ -7,6 +6,7 @@ import promises from "node:fs/promises";
7
6
  import node_path, { dirname as external_node_path_dirname, resolve as external_node_path_resolve } from "node:path";
8
7
  import { createRequire } from "node:module";
9
8
  import node_process from "node:process";
9
+ import { __webpack_require__ } from "./0~rslib-runtime.js";
10
10
  import { POINTER, DEFAULT_CONFIG_NAME, globalApis, resolve as pathe_M_eThtNZ_resolve, relative, join, logger as logger_logger, prettyTime, getTempRstestOutputDirGlob, color as logger_color, isAbsolute, getOutputDistPathRoot, TEMP_RSTEST_OUTPUT_DIR, TS_CONFIG_FILE, basename, isTTY, dirname as pathe_M_eThtNZ_dirname, TEST_DELIMITER, getAbsolutePath, bgColor, formatRootStr, determineAgent, castArray, dist_m, getTaskNameWithPrefix, isDebug, formatError, normalize, DEFAULT_CONFIG_EXTENSIONS } from "./6830.js";
11
11
  import { isDynamicPattern, glob, filterProjects, prettyTestPath, formatTestPath } from "./4411.js";
12
12
  import { posix } from "./7011.js";
@@ -588,7 +588,7 @@ function prepareCli() {
588
588
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger_logger.log();
589
589
  }
590
590
  function showRstest() {
591
- logger_logger.greet(" Rstest v0.9.5");
591
+ logger_logger.greet(" Rstest v0.9.6");
592
592
  logger_logger.log('');
593
593
  }
594
594
  const runtimeOptionDefinitions = [
@@ -900,7 +900,7 @@ function createCli() {
900
900
  return sections;
901
901
  }
902
902
  });
903
- cli.version("0.9.5");
903
+ cli.version("0.9.6");
904
904
  const defaultCommand = cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode');
905
905
  applyRuntimeCommandOptions(defaultCommand);
906
906
  defaultCommand.action(async (filters, options)=>{
@@ -986,7 +986,7 @@ function createCli() {
986
986
  try {
987
987
  let selectedProject = project;
988
988
  if (!selectedProject) {
989
- const { select, isCancel } = await import("./0~dist.js");
989
+ const { select, isCancel } = await import("./0~@clack/prompts.js");
990
990
  console.log();
991
991
  const selected = await select({
992
992
  message: 'What would you like to initialize?',
@@ -1903,7 +1903,7 @@ class BlobReporter {
1903
1903
  const shard = this.config.shard;
1904
1904
  const fileName = shard ? `blob-${shard.index}-${shard.count}.json` : 'blob.json';
1905
1905
  const blobData = {
1906
- version: "0.9.5",
1906
+ version: "0.9.6",
1907
1907
  shard: shard ? {
1908
1908
  index: shard.index,
1909
1909
  count: shard.count
@@ -1977,6 +1977,95 @@ class GithubActionsReporter {
1977
1977
  function escapeData(s) {
1978
1978
  return s.replace(/%/g, '%25').replace(/\r/g, '%0D').replace(/\n/g, '%0A').replace(/:/g, '%3A').replace(/,/g, '%2C');
1979
1979
  }
1980
+ class JsonReporter {
1981
+ config;
1982
+ rootPath;
1983
+ outputPath;
1984
+ consoleLogs = [];
1985
+ constructor({ config, rootPath, options }){
1986
+ this.config = config;
1987
+ this.rootPath = rootPath;
1988
+ this.outputPath = options?.outputPath;
1989
+ }
1990
+ onUserConsoleLog(log) {
1991
+ this.consoleLogs.push(log);
1992
+ }
1993
+ normalizeTest(test) {
1994
+ return {
1995
+ ...test,
1996
+ testPath: relative(this.rootPath, test.testPath),
1997
+ fullName: getTaskNameWithPrefix(test)
1998
+ };
1999
+ }
2000
+ createReport({ results, testResults, duration, snapshotSummary, unhandledErrors }) {
2001
+ const failedTests = testResults.filter((result)=>'fail' === result.status);
2002
+ const passedTests = testResults.filter((result)=>'pass' === result.status);
2003
+ const skippedTests = testResults.filter((result)=>'skip' === result.status);
2004
+ const todoTests = testResults.filter((result)=>'todo' === result.status);
2005
+ const failedFiles = results.filter((result)=>'fail' === result.status);
2006
+ const noTestsDiscovered = 0 === results.length && 0 === testResults.length;
2007
+ const hasFailedStatus = failedTests.length > 0 || failedFiles.length > 0 || (unhandledErrors?.length ?? 0) > 0 || noTestsDiscovered && !this.config.passWithNoTests;
2008
+ return {
2009
+ tool: 'rstest',
2010
+ version: "0.9.6",
2011
+ status: hasFailedStatus ? 'fail' : 'pass',
2012
+ summary: {
2013
+ testFiles: results.length,
2014
+ failedFiles: failedFiles.length,
2015
+ tests: testResults.length,
2016
+ failedTests: failedTests.length,
2017
+ passedTests: passedTests.length,
2018
+ skippedTests: skippedTests.length,
2019
+ todoTests: todoTests.length
2020
+ },
2021
+ durationMs: {
2022
+ total: duration.totalTime,
2023
+ build: duration.buildTime,
2024
+ tests: duration.testTime
2025
+ },
2026
+ snapshot: snapshotSummary,
2027
+ files: results.map((fileResult)=>({
2028
+ ...fileResult,
2029
+ testPath: relative(this.rootPath, fileResult.testPath),
2030
+ fullName: getTaskNameWithPrefix(fileResult),
2031
+ results: fileResult.results.map((test)=>this.normalizeTest(test))
2032
+ })),
2033
+ tests: testResults.map((test)=>this.normalizeTest(test)),
2034
+ consoleLogs: this.consoleLogs.length > 0 ? this.consoleLogs.map((log)=>({
2035
+ ...log,
2036
+ testPath: relative(this.rootPath, log.testPath)
2037
+ })) : void 0,
2038
+ unhandledErrors: unhandledErrors?.map((error)=>({
2039
+ message: error.message,
2040
+ stack: error.stack,
2041
+ name: error.name
2042
+ }))
2043
+ };
2044
+ }
2045
+ async writeReport(content) {
2046
+ if (!this.outputPath) return void logger_logger.log(content);
2047
+ try {
2048
+ await promises.mkdir(node_path.dirname(this.outputPath), {
2049
+ recursive: true
2050
+ });
2051
+ await promises.writeFile(this.outputPath, content, 'utf-8');
2052
+ logger_logger.log(`JSON report written to: ${this.outputPath}`);
2053
+ } catch (error) {
2054
+ logger_logger.stderr(`Failed to write JSON report to ${this.outputPath}:`, error);
2055
+ logger_logger.log(content);
2056
+ }
2057
+ }
2058
+ async onTestRunEnd({ results, testResults, duration, snapshotSummary, unhandledErrors }) {
2059
+ const report = this.createReport({
2060
+ results,
2061
+ testResults,
2062
+ duration,
2063
+ snapshotSummary,
2064
+ unhandledErrors
2065
+ });
2066
+ await this.writeReport(`${JSON.stringify(report, null, 2)}\n`);
2067
+ }
2068
+ }
1980
2069
  function ansiRegex({ onlyFirst = false } = {}) {
1981
2070
  const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
1982
2071
  const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
@@ -2339,7 +2428,7 @@ async function printCodeFrame(frame) {
2339
2428
  if (!filePath) return;
2340
2429
  const source = node_fs.existsSync(filePath) ? node_fs.readFileSync(filePath, 'utf-8') : void 0;
2341
2430
  if (!source) return;
2342
- const { codeFrameColumns } = await import("./0~lib.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/@babel+code-frame@7.29.0/node_modules/@babel/code-frame/lib/index.js"));
2431
+ const { codeFrameColumns } = await import("./0~@babel/code-frame.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/@babel+code-frame@7.29.0/node_modules/@babel/code-frame/lib/index.js"));
2343
2432
  const result = codeFrameColumns(source, {
2344
2433
  start: {
2345
2434
  line: frame.lineNumber,
@@ -3571,7 +3660,7 @@ class MdReporter {
3571
3660
  }
3572
3661
  renderFrontMatter(lines) {
3573
3662
  const frontMatter = {
3574
- tool: "@rstest/core@0.9.5",
3663
+ tool: "@rstest/core@0.9.6",
3575
3664
  timestamp: new Date().toISOString()
3576
3665
  };
3577
3666
  if (this.options.header.env) frontMatter.runtime = {
@@ -3945,7 +4034,7 @@ class Rstest {
3945
4034
  updateSnapshot: rstestConfig.update ? 'all' : dist_m ? 'none' : 'new'
3946
4035
  });
3947
4036
  this.snapshotManager = snapshotManager;
3948
- this.version = "0.9.5";
4037
+ this.version = "0.9.6";
3949
4038
  this.rootPath = rootPath;
3950
4039
  this.originalConfig = userConfig;
3951
4040
  this.normalizedConfig = rstestConfig;
@@ -4025,6 +4114,7 @@ const reportersMap = {
4025
4114
  verbose: VerboseReporter,
4026
4115
  'github-actions': GithubActionsReporter,
4027
4116
  junit: JUnitReporter,
4117
+ json: JsonReporter,
4028
4118
  md: MdReporter,
4029
4119
  blob: BlobReporter
4030
4120
  };
@@ -4081,7 +4171,10 @@ function core_createRstest({ config, projects, configFilePath }, command, fileFi
4081
4171
  function defineConfig(config) {
4082
4172
  return config;
4083
4173
  }
4174
+ function defineInlineProject(config) {
4175
+ return config;
4176
+ }
4084
4177
  function defineProject(config) {
4085
4178
  return config;
4086
4179
  }
4087
- export { config_loadConfig as loadConfig, core_createRstest as createRstest, core_namespaceObject, defineConfig, defineProject, detect, error_parseErrorStacktrace as parseErrorStacktrace, error_printError as printError, formatStack, init_initCli as initCli, init_namespaceObject, mergeProjectConfig, mergeRstestConfig, resolveCommand, runCLI, runRest };
4180
+ export { config_loadConfig as loadConfig, core_createRstest as createRstest, core_namespaceObject, defineConfig, defineInlineProject, defineProject, detect, error_parseErrorStacktrace as parseErrorStacktrace, error_printError as printError, formatStack, init_initCli as initCli, init_namespaceObject, mergeProjectConfig, mergeRstestConfig, resolveCommand, runCLI, runRest };
package/dist/4411.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import "node:module";
2
- import { __webpack_require__ } from "./rslib-runtime.js";
3
2
  import promises from "node:fs/promises";
4
- import node_fs, * as __rspack_external_node_fs_5ea92f0c from "node:fs";
5
- import node_path, { basename, dirname, normalize, posix, relative as external_node_path_relative, resolve, sep } from "node:path";
3
+ import fs_0, * as __rspack_external_fs from "fs";
4
+ import path_0, { basename, dirname, normalize, posix, relative as external_path_relative, resolve, sep } from "path";
6
5
  import { fileURLToPath } from "url";
7
6
  import { createRequire } from "module";
7
+ import { __webpack_require__ } from "./0~rslib-runtime.js";
8
8
  import { logger as logger_logger, parsePosix, color as logger_color, castArray } from "./6830.js";
9
9
  import { posix as dist_posix } from "./7011.js";
10
10
  __webpack_require__.add({
@@ -1658,7 +1658,7 @@ function joinPathWithRelativePath(root, options) {
1658
1658
  return function(filename, directoryPath) {
1659
1659
  const sameRoot = directoryPath.startsWith(root);
1660
1660
  if (sameRoot) return directoryPath.slice(root.length) + filename;
1661
- return convertSlashes(external_node_path_relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
1661
+ return convertSlashes(external_path_relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
1662
1662
  };
1663
1663
  }
1664
1664
  function joinPath(filename) {
@@ -1913,7 +1913,7 @@ var Walker = class {
1913
1913
  ""
1914
1914
  ].slice(0, 0),
1915
1915
  controller: new Aborter(),
1916
- fs: options.fs || __rspack_external_node_fs_5ea92f0c
1916
+ fs: options.fs || __rspack_external_fs
1917
1917
  };
1918
1918
  this.joinPath = build$7(this.root, options);
1919
1919
  this.pushDirectory = build$6(this.root, options);
@@ -2213,7 +2213,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2213
2213
  if (pattern.endsWith("/")) result = pattern.slice(0, -1);
2214
2214
  if (!result.endsWith("*") && expandDirectories) result += "/**";
2215
2215
  const escapedCwd = escapePath(cwd);
2216
- result = node_path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
2216
+ result = path_0.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
2217
2217
  const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2218
2218
  const parts = splitPattern(result);
2219
2219
  if (null == parentDirectoryMatch ? void 0 : parentDirectoryMatch[0]) {
@@ -2282,7 +2282,7 @@ function formatPaths(paths, relative) {
2282
2282
  function normalizeCwd(cwd) {
2283
2283
  if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
2284
2284
  if (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, "/");
2285
- return node_path.resolve(cwd).replace(BACKSLASHES, "/");
2285
+ return path_0.resolve(cwd).replace(BACKSLASHES, "/");
2286
2286
  }
2287
2287
  function getCrawler(patterns, inputOptions = {}) {
2288
2288
  const options = process.env.TINYGLOBBY_DEBUG ? {
@@ -2347,12 +2347,12 @@ function getCrawler(patterns, inputOptions = {}) {
2347
2347
  return "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
2348
2348
  },
2349
2349
  fs: options.fs ? {
2350
- readdir: options.fs.readdir || node_fs.readdir,
2351
- readdirSync: options.fs.readdirSync || node_fs.readdirSync,
2352
- realpath: options.fs.realpath || node_fs.realpath,
2353
- realpathSync: options.fs.realpathSync || node_fs.realpathSync,
2354
- stat: options.fs.stat || node_fs.stat,
2355
- statSync: options.fs.statSync || node_fs.statSync
2350
+ readdir: options.fs.readdir || fs_0.readdir,
2351
+ readdirSync: options.fs.readdirSync || fs_0.readdirSync,
2352
+ realpath: options.fs.realpath || fs_0.realpath,
2353
+ realpathSync: options.fs.realpathSync || fs_0.realpathSync,
2354
+ stat: options.fs.stat || fs_0.stat,
2355
+ statSync: options.fs.statSync || fs_0.statSync
2356
2356
  } : void 0,
2357
2357
  pathSeparator: "/",
2358
2358
  relativePaths: true,
package/dist/6830.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import "node:module";
2
- import { __webpack_require__ } from "./rslib-runtime.js";
3
2
  import node_util from "node:util";
4
3
  import node_process from "node:process";
5
4
  import node_os from "node:os";
6
5
  import node_tty from "node:tty";
6
+ import { __webpack_require__ } from "./0~rslib-runtime.js";
7
7
  __webpack_require__.add({
8
8
  "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
9
9
  let p = process || {}, argv = p.argv || [], env = p.env || {};
package/dist/6887.js ADDED
@@ -0,0 +1,15 @@
1
+ import "node:module";
2
+ import { __webpack_require__ } from "./0~rslib-runtime.js";
3
+ import { createRequire as __rspack_createRequire } from "node:module";
4
+ const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
5
+ __webpack_require__.add({
6
+ timers (module) {
7
+ module.exports = __rspack_createRequire_require("timers");
8
+ },
9
+ "timers/promises" (module) {
10
+ module.exports = __rspack_createRequire_require("timers/promises");
11
+ },
12
+ util (module) {
13
+ module.exports = __rspack_createRequire_require("util");
14
+ }
15
+ });
package/dist/9743.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "node:module";
2
- import { __webpack_require__ } from "./rslib-runtime.js";
2
+ import { __webpack_require__ } from "./0~rslib-runtime.js";
3
3
  import { format as dist_format, dist_plugins, node_u } from "./9784.js";
4
4
  var diff_namespaceObject = {};
5
5
  __webpack_require__.r(diff_namespaceObject);
package/dist/9784.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*! LICENSE: 9784.js.LICENSE.txt */
2
2
  import "node:module";
3
- import { __webpack_require__ } from "./rslib-runtime.js";
4
- import { isatty } from "node:tty";
3
+ import { __webpack_require__ } from "./0~rslib-runtime.js";
4
+ import { isatty } from "tty";
5
5
  var dist_namespaceObject = {};
6
6
  __webpack_require__.r(dist_namespaceObject);
7
7
  __webpack_require__.d(dist_namespaceObject, {