@hot-updater/test-utils 1.2.0-rc.12 → 1.2.0-rc.13
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/index.d.mts +2 -2
- package/dist/index.mjs +173 -25
- package/dist/node.cjs +0 -17
- package/dist/node.d.cts +1 -14
- package/dist/node.d.mts +1 -14
- package/dist/node.mjs +1 -16
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -321,8 +321,8 @@ interface AggregateBatchingSuiteOptions {
|
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
323
|
* Aggregates declared `batched` on a key-value store: log rows the store
|
|
324
|
-
* writes with each transaction and a compaction merges once,
|
|
325
|
-
*
|
|
324
|
+
* writes with each transaction and a compaction merges once, read back
|
|
325
|
+
* exactly as transactional writes read.
|
|
326
326
|
*/
|
|
327
327
|
declare const setupAggregateBatchingTestSuite: ({ name, createAdapter, oversizedRows }: AggregateBatchingSuiteOptions) => void;
|
|
328
328
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -455,6 +455,101 @@ const setupCoreAdminTestSuite = (options) => {
|
|
|
455
455
|
const after = await adminJson("/bundles?limit=1&total=true");
|
|
456
456
|
expect(after.total).toBe(before.total);
|
|
457
457
|
});
|
|
458
|
+
it("marks one store build per native build scope, replacing and clearing it", async () => {
|
|
459
|
+
const channel = `store-build-${namespace}`;
|
|
460
|
+
const register = async (suffix, fingerprintHash) => {
|
|
461
|
+
const builtIn = bundleRow(suffix);
|
|
462
|
+
const response = await admin("/native-builds", jsonRequest("POST", {
|
|
463
|
+
id: bundleRow(`8${suffix}`).id,
|
|
464
|
+
platform: "ios",
|
|
465
|
+
channel,
|
|
466
|
+
fingerprintHash,
|
|
467
|
+
appVersion: null,
|
|
468
|
+
minBundleId: builtIn.id,
|
|
469
|
+
gitCommitHash: null,
|
|
470
|
+
buildKey: null,
|
|
471
|
+
buildNumber: suffix,
|
|
472
|
+
artifact: {
|
|
473
|
+
kind: "ipa",
|
|
474
|
+
storageUri: `storage://native-builds/ios/${suffix}/App.ipa`,
|
|
475
|
+
byteSize: 1e3
|
|
476
|
+
},
|
|
477
|
+
embeddedBundle: {
|
|
478
|
+
manifestStorageUri: builtIn.manifest_storage_uri,
|
|
479
|
+
manifestFileHash: builtIn.manifest_file_hash,
|
|
480
|
+
assetBaseStorageUri: builtIn.asset_base_storage_uri
|
|
481
|
+
}
|
|
482
|
+
}));
|
|
483
|
+
expect(response.status).toBe(201);
|
|
484
|
+
return (await response.json()).data;
|
|
485
|
+
};
|
|
486
|
+
const mark = (id, storeBuild) => admin(`/native-builds/${id}/store-build`, jsonRequest("POST", { storeBuild }));
|
|
487
|
+
const markRead = (fingerprintHash) => `/native-builds/latest?platform=ios&channel=${encodeURIComponent(channel)}&fingerprintHash=${fingerprintHash}&storeBuild=true`;
|
|
488
|
+
const older = await register("64", "store-fingerprint");
|
|
489
|
+
const newer = await register("65", "store-fingerprint");
|
|
490
|
+
const otherScope = await register("66", "store-fingerprint-b");
|
|
491
|
+
expect(older.store_build).toBeNull();
|
|
492
|
+
expect((await adminJson(markRead("store-fingerprint"))).data).toBeNull();
|
|
493
|
+
const marked = await mark(older.id, true);
|
|
494
|
+
expect(marked.status).toBe(200);
|
|
495
|
+
expect(await marked.json()).toMatchObject({ data: {
|
|
496
|
+
nativeBuild: {
|
|
497
|
+
id: older.id,
|
|
498
|
+
store_build: true
|
|
499
|
+
},
|
|
500
|
+
previous: null
|
|
501
|
+
} });
|
|
502
|
+
expect((await adminJson(markRead("store-fingerprint"))).data).toEqual({
|
|
503
|
+
...older,
|
|
504
|
+
store_build: true
|
|
505
|
+
});
|
|
506
|
+
expect((await adminJson(`/native-builds/latest?platform=ios&channel=${encodeURIComponent(channel)}&fingerprintHash=store-fingerprint`)).data).toEqual(newer);
|
|
507
|
+
expect((await adminJson(markRead("store-fingerprint-b"))).data).toBeNull();
|
|
508
|
+
const replaced = await mark(newer.id, true);
|
|
509
|
+
expect(await replaced.json()).toMatchObject({ data: {
|
|
510
|
+
nativeBuild: {
|
|
511
|
+
id: newer.id,
|
|
512
|
+
store_build: true
|
|
513
|
+
},
|
|
514
|
+
previous: {
|
|
515
|
+
id: older.id,
|
|
516
|
+
store_build: null
|
|
517
|
+
}
|
|
518
|
+
} });
|
|
519
|
+
expect((await adminJson(`/native-builds/${older.id}`)).data).toEqual(older);
|
|
520
|
+
expect((await adminJson(markRead("store-fingerprint"))).data).toEqual({
|
|
521
|
+
...newer,
|
|
522
|
+
store_build: true
|
|
523
|
+
});
|
|
524
|
+
const race = async (ids) => {
|
|
525
|
+
const responses = await Promise.all(ids.map((id) => mark(id, true)));
|
|
526
|
+
expect(responses.map(({ status }) => status)).toEqual(ids.map(() => 200));
|
|
527
|
+
const results = await Promise.all(responses.map((response) => response.json()));
|
|
528
|
+
expect(results.map(({ data }) => data.nativeBuild.store_build)).toEqual(ids.map(() => true));
|
|
529
|
+
const holders = (await Promise.all([older, newer].map(async ({ id }) => (await adminJson(`/native-builds/${id}`)).data))).filter(({ store_build }) => store_build === true);
|
|
530
|
+
expect(holders).toHaveLength(1);
|
|
531
|
+
expect(ids).toContain(holders[0].id);
|
|
532
|
+
};
|
|
533
|
+
await race([
|
|
534
|
+
older.id,
|
|
535
|
+
newer.id,
|
|
536
|
+
older.id
|
|
537
|
+
]);
|
|
538
|
+
await mark(older.id, false).then((response) => response.text());
|
|
539
|
+
await mark(newer.id, false).then((response) => response.text());
|
|
540
|
+
expect((await adminJson(markRead("store-fingerprint"))).data).toBeNull();
|
|
541
|
+
await race([older.id, newer.id]);
|
|
542
|
+
await (await mark(newer.id, false)).text();
|
|
543
|
+
await mark(older.id, false).then((response) => response.text());
|
|
544
|
+
expect((await adminJson(markRead("store-fingerprint"))).data).toBeNull();
|
|
545
|
+
expect(await (await mark(bundleRow("869").id, true)).json()).toMatchObject({ data: null });
|
|
546
|
+
const refused = await admin(`/native-builds/${older.id}/store-build`, jsonRequest("POST", {}));
|
|
547
|
+
expect(refused.status).toBe(400);
|
|
548
|
+
await refused.text();
|
|
549
|
+
await mark(otherScope.id, true).then((response) => response.text());
|
|
550
|
+
await adminJson(`/native-builds/${otherScope.id}`, jsonRequest("DELETE"));
|
|
551
|
+
expect((await adminJson(markRead("store-fingerprint-b"))).data).toBeNull();
|
|
552
|
+
});
|
|
458
553
|
it("lists the patches that start from a bundle", async () => {
|
|
459
554
|
const base = bundleRow("50");
|
|
460
555
|
const target = bundleRow("51");
|
|
@@ -3109,6 +3204,7 @@ const seed = async (database) => {
|
|
|
3109
3204
|
assetBaseStorageUri: "storage://read-budgets/assets"
|
|
3110
3205
|
}
|
|
3111
3206
|
});
|
|
3207
|
+
await core.markNativeBuild(createBundleFixture("8011").id, { storeBuild: true });
|
|
3112
3208
|
const { apiKey } = await api.apiKeys.create({ name: "Read budgets" });
|
|
3113
3209
|
for (let n = 1; n <= 24; n += 1) await api.insights.recordEvent(eventOf(n));
|
|
3114
3210
|
await api.insights.recordEvent(eventOf(25, {
|
|
@@ -3356,6 +3452,52 @@ const READ_BUDGETS = [
|
|
|
3356
3452
|
},
|
|
3357
3453
|
check: (build) => expect(build).toMatchObject({ min_bundle_id: createBundleFixture("012").id })
|
|
3358
3454
|
}),
|
|
3455
|
+
budget({
|
|
3456
|
+
api: "native build store mark: byStoreBuild, 1 row",
|
|
3457
|
+
read: ({ core }) => core.findNativeBuild(nativeBuildScope, { storeBuild: true }),
|
|
3458
|
+
adapter: reads(0, 0, 1, 1),
|
|
3459
|
+
engine: {
|
|
3460
|
+
calls: 1,
|
|
3461
|
+
rows: 1
|
|
3462
|
+
},
|
|
3463
|
+
check: (build) => expect(build).toMatchObject({
|
|
3464
|
+
min_bundle_id: createBundleFixture("011").id,
|
|
3465
|
+
store_build: true
|
|
3466
|
+
})
|
|
3467
|
+
}),
|
|
3468
|
+
budget({
|
|
3469
|
+
api: "native build store mark of a scope with none: byStoreBuild, no row",
|
|
3470
|
+
read: ({ core }) => core.findNativeBuild({
|
|
3471
|
+
...nativeBuildScope,
|
|
3472
|
+
channel: "no-such-channel"
|
|
3473
|
+
}, { storeBuild: true }),
|
|
3474
|
+
adapter: reads(0, 0, 1, 0),
|
|
3475
|
+
engine: {
|
|
3476
|
+
calls: 1,
|
|
3477
|
+
rows: 0
|
|
3478
|
+
},
|
|
3479
|
+
check: (build) => expect(build).toBeNull()
|
|
3480
|
+
}),
|
|
3481
|
+
budget({
|
|
3482
|
+
api: "native build older than a bundle, the newest is: byScope, limit 1",
|
|
3483
|
+
read: ({ core }) => core.findNativeBuild(nativeBuildScope, { builtInOlderThan: "ffffffff-ffff-7fff-bfff-ffffffffffff" }),
|
|
3484
|
+
adapter: reads(0, 0, 1, 1),
|
|
3485
|
+
engine: {
|
|
3486
|
+
calls: 1,
|
|
3487
|
+
rows: 1
|
|
3488
|
+
},
|
|
3489
|
+
check: (build) => expect(build).toMatchObject({ min_bundle_id: createBundleFixture("012").id })
|
|
3490
|
+
}),
|
|
3491
|
+
budget({
|
|
3492
|
+
api: "native build older than a bundle, past the newest: byScope twice",
|
|
3493
|
+
read: ({ core }) => core.findNativeBuild(nativeBuildScope, { builtInOlderThan: createBundleFixture("012").id }),
|
|
3494
|
+
adapter: reads(0, 0, 2, 2),
|
|
3495
|
+
engine: {
|
|
3496
|
+
calls: 2,
|
|
3497
|
+
rows: 2
|
|
3498
|
+
},
|
|
3499
|
+
check: (build) => expect(build).toMatchObject({ min_bundle_id: createBundleFixture("011").id })
|
|
3500
|
+
}),
|
|
3359
3501
|
budget({
|
|
3360
3502
|
api: "native build by key: byBuildKey descending, limit 1",
|
|
3361
3503
|
read: ({ core }) => core.findNativeBuild(nativeBuildScope, { buildKey: nativeBuildKey }),
|
|
@@ -3692,6 +3834,23 @@ const READ_BUDGETS = [
|
|
|
3692
3834
|
submitted_version: "1.0.0 (12)"
|
|
3693
3835
|
})
|
|
3694
3836
|
}),
|
|
3837
|
+
budget({
|
|
3838
|
+
api: "native build store mark write: the build, the holder, and 1 write",
|
|
3839
|
+
read: ({ core }) => core.markNativeBuild(createBundleFixture("8012").id, { storeBuild: true }),
|
|
3840
|
+
adapter: (indexCopies) => indexCopies ? reads(2, 2, 1, 1) : reads(1, 1, 1, 1),
|
|
3841
|
+
engine: {
|
|
3842
|
+
calls: 2,
|
|
3843
|
+
rows: 2
|
|
3844
|
+
},
|
|
3845
|
+
writes: 1,
|
|
3846
|
+
check: (result) => expect(result).toMatchObject({
|
|
3847
|
+
nativeBuild: {
|
|
3848
|
+
min_bundle_id: createBundleFixture("012").id,
|
|
3849
|
+
store_build: true
|
|
3850
|
+
},
|
|
3851
|
+
previous: { min_bundle_id: createBundleFixture("011").id }
|
|
3852
|
+
})
|
|
3853
|
+
}),
|
|
3695
3854
|
budget({
|
|
3696
3855
|
api: "native build delete: the build, its built-in bundle, and 1 write",
|
|
3697
3856
|
read: ({ core }) => core.deleteNativeBuild(createBundleFixture("8011").id),
|
|
@@ -3970,8 +4129,8 @@ const snapshot = async (db) => {
|
|
|
3970
4129
|
};
|
|
3971
4130
|
/**
|
|
3972
4131
|
* Aggregates declared `batched` on a key-value store: log rows the store
|
|
3973
|
-
* writes with each transaction and a compaction merges once,
|
|
3974
|
-
*
|
|
4132
|
+
* writes with each transaction and a compaction merges once, read back
|
|
4133
|
+
* exactly as transactional writes read.
|
|
3975
4134
|
*/
|
|
3976
4135
|
const setupAggregateBatchingTestSuite = ({ name, createAdapter, oversizedRows }) => {
|
|
3977
4136
|
const tables = [...toolingTargetOf([plugin]).schema.tables, ...aggregateBatchingTables];
|
|
@@ -4007,21 +4166,15 @@ const setupAggregateBatchingTestSuite = ({ name, createAdapter, oversizedRows })
|
|
|
4007
4166
|
afterEach(async () => {
|
|
4008
4167
|
for (const cleanup of cleanups.splice(0)) await cleanup();
|
|
4009
4168
|
});
|
|
4010
|
-
|
|
4011
|
-
const { db } = server(await store(), {
|
|
4169
|
+
it("reads what transactional writes read", async () => {
|
|
4170
|
+
const { db } = server(await store(), {});
|
|
4012
4171
|
for (let step = 0; step < 36; step += 1) await open(db, step);
|
|
4013
4172
|
expect(await snapshot(db)).toEqual(await expected(36));
|
|
4014
4173
|
}, 12e4);
|
|
4015
4174
|
it("applies each log row once when two servers compact while 16 writers commit", async () => {
|
|
4016
4175
|
const adapter = await store();
|
|
4017
|
-
const first = server(adapter, {
|
|
4018
|
-
|
|
4019
|
-
windowMs: 0
|
|
4020
|
-
});
|
|
4021
|
-
const second = server(adapter, {
|
|
4022
|
-
mode: "log",
|
|
4023
|
-
windowMs: 0
|
|
4024
|
-
});
|
|
4176
|
+
const first = server(adapter, { windowMs: 0 });
|
|
4177
|
+
const second = server(adapter, { windowMs: 0 });
|
|
4025
4178
|
const report = await runContentionHarness({
|
|
4026
4179
|
transactions: 12,
|
|
4027
4180
|
ratePerSecond: 1e3,
|
|
@@ -4039,7 +4192,7 @@ const setupAggregateBatchingTestSuite = ({ name, createAdapter, oversizedRows })
|
|
|
4039
4192
|
expect(await snapshot(second.db)).toEqual(await expected(48));
|
|
4040
4193
|
}, 3e5);
|
|
4041
4194
|
it("applies a log row larger than one write in parts, each change once", async () => {
|
|
4042
|
-
const { db, flush } = server(await store(), {
|
|
4195
|
+
const { db, flush } = server(await store(), {});
|
|
4043
4196
|
await db.transaction(async (tx) => {
|
|
4044
4197
|
for (let day = 1; day <= oversizedRows; day += 1) tx.aggregate("opens", { day }, { opens: day }, { shardBy: "i" });
|
|
4045
4198
|
});
|
|
@@ -4231,18 +4384,13 @@ const createPluginTestHarness = async (plugin, options = {}) => {
|
|
|
4231
4384
|
* bundles through the engine. A patch's base comes before it in `bundles`.
|
|
4232
4385
|
*/
|
|
4233
4386
|
const storeBundles = async (database, bundles) => {
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
for (const
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
}
|
|
4242
|
-
});
|
|
4243
|
-
} finally {
|
|
4244
|
-
await engine.dispose();
|
|
4245
|
-
}
|
|
4387
|
+
await createEngine(database).core.transaction(async (tx) => {
|
|
4388
|
+
for (const bundle of bundles) {
|
|
4389
|
+
tx.create("bundles", bundleToRow(bundle));
|
|
4390
|
+
for (const platformKey of [bundle.platform, "*"]) tx.aggregate("bundle_totals", { platform_key: platformKey }, { bundles: 1 });
|
|
4391
|
+
for (const row of bundleToPatchRows(bundle)) tx.create("bundle_patches", row);
|
|
4392
|
+
}
|
|
4393
|
+
});
|
|
4246
4394
|
};
|
|
4247
4395
|
//#endregion
|
|
4248
4396
|
//#region src/insights/expectInsightsIndex.ts
|
package/dist/node.cjs
CHANGED
|
@@ -20911,21 +20911,6 @@ const renderClackLog = (calls, { columns = 80 } = {}) => {
|
|
|
20911
20911
|
}
|
|
20912
20912
|
return (0, node_util.stripVTControlCharacters)(text).replace(/\n+$/, "").split("\n");
|
|
20913
20913
|
};
|
|
20914
|
-
const graphemes = new Intl.Segmenter();
|
|
20915
|
-
const WIDE_PATTERN = /[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6\u{20000}-\u{3FFFD}]|\p{Emoji_Presentation}/u;
|
|
20916
|
-
/**
|
|
20917
|
-
* The columns a line takes in a terminal, as East Asian Width counts them,
|
|
20918
|
-
* not its bytes or code units: `│`, `■`, and `…` take one each, a wide
|
|
20919
|
-
* character or an emoji two, and a combining mark none. The CLI keeps its
|
|
20920
|
-
* own count; this one is the specs' measure of it.
|
|
20921
|
-
*/
|
|
20922
|
-
const displayColumns = (line) => [...graphemes.segment((0, node_util.stripVTControlCharacters)(line))].reduce((columns, { segment }) => columns + (/^[\p{M}\p{Cf}\p{Cc}]+$/u.test(segment) ? 0 : WIDE_PATTERN.test(segment) ? 2 : 1), 0);
|
|
20923
|
-
/**
|
|
20924
|
-
* The lines wider than `columns` display columns, which a terminal that
|
|
20925
|
-
* wide wraps, but for a line that is one word after clack's gutter, such
|
|
20926
|
-
* as a URL, which no line break could shorten.
|
|
20927
|
-
*/
|
|
20928
|
-
const linesWiderThan = (lines, columns = 80) => lines.filter((line) => displayColumns(line) > columns && /\s/u.test(line.slice(3).trim()));
|
|
20929
20914
|
//#endregion
|
|
20930
20915
|
//#region src/setupHandlerIntegrationTestSuite.ts
|
|
20931
20916
|
const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
|
|
@@ -21199,14 +21184,12 @@ exports.cleanupServer = cleanupServer;
|
|
|
21199
21184
|
exports.createD1TestDatabase = createD1TestDatabase;
|
|
21200
21185
|
exports.createReleaseCatalogTestStorage = createReleaseCatalogTestStorage;
|
|
21201
21186
|
exports.createTestDbPath = createTestDbPath;
|
|
21202
|
-
exports.displayColumns = displayColumns;
|
|
21203
21187
|
exports.findOpenPort = findOpenPort;
|
|
21204
21188
|
exports.formatRuntimeLogs = formatRuntimeLogs;
|
|
21205
21189
|
exports.hasCommand = hasCommand;
|
|
21206
21190
|
exports.hasDockerCompose = hasDockerCompose;
|
|
21207
21191
|
exports.hasDockerDaemon = hasDockerDaemon;
|
|
21208
21192
|
exports.killPort = killPort;
|
|
21209
|
-
exports.linesWiderThan = linesWiderThan;
|
|
21210
21193
|
exports.mockReactNativeProjectRoot = mockReactNativeProjectRoot;
|
|
21211
21194
|
exports.mysqlExecutor = mysqlExecutor;
|
|
21212
21195
|
exports.pgBatchExecutor = pgBatchExecutor;
|
package/dist/node.d.cts
CHANGED
|
@@ -123,19 +123,6 @@ declare const recordedClackCalls: (...stubs: readonly object[]) => ClackLogCall[
|
|
|
123
123
|
declare const renderClackLog: (calls: readonly ClackLogCall[], { columns }?: {
|
|
124
124
|
columns?: number;
|
|
125
125
|
}) => string[];
|
|
126
|
-
/**
|
|
127
|
-
* The columns a line takes in a terminal, as East Asian Width counts them,
|
|
128
|
-
* not its bytes or code units: `│`, `■`, and `…` take one each, a wide
|
|
129
|
-
* character or an emoji two, and a combining mark none. The CLI keeps its
|
|
130
|
-
* own count; this one is the specs' measure of it.
|
|
131
|
-
*/
|
|
132
|
-
declare const displayColumns: (line: string) => number;
|
|
133
|
-
/**
|
|
134
|
-
* The lines wider than `columns` display columns, which a terminal that
|
|
135
|
-
* wide wraps, but for a line that is one word after clack's gutter, such
|
|
136
|
-
* as a URL, which no line break could shorten.
|
|
137
|
-
*/
|
|
138
|
-
declare const linesWiderThan: (lines: readonly string[], columns?: number) => string[];
|
|
139
126
|
//#endregion
|
|
140
127
|
//#region src/setupHandlerIntegrationTestSuite.d.ts
|
|
141
128
|
declare const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
|
|
@@ -183,4 +170,4 @@ declare const pgExecutor: (pool: Pool$1) => SqlExecutor;
|
|
|
183
170
|
declare const pgBatchExecutor: (pool: Pool$1) => SqlExecutor;
|
|
184
171
|
declare const mysqlExecutor: (pool: Pool) => SqlExecutor;
|
|
185
172
|
//#endregion
|
|
186
|
-
export { ClackLogCall, ClackLogMethod, D1TestResult, MockedReactNativeProjectRoot, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, RuntimeChild, RuntimeLogs, SpawnRuntimeOptions, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath,
|
|
173
|
+
export { ClackLogCall, ClackLogMethod, D1TestResult, MockedReactNativeProjectRoot, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, RuntimeChild, RuntimeLogs, SpawnRuntimeOptions, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath, findOpenPort, formatRuntimeLogs, hasCommand, hasDockerCompose, hasDockerDaemon, killPort, mockReactNativeProjectRoot, mysqlExecutor, pgBatchExecutor, pgExecutor, pgliteBatchExecutor, pgliteExecutor, recordedClackCalls, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, renderClackLog, runCheckedCommand, spawnRuntime, spawnServerProcess, sqliteBatchExecutor, sqliteExecutor, startHttpTestServer, stopRuntime, waitForHttpOk, waitForServer };
|
package/dist/node.d.mts
CHANGED
|
@@ -123,19 +123,6 @@ declare const recordedClackCalls: (...stubs: readonly object[]) => ClackLogCall[
|
|
|
123
123
|
declare const renderClackLog: (calls: readonly ClackLogCall[], { columns }?: {
|
|
124
124
|
columns?: number;
|
|
125
125
|
}) => string[];
|
|
126
|
-
/**
|
|
127
|
-
* The columns a line takes in a terminal, as East Asian Width counts them,
|
|
128
|
-
* not its bytes or code units: `│`, `■`, and `…` take one each, a wide
|
|
129
|
-
* character or an emoji two, and a combining mark none. The CLI keeps its
|
|
130
|
-
* own count; this one is the specs' measure of it.
|
|
131
|
-
*/
|
|
132
|
-
declare const displayColumns: (line: string) => number;
|
|
133
|
-
/**
|
|
134
|
-
* The lines wider than `columns` display columns, which a terminal that
|
|
135
|
-
* wide wraps, but for a line that is one word after clack's gutter, such
|
|
136
|
-
* as a URL, which no line break could shorten.
|
|
137
|
-
*/
|
|
138
|
-
declare const linesWiderThan: (lines: readonly string[], columns?: number) => string[];
|
|
139
126
|
//#endregion
|
|
140
127
|
//#region src/setupHandlerIntegrationTestSuite.d.ts
|
|
141
128
|
declare const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
|
|
@@ -183,4 +170,4 @@ declare const pgExecutor: (pool: Pool$1) => SqlExecutor;
|
|
|
183
170
|
declare const pgBatchExecutor: (pool: Pool$1) => SqlExecutor;
|
|
184
171
|
declare const mysqlExecutor: (pool: Pool) => SqlExecutor;
|
|
185
172
|
//#endregion
|
|
186
|
-
export { ClackLogCall, ClackLogMethod, D1TestResult, MockedReactNativeProjectRoot, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, RuntimeChild, RuntimeLogs, SpawnRuntimeOptions, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath,
|
|
173
|
+
export { ClackLogCall, ClackLogMethod, D1TestResult, MockedReactNativeProjectRoot, RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, RuntimeChild, RuntimeLogs, SpawnRuntimeOptions, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath, findOpenPort, formatRuntimeLogs, hasCommand, hasDockerCompose, hasDockerDaemon, killPort, mockReactNativeProjectRoot, mysqlExecutor, pgBatchExecutor, pgExecutor, pgliteBatchExecutor, pgliteExecutor, recordedClackCalls, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, renderClackLog, runCheckedCommand, spawnRuntime, spawnServerProcess, sqliteBatchExecutor, sqliteExecutor, startHttpTestServer, stopRuntime, waitForHttpOk, waitForServer };
|
package/dist/node.mjs
CHANGED
|
@@ -20886,21 +20886,6 @@ const renderClackLog = (calls, { columns = 80 } = {}) => {
|
|
|
20886
20886
|
}
|
|
20887
20887
|
return stripVTControlCharacters(text).replace(/\n+$/, "").split("\n");
|
|
20888
20888
|
};
|
|
20889
|
-
const graphemes = new Intl.Segmenter();
|
|
20890
|
-
const WIDE_PATTERN = /[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6\u{20000}-\u{3FFFD}]|\p{Emoji_Presentation}/u;
|
|
20891
|
-
/**
|
|
20892
|
-
* The columns a line takes in a terminal, as East Asian Width counts them,
|
|
20893
|
-
* not its bytes or code units: `│`, `■`, and `…` take one each, a wide
|
|
20894
|
-
* character or an emoji two, and a combining mark none. The CLI keeps its
|
|
20895
|
-
* own count; this one is the specs' measure of it.
|
|
20896
|
-
*/
|
|
20897
|
-
const displayColumns = (line) => [...graphemes.segment(stripVTControlCharacters(line))].reduce((columns, { segment }) => columns + (/^[\p{M}\p{Cf}\p{Cc}]+$/u.test(segment) ? 0 : WIDE_PATTERN.test(segment) ? 2 : 1), 0);
|
|
20898
|
-
/**
|
|
20899
|
-
* The lines wider than `columns` display columns, which a terminal that
|
|
20900
|
-
* wide wraps, but for a line that is one word after clack's gutter, such
|
|
20901
|
-
* as a URL, which no line break could shorten.
|
|
20902
|
-
*/
|
|
20903
|
-
const linesWiderThan = (lines, columns = 80) => lines.filter((line) => displayColumns(line) > columns && /\s/u.test(line.slice(3).trim()));
|
|
20904
20889
|
//#endregion
|
|
20905
20890
|
//#region src/setupHandlerIntegrationTestSuite.ts
|
|
20906
20891
|
const TEST_ADMIN_AUTH_TOKEN = "hot-updater-test-token";
|
|
@@ -21162,4 +21147,4 @@ const mysqlExecutor = (pool) => {
|
|
|
21162
21147
|
};
|
|
21163
21148
|
};
|
|
21164
21149
|
//#endregion
|
|
21165
|
-
export { RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath,
|
|
21150
|
+
export { RELEASE_CATALOG_DOWNLOAD_HASH, RELEASE_CATALOG_MANIFEST_URIS, RELEASE_CATALOG_STORAGE_FIXTURES, TEST_ADMIN_AUTH_TOKEN, assertCommandAvailable, assertDockerComposeAvailable, assertDockerDaemonAvailable, assertEnvFlagEnabled, cleanupServer, createD1TestDatabase, createReleaseCatalogTestStorage, createTestDbPath, findOpenPort, formatRuntimeLogs, hasCommand, hasDockerCompose, hasDockerDaemon, killPort, mockReactNativeProjectRoot, mysqlExecutor, pgBatchExecutor, pgExecutor, pgliteBatchExecutor, pgliteExecutor, recordedClackCalls, releaseCatalogArtifact, releaseCatalogArtifactFiles, releaseCatalogDownloadUrl, renderClackLog, runCheckedCommand, spawnRuntime, spawnServerProcess, sqliteBatchExecutor, sqliteExecutor, startHttpTestServer, stopRuntime, waitForHttpOk, waitForServer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/test-utils",
|
|
3
|
-
"version": "1.2.0-rc.
|
|
3
|
+
"version": "1.2.0-rc.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Test utilities for Hot Updater packages",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"mysql2": "*",
|
|
51
51
|
"pg": "*",
|
|
52
52
|
"vitest": "^4.0.0",
|
|
53
|
-
"@hot-updater/plugin-insights": "^1.2.0-rc.
|
|
54
|
-
"@hot-updater/protocol": "^1.2.0-rc.
|
|
55
|
-
"@hot-updater/plugin-core": "^1.2.0-rc.
|
|
56
|
-
"@hot-updater/server": "^1.2.0-rc.
|
|
53
|
+
"@hot-updater/plugin-insights": "^1.2.0-rc.13",
|
|
54
|
+
"@hot-updater/protocol": "^1.2.0-rc.13",
|
|
55
|
+
"@hot-updater/plugin-core": "^1.2.0-rc.13",
|
|
56
|
+
"@hot-updater/server": "^1.2.0-rc.13"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@electric-sql/pglite": {
|
|
@@ -84,10 +84,10 @@
|
|
|
84
84
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
85
85
|
"vitest": "4.1.4",
|
|
86
86
|
"workspace-tools": "^0.41.7",
|
|
87
|
-
"@hot-updater/
|
|
88
|
-
"@hot-updater/plugin-
|
|
89
|
-
"@hot-updater/
|
|
90
|
-
"@hot-updater/
|
|
87
|
+
"@hot-updater/protocol": "1.2.0-rc.13",
|
|
88
|
+
"@hot-updater/plugin-insights": "1.2.0-rc.13",
|
|
89
|
+
"@hot-updater/plugin-core": "1.2.0-rc.13",
|
|
90
|
+
"@hot-updater/server": "1.2.0-rc.13"
|
|
91
91
|
},
|
|
92
92
|
"inlinedDependencies": {
|
|
93
93
|
"@nodelib/fs.scandir": "2.1.5",
|