@isentinel/jest-roblox 0.0.4 → 0.0.5

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/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { S as LuauScriptError, _ as createStudioBackend, a as execute, d as loadConfig, h as isValidBackend, i as runTypecheck, m as VALID_BACKENDS, n as parseGameOutput, r as writeGameOutput, s as writeJsonFile, t as formatGameOutputNotice, y as createOpenCloudBackend } from "./game-output-DO5fOpW3.mjs";
1
+ import { S as LuauScriptError, _ as createStudioBackend, a as execute, d as loadConfig, h as isValidBackend, i as runTypecheck, m as VALID_BACKENDS, n as parseGameOutput, r as writeGameOutput, s as writeJsonFile, t as formatGameOutputNotice, y as createOpenCloudBackend } from "./game-output-C_o4fw72.mjs";
2
2
  import * as path$1 from "node:path";
3
3
  import process from "node:process";
4
4
  import { parseArgs as parseArgs$1 } from "node:util";
@@ -6,7 +6,7 @@ import { WebSocketServer } from "ws";
6
6
  import * as fs from "node:fs";
7
7
 
8
8
  //#region package.json
9
- var version = "0.0.4";
9
+ var version = "0.0.5";
10
10
 
11
11
  //#endregion
12
12
  //#region src/backends/auto.ts
@@ -1036,7 +1036,10 @@ function formatTestSummary(result, timing, styles) {
1036
1036
  function formatResult(result, timing, options) {
1037
1037
  const styles = createStyles(options.color);
1038
1038
  const lines = [formatRunHeader(options, styles)];
1039
- for (const file of result.testResults) lines.push(formatFileSummary(file, options, styles));
1039
+ for (const file of result.testResults) {
1040
+ if (options.failuresOnly && file.numFailingTests === 0 && !hasExecError(file)) continue;
1041
+ lines.push(formatFileSummary(file, options, styles));
1042
+ }
1040
1043
  const execErrors = result.testResults.filter(hasExecError);
1041
1044
  const totalDetailedFailures = result.numFailedTests + execErrors.length;
1042
1045
  if (totalDetailedFailures > 0) {
@@ -1199,9 +1202,9 @@ function formatMappedLocationSnippets(loc, showLuau, st, useColor) {
1199
1202
  function formatSnapshotCallSnippet(filePath, styles, useColor) {
1200
1203
  if (!fs.existsSync(filePath)) return [];
1201
1204
  const content = fs.readFileSync(filePath, "utf-8");
1202
- const snapshotIndices = content.split("\n").reduce((acc, fileLine, index) => {
1203
- if (fileLine.includes("toMatchSnapshot")) acc.push(index);
1204
- return acc;
1205
+ const snapshotIndices = content.split("\n").reduce((accumulator, fileLine, index) => {
1206
+ if (fileLine.includes("toMatchSnapshot")) accumulator.push(index);
1207
+ return accumulator;
1205
1208
  }, []);
1206
1209
  if (snapshotIndices.length !== 1) return [];
1207
1210
  const snippet = getSourceSnippet({
@@ -1565,12 +1568,13 @@ async function execute(options) {
1565
1568
  else if (options.config.json) output = formatJson(result);
1566
1569
  else output = formatResult(result, timing, {
1567
1570
  color: options.config.color,
1571
+ failuresOnly: options.config.compact && options.config.verbose,
1568
1572
  gameOutput: resolvedGameOutput,
1569
1573
  outputFile: resolvedOutputFile,
1570
1574
  rootDir: options.config.rootDir,
1571
1575
  showLuau: options.config.showLuau,
1572
1576
  sourceMapper,
1573
- verbose: options.config.verbose,
1577
+ verbose: options.config.verbose && !options.config.compact,
1574
1578
  version: options.version
1575
1579
  });
1576
1580
  if (luauTiming !== void 0) printLuauTiming(luauTiming);
@@ -1921,8 +1925,10 @@ function parseGameOutput(raw) {
1921
1925
  }
1922
1926
  }
1923
1927
  function writeGameOutput(filePath, entries) {
1924
- fs.mkdirSync(path$1.dirname(filePath), { recursive: true });
1925
- fs.writeFileSync(filePath, JSON.stringify(entries, null, 2));
1928
+ const absolutePath = path$1.resolve(filePath);
1929
+ const directoryPath = path$1.dirname(absolutePath);
1930
+ if (!fs.existsSync(directoryPath)) fs.mkdirSync(directoryPath, { recursive: true });
1931
+ fs.writeFileSync(absolutePath, JSON.stringify(entries, null, 2));
1926
1932
  }
1927
1933
 
1928
1934
  //#endregion
package/dist/index.d.mts CHANGED
@@ -183,6 +183,7 @@ interface TimingResult {
183
183
  //#region src/formatters/formatter.d.ts
184
184
  interface FormatOptions {
185
185
  color: boolean;
186
+ failuresOnly?: boolean;
186
187
  gameOutput?: string;
187
188
  outputFile?: string;
188
189
  rootDir: string;
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { C as extractJsonFromOutput, _ as createStudioBackend, a as execute, b as buildJestArgv, c as formatFailure, d as loadConfig, f as resolveConfig, g as StudioBackend, i as runTypecheck, l as formatResult, n as parseGameOutput, o as formatJson, p as DEFAULT_CONFIG, r as writeGameOutput, s as writeJsonFile, t as formatGameOutputNotice, u as formatTestSummary, v as OpenCloudBackend, w as parseJestOutput, x as generateTestScript, y as createOpenCloudBackend } from "./game-output-DO5fOpW3.mjs";
1
+ import { C as extractJsonFromOutput, _ as createStudioBackend, a as execute, b as buildJestArgv, c as formatFailure, d as loadConfig, f as resolveConfig, g as StudioBackend, i as runTypecheck, l as formatResult, n as parseGameOutput, o as formatJson, p as DEFAULT_CONFIG, r as writeGameOutput, s as writeJsonFile, t as formatGameOutputNotice, u as formatTestSummary, v as OpenCloudBackend, w as parseJestOutput, x as generateTestScript, y as createOpenCloudBackend } from "./game-output-C_o4fw72.mjs";
2
2
 
3
3
  export { DEFAULT_CONFIG, OpenCloudBackend, StudioBackend, buildJestArgv, createOpenCloudBackend, createStudioBackend, execute, extractJsonFromOutput, formatFailure, formatGameOutputNotice, formatJson, formatResult, formatTestSummary, generateTestScript, loadConfig, parseGameOutput, parseJestOutput, resolveConfig, runTypecheck, writeGameOutput, writeJsonFile };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isentinel/jest-roblox",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Jest-compatible CLI for running roblox-ts tests via Roblox Open Cloud",
5
5
  "keywords": [
6
6
  "jest",