@cosmicdrift/kumiko-testing 0.328.0 → 0.329.0
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/bin/kumiko-testing.ts +1 -0
- package/package.json +4 -4
- package/src/changes.json +6 -0
- package/src/integration-runner.ts +17 -6
package/bin/kumiko-testing.ts
CHANGED
|
@@ -76,6 +76,7 @@ async function runIntegration(args: readonly string[]): Promise<number> {
|
|
|
76
76
|
if (positionals.length > 0) {
|
|
77
77
|
try {
|
|
78
78
|
files = resolveRequestedIntegrationFiles(process.cwd(), positionals);
|
|
79
|
+
if (files.length === 0) throw new Error("no *.integration.test.ts files found");
|
|
79
80
|
} catch (error) {
|
|
80
81
|
console.error(error instanceof Error ? error.message : String(error));
|
|
81
82
|
return 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.329.0",
|
|
4
4
|
"description": "Test template for Kumiko apps: per-flow seedTenant, app test stack, canonical test preloads, bunfig generator and integration runner.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"kumiko-testing": "./bin/kumiko-testing.ts"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
79
|
-
"@cosmicdrift/kumiko-dev-server": "0.
|
|
80
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
78
|
+
"@cosmicdrift/kumiko-bundled-features": "0.329.0",
|
|
79
|
+
"@cosmicdrift/kumiko-dev-server": "0.329.0",
|
|
80
|
+
"@cosmicdrift/kumiko-framework": "0.329.0",
|
|
81
81
|
"zod": "^4.4.3"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.329.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "kumiko-testing integration with a directory runs only *.integration.test.ts files",
|
|
6
|
+
"detail": "A directory argument used to reach `bun test` as a path filter, which also picked up `*.test.tsx` files. It now expands to the integration test files below it."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.321.0",
|
|
4
10
|
"type": "improvement",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { resolve } from "node:path";
|
|
1
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
3
|
import { BUNFIG_FILES, TEST_TIMEOUT_MS } from "./bunfig";
|
|
4
4
|
|
|
5
5
|
export type IntegrationRunOptions = {
|
|
@@ -18,9 +18,15 @@ export function selectIntegrationFiles(paths: readonly string[]): string[] {
|
|
|
18
18
|
.sort();
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
function listDirectoryFiles(path: string): string[] | undefined {
|
|
22
|
+
if (statSync(path, { throwIfNoEntry: false })?.isDirectory() !== true) return undefined;
|
|
23
|
+
return readdirSync(path, { recursive: true, encoding: "utf8" });
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
/** Resolves `kumiko-testing integration`'s positional file args against `cwd`
|
|
22
|
-
* into absolute paths
|
|
23
|
-
*
|
|
27
|
+
* into absolute paths, so bun's own `bun test <path>` treats them as files to
|
|
28
|
+
* run, not filter patterns. A directory expands to the integration test files
|
|
29
|
+
* below it (`listDirectory` returns entries relative to it, undefined for a file).
|
|
24
30
|
* `exists` is injectable so this stays unit-testable without touching the
|
|
25
31
|
* real filesystem. Throws on the first missing file — the caller decides
|
|
26
32
|
* how to report it (CLI: print + exit 1). */
|
|
@@ -28,13 +34,18 @@ export function resolveRequestedIntegrationFiles(
|
|
|
28
34
|
cwd: string,
|
|
29
35
|
positionals: readonly string[],
|
|
30
36
|
exists: (path: string) => boolean = existsSync,
|
|
37
|
+
listDirectory: (path: string) => string[] | undefined = listDirectoryFiles,
|
|
31
38
|
): string[] {
|
|
32
|
-
return positionals.
|
|
39
|
+
return positionals.flatMap((arg) => {
|
|
33
40
|
const resolved = resolve(cwd, arg);
|
|
34
41
|
if (!exists(resolved)) {
|
|
35
42
|
throw new Error(`kumiko-testing integration: file not found: ${arg}`);
|
|
36
43
|
}
|
|
37
|
-
|
|
44
|
+
// A directory handed to `bun test` is a path filter that also matches *.test.tsx.
|
|
45
|
+
const directoryFiles = listDirectory(resolved);
|
|
46
|
+
return directoryFiles === undefined
|
|
47
|
+
? [resolved]
|
|
48
|
+
: selectIntegrationFiles(directoryFiles).map((entry) => join(resolved, entry));
|
|
38
49
|
});
|
|
39
50
|
}
|
|
40
51
|
|