@cedarjs/testing 8.0.0-canary.3307 → 8.0.0-canary.3310

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CedarApiVitestEnv.d.ts","sourceRoot":"","sources":["../../../src/api/vitest/CedarApiVitestEnv.ts"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAA;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAWtD,QAAA,MAAM,yBAAyB,EAAE,WAwFhC,CAAA;AAED,eAAe,yBAAyB,CAAA"}
1
+ {"version":3,"file":"CedarApiVitestEnv.d.ts","sourceRoot":"","sources":["../../../src/api/vitest/CedarApiVitestEnv.ts"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAA;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAoDtD,QAAA,MAAM,yBAAyB,EAAE,WAoHhC,CAAA;AAED,eAAe,yBAAyB,CAAA"}
@@ -8,6 +8,22 @@ import {
8
8
  checkTestDatabaseUrlMatchesProvider,
9
9
  redactDatabaseUrl
10
10
  } from "../checkTestDatabase.js";
11
+ const MAX_ERROR_OUTPUT_LENGTH = 4e3;
12
+ function joinOutput(stdout, stderr) {
13
+ return [stdout, stderr].map((stream) => stream?.trim()).filter((stream) => Boolean(stream)).join("\n");
14
+ }
15
+ function formatDbResetError(command, exitCode, output) {
16
+ const exitInfo = typeof exitCode === "number" ? ` (exit code ${exitCode})` : "";
17
+ const lines = [
18
+ `Failed to reset the test database${exitInfo}.`,
19
+ `Command: ${command}`
20
+ ];
21
+ if (output) {
22
+ const trimmedOutput = output.length > MAX_ERROR_OUTPUT_LENGTH ? "...\n" + output.slice(-MAX_ERROR_OUTPUT_LENGTH) : output;
23
+ lines.push("", "Output:", trimmedOutput);
24
+ }
25
+ return lines.join("\n");
26
+ }
11
27
  const CedarApiVitestEnvironment = {
12
28
  name: "cedar-api",
13
29
  viteEnvironment: "ssr",
@@ -43,11 +59,30 @@ const CedarApiVitestEnvironment = {
43
59
  if (testConfig.autoConsentToDbReset && !("PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION" in env)) {
44
60
  env.PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION = "Cedar auto-consent: cedar.toml's [test] autoConsentToDbReset is true, and the reset target passed Cedar's test-database identity guard.";
45
61
  }
46
- execa.sync(pmExec, ["cedar", ...command], {
62
+ const result = execa.sync(pmExec, ["cedar", ...command], {
47
63
  cwd: cedarPaths.api.base,
48
- stdio: "inherit",
49
- env
64
+ env,
65
+ reject: false
50
66
  });
67
+ if (result.failed) {
68
+ const output = joinOutput(result.stdout, result.stderr);
69
+ if (output) {
70
+ console.error(output);
71
+ }
72
+ throw new Error(
73
+ formatDbResetError(
74
+ result.command,
75
+ result.exitCode,
76
+ output || (result instanceof Error ? result.message : "")
77
+ )
78
+ );
79
+ }
80
+ if (result.stdout) {
81
+ console.log(result.stdout);
82
+ }
83
+ if (result.stderr) {
84
+ console.error(result.stderr);
85
+ }
51
86
  return {
52
87
  teardown() {
53
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/testing",
3
- "version": "8.0.0-canary.3307",
3
+ "version": "8.0.0-canary.3310",
4
4
  "description": "Tools, wrappers and configuration for testing a Cedar project.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,9 +54,9 @@
54
54
  "test:watch": "vitest watch"
55
55
  },
56
56
  "dependencies": {
57
- "@cedarjs/context": "8.0.0-canary.3307",
58
- "@cedarjs/graphql-server": "8.0.0-canary.3307",
59
- "@cedarjs/project-config": "8.0.0-canary.3307",
57
+ "@cedarjs/context": "8.0.0-canary.3310",
58
+ "@cedarjs/graphql-server": "8.0.0-canary.3310",
59
+ "@cedarjs/project-config": "8.0.0-canary.3310",
60
60
  "@testing-library/dom": "10.4.2",
61
61
  "@testing-library/jest-dom": "6.9.1",
62
62
  "@testing-library/react": "16.3.3",
@@ -73,19 +73,19 @@
73
73
  },
74
74
  "devDependencies": {
75
75
  "@arethetypeswrong/cli": "0.18.5",
76
- "@cedarjs/auth": "8.0.0-canary.3307",
77
- "@cedarjs/framework-tools": "8.0.0-canary.3307",
78
- "@cedarjs/router": "8.0.0-canary.3307",
79
- "@cedarjs/web": "8.0.0-canary.3307",
76
+ "@cedarjs/auth": "8.0.0-canary.3310",
77
+ "@cedarjs/framework-tools": "8.0.0-canary.3310",
78
+ "@cedarjs/router": "8.0.0-canary.3310",
79
+ "@cedarjs/web": "8.0.0-canary.3310",
80
80
  "concurrently": "9.2.4",
81
81
  "publint": "0.3.24",
82
82
  "typescript": "5.9.3",
83
83
  "vitest": "4.1.11"
84
84
  },
85
85
  "peerDependencies": {
86
- "@cedarjs/auth": "8.0.0-canary.3307",
87
- "@cedarjs/router": "8.0.0-canary.3307",
88
- "@cedarjs/web": "8.0.0-canary.3307",
86
+ "@cedarjs/auth": "8.0.0-canary.3310",
87
+ "@cedarjs/router": "8.0.0-canary.3310",
88
+ "@cedarjs/web": "8.0.0-canary.3310",
89
89
  "vitest": "4.1.11"
90
90
  },
91
91
  "peerDependenciesMeta": {