@forthtilliath/expo-test-kit 0.2.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/LICENSE +21 -0
- package/README.md +104 -0
- package/dist/closeTestDb.d.ts +3 -0
- package/dist/closeTestDb.d.ts.map +1 -0
- package/dist/closeTestDb.js +22 -0
- package/dist/createFakeExpoFileSystem.d.ts +25 -0
- package/dist/createFakeExpoFileSystem.d.ts.map +1 -0
- package/dist/createFakeExpoFileSystem.js +52 -0
- package/dist/createTestDb.d.ts +8 -0
- package/dist/createTestDb.d.ts.map +1 -0
- package/dist/createTestDb.js +29 -0
- package/dist/mockDbClient.d.ts +2 -0
- package/dist/mockDbClient.d.ts.map +1 -0
- package/dist/mockDbClient.js +10 -0
- package/dist/resetTestDb.d.ts +4 -0
- package/dist/resetTestDb.d.ts.map +1 -0
- package/dist/resetTestDb.js +10 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Forthtilliath
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# @forthtilliath/expo-test-kit
|
|
2
|
+
|
|
3
|
+
Test helpers for Expo/Drizzle apps: a real in-memory SQLite database (via libsql) to exercise a Drizzle repository's actual SQL, and a lightweight `expo-file-system` fake — both extracted from patterns that were duplicated across test files rather than shared.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @forthtilliath/expo-test-kit drizzle-orm @libsql/client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or, from within this monorepo, as a workspace dependency:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@forthtilliath/expo-test-kit": "workspace:*"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`drizzle-orm` and `@libsql/client` are peer dependencies — install them if not already present. Both are dev-only: `expo-test-kit` doesn't touch your app's production `expo-sqlite` driver, it's a separate in-memory database used only while testing.
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Each function is its own module — import the file you need directly:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import {
|
|
29
|
+
createTestDb,
|
|
30
|
+
type TestDb,
|
|
31
|
+
} from "@forthtilliath/expo-test-kit/createTestDb";
|
|
32
|
+
import { closeTestDb } from "@forthtilliath/expo-test-kit/closeTestDb";
|
|
33
|
+
import { resetTestDb } from "@forthtilliath/expo-test-kit/resetTestDb";
|
|
34
|
+
import { mockDbClient } from "@forthtilliath/expo-test-kit/mockDbClient";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### `createTestDb(schema, migrationsFolder)` / `closeTestDb(db)` / `resetTestDb(db, tables)`
|
|
38
|
+
|
|
39
|
+
A real SQLite database (via `libsql`, in a temp file — not `:memory:`, since some internal libsql connections reopen the database separately) with your actual Drizzle migrations replayed against it, and foreign keys enforced. Lets a repository's tests hit real SQL (constraints, transactions) instead of a mocked driver.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import * as schema from "./schema";
|
|
43
|
+
|
|
44
|
+
let testDb: TestDb<typeof schema>;
|
|
45
|
+
|
|
46
|
+
beforeAll(async () => {
|
|
47
|
+
testDb = await createTestDb(schema, path.join(__dirname, "../../drizzle"));
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
afterAll(() => {
|
|
51
|
+
closeTestDb(testDb);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
beforeEach(async () => {
|
|
55
|
+
// Order matters for foreign keys in "restrict" mode: children before parents.
|
|
56
|
+
await resetTestDb(testDb, [schema.tags, schema.items]);
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### `mockDbClient(doMock, modulePath, testDb)`
|
|
61
|
+
|
|
62
|
+
Substitutes a `TestDb` for the real client exported by a module (typically `"./client"` or `"@/db/client"`), for test files importing a repository built on that client. `doMock` is your test runner's own mock function (`jest.doMock` or `vi.doMock`) — this package has no opinion on which one you use.
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
beforeAll(async () => {
|
|
66
|
+
testDb = await createTestDb(schema, migrationsFolder);
|
|
67
|
+
mockDbClient(jest.doMock, "./client", testDb); // or vi.doMock
|
|
68
|
+
repo = require("./repository"); // after mockDbClient, not hoisted like jest.mock
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### `createFakeExpoFileSystem()` / `getFakeExpoFileSystem()`
|
|
73
|
+
|
|
74
|
+
A minimal in-memory `File`/`Paths` fake — enough to test code that reads/writes files via `expo-file-system`, without the native filesystem (unavailable under Jest/Vitest).
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import {
|
|
78
|
+
createFakeExpoFileSystem,
|
|
79
|
+
getFakeExpoFileSystem,
|
|
80
|
+
} from "@forthtilliath/expo-test-kit/createFakeExpoFileSystem";
|
|
81
|
+
|
|
82
|
+
// jest.mock's factory can't reference an outer variable, so stash + retrieve
|
|
83
|
+
// instead of closing over one:
|
|
84
|
+
jest.mock("expo-file-system", () => createFakeExpoFileSystem());
|
|
85
|
+
|
|
86
|
+
let fakeFs: ReturnType<typeof getFakeExpoFileSystem>;
|
|
87
|
+
|
|
88
|
+
beforeAll(() => {
|
|
89
|
+
fakeFs = getFakeExpoFileSystem();
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Scripts
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pnpm run dev # tsc --watch -> dist/
|
|
97
|
+
pnpm run build # tsc -> dist/
|
|
98
|
+
pnpm run check-types # tsc --noEmit
|
|
99
|
+
pnpm run lint # eslint
|
|
100
|
+
pnpm run test # vitest run
|
|
101
|
+
pnpm run test:watch # vitest
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Built to `dist/` (see the `exports` field in `package.json`), so run `pnpm run build` (or `dev`) after source changes for consumers to see them.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closeTestDb.d.ts","sourceRoot":"","sources":["../src/closeTestDb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAM/D,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,QAc9D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { tempFilesByDb } from "./createTestDb.js";
|
|
3
|
+
// À appeler dans un afterAll : ferme la connexion native libsql (sans quoi le
|
|
4
|
+
// test runner ne se termine pas proprement) et supprime le fichier temporaire
|
|
5
|
+
// (et ses éventuels compagnons -wal/-shm) pour ne pas accumuler des bases de
|
|
6
|
+
// test dans le dossier temp à chaque exécution.
|
|
7
|
+
export function closeTestDb(db) {
|
|
8
|
+
db.$client.close();
|
|
9
|
+
const dbFile = tempFilesByDb.get(db);
|
|
10
|
+
if (!dbFile)
|
|
11
|
+
return;
|
|
12
|
+
for (const file of [dbFile, `${dbFile}-wal`, `${dbFile}-shm`]) {
|
|
13
|
+
try {
|
|
14
|
+
fs.rmSync(file, { force: true });
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Best effort : sur Windows le handle natif peut rester verrouillé
|
|
18
|
+
// brièvement après close(), un fichier de test qui persiste n'est pas
|
|
19
|
+
// grave (dossier temp, nettoyé de toute façon par l'OS).
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface FakeFile {
|
|
2
|
+
uri: string;
|
|
3
|
+
exists: boolean;
|
|
4
|
+
create: () => void;
|
|
5
|
+
write: (content: string) => void;
|
|
6
|
+
delete: () => void;
|
|
7
|
+
text: () => Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
export interface FakeExpoFileSystem {
|
|
10
|
+
store: Map<string, string>;
|
|
11
|
+
File: new (...parts: (string | {
|
|
12
|
+
uri: string;
|
|
13
|
+
})[]) => FakeFile;
|
|
14
|
+
Paths: {
|
|
15
|
+
cache: {
|
|
16
|
+
uri: string;
|
|
17
|
+
};
|
|
18
|
+
document: {
|
|
19
|
+
uri: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function createFakeExpoFileSystem(): FakeExpoFileSystem;
|
|
24
|
+
export declare function getFakeExpoFileSystem(): FakeExpoFileSystem;
|
|
25
|
+
//# sourceMappingURL=createFakeExpoFileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFakeExpoFileSystem.d.ts","sourceRoot":"","sources":["../src/createFakeExpoFileSystem.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,IAAI,EAAE,KAAK,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,KAAK,QAAQ,CAAC;IAC/D,KAAK,EAAE;QAAE,KAAK,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,QAAQ,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CAC9D;AAWD,wBAAgB,wBAAwB,IAAI,kBAAkB,CAsC7D;AAED,wBAAgB,qBAAqB,IAAI,kBAAkB,CAS1D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const GLOBAL_KEY = "__forthtilliathFakeExpoFileSystem";
|
|
2
|
+
// Double léger d'expo-file-system : un simple magasin clé/valeur en mémoire,
|
|
3
|
+
// suffisant pour tester du code lisant/écrivant des fichiers via `File`/
|
|
4
|
+
// `Paths`, sans dépendre du système de fichiers natif (indisponible en
|
|
5
|
+
// Jest/Vitest). Stashé sur `globalThis` plutôt que capturé par une closure,
|
|
6
|
+
// car `jest.mock("expo-file-system", () => ...)` interdit de référencer une
|
|
7
|
+
// variable hors-scope dans sa factory — `getFakeExpoFileSystem()` récupère
|
|
8
|
+
// l'instance après coup, une fois le mock enregistré.
|
|
9
|
+
export function createFakeExpoFileSystem() {
|
|
10
|
+
const store = new Map();
|
|
11
|
+
class File {
|
|
12
|
+
uri;
|
|
13
|
+
constructor(...parts) {
|
|
14
|
+
this.uri = parts
|
|
15
|
+
.map((p) => (typeof p === "string" ? p : p.uri))
|
|
16
|
+
.join("/");
|
|
17
|
+
}
|
|
18
|
+
get exists() {
|
|
19
|
+
return store.has(this.uri);
|
|
20
|
+
}
|
|
21
|
+
create() {
|
|
22
|
+
store.set(this.uri, "");
|
|
23
|
+
}
|
|
24
|
+
write(content) {
|
|
25
|
+
store.set(this.uri, content);
|
|
26
|
+
}
|
|
27
|
+
delete() {
|
|
28
|
+
store.delete(this.uri);
|
|
29
|
+
}
|
|
30
|
+
text() {
|
|
31
|
+
const content = store.get(this.uri);
|
|
32
|
+
if (content === undefined) {
|
|
33
|
+
return Promise.reject(new Error(`Fake file not found: ${this.uri}`));
|
|
34
|
+
}
|
|
35
|
+
return Promise.resolve(content);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const fakeFs = {
|
|
39
|
+
store,
|
|
40
|
+
File,
|
|
41
|
+
Paths: { cache: { uri: "cache" }, document: { uri: "document" } },
|
|
42
|
+
};
|
|
43
|
+
globalThis[GLOBAL_KEY] = fakeFs;
|
|
44
|
+
return fakeFs;
|
|
45
|
+
}
|
|
46
|
+
export function getFakeExpoFileSystem() {
|
|
47
|
+
const fakeFs = globalThis[GLOBAL_KEY];
|
|
48
|
+
if (!fakeFs) {
|
|
49
|
+
throw new Error("getFakeExpoFileSystem() called before createFakeExpoFileSystem() ran.");
|
|
50
|
+
}
|
|
51
|
+
return fakeFs;
|
|
52
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Client } from "@libsql/client";
|
|
2
|
+
import { type LibSQLDatabase } from "drizzle-orm/libsql";
|
|
3
|
+
export type TestDb<TSchema extends Record<string, unknown>> = LibSQLDatabase<TSchema> & {
|
|
4
|
+
$client: Client;
|
|
5
|
+
};
|
|
6
|
+
export declare const tempFilesByDb: WeakMap<object, string>;
|
|
7
|
+
export declare function createTestDb<TSchema extends Record<string, unknown>>(schema: TSchema, migrationsFolder: string): Promise<TestDb<TSchema>>;
|
|
8
|
+
//# sourceMappingURL=createTestDb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTestDb.d.ts","sourceRoot":"","sources":["../src/createTestDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMlE,MAAM,MAAM,MAAM,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACxD,cAAc,CAAC,OAAO,CAAC,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAKJ,eAAO,MAAM,aAAa,yBAAgC,CAAC;AAS3D,wBAAsB,YAAY,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxE,MAAM,EAAE,OAAO,EACf,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAa1B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createClient } from "@libsql/client";
|
|
2
|
+
import { drizzle } from "drizzle-orm/libsql";
|
|
3
|
+
import { migrate } from "drizzle-orm/libsql/migrator";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
// Chemin du fichier temporaire associé à chaque instance, pour le nettoyer
|
|
8
|
+
// dans closeTestDb() sans changer la forme de la valeur retournée par
|
|
9
|
+
// createTestDb() (qui doit rester une TestDb utilisable directement).
|
|
10
|
+
export const tempFilesByDb = new WeakMap();
|
|
11
|
+
// Base SQLite en mémoire (libsql) utilisable dans les tests pour exercer la
|
|
12
|
+
// vraie logique SQL d'un repository Drizzle (contraintes de clé étrangère,
|
|
13
|
+
// transactions...) sans dépendre d'expo-sqlite, indisponible hors d'une
|
|
14
|
+
// app Expo/RN réelle. Contrairement à better-sqlite3/sql.js, le driver
|
|
15
|
+
// libsql de drizzle est en mode "async" comme celui d'expo-sqlite : les
|
|
16
|
+
// transactions avec callback `async (tx) => {...}` fonctionnent donc à
|
|
17
|
+
// l'identique en test et en production.
|
|
18
|
+
export async function createTestDb(schema, migrationsFolder) {
|
|
19
|
+
// Un fichier réel (et non ":memory:") : certaines connexions internes du
|
|
20
|
+
// client libsql ré-ouvrent la base séparément (transactions, migrations),
|
|
21
|
+
// ce qui repartirait sur une base vide à chaque fois avec ":memory:".
|
|
22
|
+
const dbFile = path.join(os.tmpdir(), `expo-test-kit-${randomUUID()}.sqlite`);
|
|
23
|
+
const client = createClient({ url: `file:${dbFile}` });
|
|
24
|
+
const db = drizzle(client, { schema });
|
|
25
|
+
await migrate(db, { migrationsFolder });
|
|
26
|
+
await client.execute("PRAGMA foreign_keys = ON;");
|
|
27
|
+
tempFilesByDb.set(db, dbFile);
|
|
28
|
+
return db;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockDbClient.d.ts","sourceRoot":"","sources":["../src/mockDbClient.ts"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,CAC1B,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,KAAK,IAAI,EAC1D,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,QAGhB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Substitue une TestDb à l'instance réelle exportée par un module (typiquement
|
|
2
|
+
// "./client" ou "@/db/client"), pour les fichiers de test important un
|
|
3
|
+
// repository construit sur ce client. `doMock` reste au choix de l'appelant
|
|
4
|
+
// (`jest.doMock` ou `vi.doMock`) plutôt que codé en dur, ce module n'ayant pas
|
|
5
|
+
// d'opinion sur le test runner utilisé. À appeler dans un beforeAll, avant le
|
|
6
|
+
// require()/import() du module testé : `doMock` n'est pas hoisté comme
|
|
7
|
+
// `jest.mock`/`vi.mock`, donc l'ordre d'appel est respecté.
|
|
8
|
+
export function mockDbClient(doMock, modulePath, testDb) {
|
|
9
|
+
doMock(modulePath, () => ({ db: testDb }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SQLiteTable } from "drizzle-orm/sqlite-core";
|
|
2
|
+
import type { TestDb } from "./createTestDb.js";
|
|
3
|
+
export declare function resetTestDb(db: TestDb<Record<string, unknown>>, tablesInDeleteOrder: SQLiteTable[]): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=resetTestDb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resetTestDb.d.ts","sourceRoot":"","sources":["../src/resetTestDb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOhD,wBAAsB,WAAW,CAC/B,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACnC,mBAAmB,EAAE,WAAW,EAAE,GACjC,OAAO,CAAC,IAAI,CAAC,CAIf"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Vide les tables données entre deux tests, dans l'ordre fourni — c'est à
|
|
2
|
+
// l'appelant de placer en premier les tables dont une contrainte de clé
|
|
3
|
+
// étrangère en "restrict" empêche la suppression tant qu'une autre table les
|
|
4
|
+
// référence encore (les relations en "set null"/"cascade" n'ont pas cette
|
|
5
|
+
// contrainte d'ordre).
|
|
6
|
+
export async function resetTestDb(db, tablesInDeleteOrder) {
|
|
7
|
+
for (const table of tablesInDeleteOrder) {
|
|
8
|
+
await db.delete(table);
|
|
9
|
+
}
|
|
10
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@forthtilliath/expo-test-kit",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/Forthtilliath/turborepo.git",
|
|
12
|
+
"directory": "packages/expo-test-kit"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/Forthtilliath/turborepo/tree/main/packages/expo-test-kit#readme",
|
|
15
|
+
"bugs": "https://github.com/Forthtilliath/turborepo/issues",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
"./*": "./dist/*.js"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@libsql/client": ">=0.14.0",
|
|
24
|
+
"drizzle-orm": ">=0.44.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@libsql/client": "^0.17.4",
|
|
28
|
+
"@types/node": "^26.1.1",
|
|
29
|
+
"drizzle-orm": "^0.45.2",
|
|
30
|
+
"eslint": "10.7.0",
|
|
31
|
+
"typescript": "^5.9.3",
|
|
32
|
+
"vitest": "^4.1.10",
|
|
33
|
+
"@forthtilliath/typescript-config": "0.0.0",
|
|
34
|
+
"@forthtilliath/eslint-config": "0.0.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"lint": "eslint . --max-warnings 0",
|
|
38
|
+
"check-types": "tsc --noEmit",
|
|
39
|
+
"clean": "rm -rf dist",
|
|
40
|
+
"dev": "tsc --watch -p tsconfig.build.json",
|
|
41
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"test:watch": "vitest"
|
|
44
|
+
}
|
|
45
|
+
}
|