mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
Merge remote-tracking branch 'origin/release/0.15' into feat/plugin-improvements
# Conflicts: # app/package.json # app/src/App.ts
This commit is contained in:
@@ -16,6 +16,7 @@ export interface Test {
|
||||
skipIf: (condition: boolean) => (label: string, fn: TestFn) => void;
|
||||
}
|
||||
export type TestRunner = {
|
||||
describe: (label: string, asyncFn: () => Promise<void>) => void;
|
||||
test: Test;
|
||||
mock: <T extends (...args: any[]) => any>(fn: T) => T | any;
|
||||
expect: <T = unknown>(
|
||||
|
||||
12
app/src/core/test/utils.ts
Normal file
12
app/src/core/test/utils.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { createApp as createAppInternal, type CreateAppConfig } from "App";
|
||||
import { bunSqlite } from "adapter/bun/connection/BunSqliteConnection";
|
||||
import { Connection } from "data/connection/Connection";
|
||||
|
||||
export { App } from "App";
|
||||
|
||||
export function createApp({ connection, ...config }: CreateAppConfig = {}) {
|
||||
return createAppInternal({
|
||||
...config,
|
||||
connection: Connection.isConnection(connection) ? connection : bunSqlite(connection as any),
|
||||
});
|
||||
}
|
||||
@@ -48,6 +48,14 @@ export function isNode() {
|
||||
}
|
||||
}
|
||||
|
||||
export function isBun() {
|
||||
try {
|
||||
return typeof Bun !== "undefined";
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function invariant(condition: boolean | any, message: string) {
|
||||
if (!condition) {
|
||||
throw new Error(message);
|
||||
|
||||
Reference in New Issue
Block a user