@cosmicdrift/kumiko-testing 0.405.0 → 0.409.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/package.json +6 -6
- package/src/changes.json +6 -0
- package/src/stack/test-stack-setup.ts +25 -12
- package/src/stack/test-stack.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.409.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": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
"kumiko-testing": "./bin/kumiko-testing.ts"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
107
|
-
"@cosmicdrift/kumiko-guards": "0.
|
|
108
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
106
|
+
"@cosmicdrift/kumiko-framework": "0.409.0",
|
|
107
|
+
"@cosmicdrift/kumiko-guards": "0.409.0",
|
|
108
|
+
"@cosmicdrift/kumiko-types": "0.409.0",
|
|
109
109
|
"zod": "^4.6.7"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
@@ -129,8 +129,8 @@
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
133
|
-
"@cosmicdrift/kumiko-dev-server": "0.
|
|
132
|
+
"@cosmicdrift/kumiko-bundled-features": "0.409.0",
|
|
133
|
+
"@cosmicdrift/kumiko-dev-server": "0.409.0",
|
|
134
134
|
"@happy-dom/global-registrator": "^21.0.4",
|
|
135
135
|
"@playwright/test": "^1.64.1",
|
|
136
136
|
"@testing-library/dom": "^10.4.2",
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.409.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "Test-stack jobs get ctx.services.files from mounted file providers",
|
|
6
|
+
"detail": "setupTestStack resolved the file-provider plugins only for the request path, so a job saw ctx.services.files undefined unless the stack got an explicit files option. The job context now carries the same resolver the production entrypoint builds (withFileProviderResolver), so a job that hashes or reads stored bytes behaves in tests as it does in production."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.401.0",
|
|
4
10
|
"type": "fix",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// @runtime dev
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
buildServer,
|
|
5
|
+
createSseBroker,
|
|
6
|
+
withFileProviderResolver,
|
|
7
|
+
} from "@cosmicdrift/kumiko-framework/api";
|
|
4
8
|
import {
|
|
5
9
|
assertRowLevelSecurityBootState,
|
|
6
10
|
type DbConnection,
|
|
@@ -308,6 +312,7 @@ export async function buildStackServices(
|
|
|
308
312
|
options: TestStackOptions,
|
|
309
313
|
testDb: StackStorage["testDb"],
|
|
310
314
|
testRedis: TestRedis,
|
|
315
|
+
cacheSync: ClosableCacheSyncBus,
|
|
311
316
|
) {
|
|
312
317
|
const searchAdapter = createInMemorySearchAdapter();
|
|
313
318
|
const events = createEventCollector();
|
|
@@ -353,17 +358,25 @@ export async function buildStackServices(
|
|
|
353
358
|
redis: testRedis.redis,
|
|
354
359
|
})
|
|
355
360
|
: options.extraContext;
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
searchAdapter,
|
|
360
|
-
entityCache,
|
|
361
|
+
// The prod entrypoint resolves the mounted file-provider plugins before the job runner sees
|
|
362
|
+
// the context; without it a job's ctx.services.files is undefined only in tests.
|
|
363
|
+
const appContext = withFileProviderResolver(
|
|
361
364
|
registry,
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
{
|
|
366
|
+
db: testDb.db,
|
|
367
|
+
redis: testRedis.redis,
|
|
368
|
+
searchAdapter,
|
|
369
|
+
entityCache,
|
|
370
|
+
registry,
|
|
371
|
+
...(options.masterKeyProvider ? { masterKeyProvider: options.masterKeyProvider } : {}),
|
|
372
|
+
...(fileProviderResolver ? { _fileProviderResolver: fileProviderResolver } : {}),
|
|
373
|
+
...(options.defaultLocale !== undefined && { defaultLocale: options.defaultLocale }),
|
|
374
|
+
...extraContext,
|
|
375
|
+
},
|
|
376
|
+
// Same bus buildServer gets: the resolver built here is the one it reuses, so config and
|
|
377
|
+
// secret writes must reach its per-tenant provider cache through it.
|
|
378
|
+
cacheSync,
|
|
379
|
+
);
|
|
367
380
|
extraContextClock.current = extraContext?.["clock"];
|
|
368
381
|
return { searchAdapter, events, registry, sseBroker, entityCache, observability, appContext };
|
|
369
382
|
}
|
|
@@ -429,7 +442,7 @@ function collectSearchableFields(features: TestStackOptions["features"]): string
|
|
|
429
442
|
for (const feature of features) {
|
|
430
443
|
for (const [, entity] of Object.entries(feature.entities ?? {})) {
|
|
431
444
|
for (const [fieldName, field] of Object.entries(entity.fields)) {
|
|
432
|
-
if (field.type === "text" && field.searchable) {
|
|
445
|
+
if ((field.type === "text" || field.type === "longText") && field.searchable) {
|
|
433
446
|
searchableFields.push(fieldName);
|
|
434
447
|
}
|
|
435
448
|
if (field.type === "embedded") {
|
package/src/stack/test-stack.ts
CHANGED
|
@@ -271,7 +271,7 @@ export async function setupTestStack(options: TestStackOptions): Promise<TestSta
|
|
|
271
271
|
await validateStackFeatures(options, jwtSecret);
|
|
272
272
|
const { testDb, testRedis } = await provisionStackStorage(options);
|
|
273
273
|
const cacheSync = createStackCacheSync(options, testRedis);
|
|
274
|
-
const services = await buildStackServices(options, testDb, testRedis);
|
|
274
|
+
const services = await buildStackServices(options, testDb, testRedis, cacheSync);
|
|
275
275
|
// Fed to the job runner's onJobComplete/onJobFailed so drainJobs()
|
|
276
276
|
// can tell a job's final outcome apart from an attempt that will retry —
|
|
277
277
|
// built regardless of whether a runner ends up existing, so the returned
|