mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 21:06:04 +00:00
chore: bump version to 0.18.0-rc.4 and enhance test logging
Updated the package version to 0.18.0-rc.4. Improved test logging by disabling console output during tests to reduce noise and enhance readability. Adjusted various test files to implement console log management, ensuring cleaner test outputs.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { TestRunner } from "core/test";
|
||||
import type { BkndConfig, DefaultArgs } from "./index";
|
||||
import type { App } from "App";
|
||||
import { disableConsoleLog, enableConsoleLog } from "core/utils/test";
|
||||
|
||||
export function adapterTestSuite<
|
||||
Config extends BkndConfig = BkndConfig,
|
||||
@@ -21,7 +22,9 @@ export function adapterTestSuite<
|
||||
};
|
||||
},
|
||||
) {
|
||||
const { test, expect, mock } = testRunner;
|
||||
const { test, expect, mock, beforeAll, afterAll } = testRunner;
|
||||
beforeAll(() => disableConsoleLog());
|
||||
afterAll(() => enableConsoleLog());
|
||||
|
||||
test(`creates ${label}`, async () => {
|
||||
const beforeBuild = mock(async () => null) as any;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { expect, test, mock, describe, beforeEach, afterEach, afterAll } from "bun:test";
|
||||
import { expect, test, mock, describe, beforeEach, afterEach, afterAll, beforeAll } from "bun:test";
|
||||
|
||||
export const bunTestRunner = {
|
||||
describe,
|
||||
@@ -8,4 +8,5 @@ export const bunTestRunner = {
|
||||
beforeEach,
|
||||
afterEach,
|
||||
afterAll,
|
||||
beforeAll,
|
||||
};
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/// <reference types="@cloudflare/workers-types" />
|
||||
|
||||
import { describe, test, expect } from "vitest";
|
||||
import { describe, beforeAll, afterAll } from "vitest";
|
||||
|
||||
import { viTestRunner } from "adapter/node/vitest";
|
||||
import { connectionTestSuite } from "data/connection/connection-test-suite";
|
||||
import { Miniflare } from "miniflare";
|
||||
import { doSqlite } from "./DoConnection";
|
||||
import { disableConsoleLog, enableConsoleLog } from "core/utils/test";
|
||||
|
||||
const script = `
|
||||
import { DurableObject } from "cloudflare:workers";
|
||||
@@ -40,6 +41,9 @@ export default {
|
||||
}
|
||||
`;
|
||||
|
||||
beforeAll(() => disableConsoleLog());
|
||||
afterAll(() => enableConsoleLog());
|
||||
|
||||
describe("doSqlite", async () => {
|
||||
connectionTestSuite(viTestRunner, {
|
||||
makeConnection: async () => {
|
||||
|
||||
@@ -3,6 +3,10 @@ import { cacheWorkersKV } from "./cache";
|
||||
import { viTestRunner } from "adapter/node/vitest";
|
||||
import { cacheDriverTestSuite } from "core/drivers/cache/cache-driver-test-suite";
|
||||
import { Miniflare } from "miniflare";
|
||||
import { disableConsoleLog, enableConsoleLog } from "core/utils/test";
|
||||
|
||||
beforeAll(() => disableConsoleLog());
|
||||
afterAll(() => enableConsoleLog());
|
||||
|
||||
describe("cacheWorkersKV", async () => {
|
||||
beforeAll(() => {
|
||||
|
||||
@@ -3,8 +3,12 @@ import { Miniflare } from "miniflare";
|
||||
import { StorageR2Adapter } from "./StorageR2Adapter";
|
||||
import { adapterTestSuite } from "media/storage/adapters/adapter-test-suite";
|
||||
import path from "node:path";
|
||||
import { describe, afterAll, test, expect } from "vitest";
|
||||
import { describe, afterAll, test, expect, beforeAll } from "vitest";
|
||||
import { viTestRunner } from "adapter/node/vitest";
|
||||
import { disableConsoleLog, enableConsoleLog } from "core/utils/test";
|
||||
|
||||
beforeAll(() => disableConsoleLog());
|
||||
afterAll(() => enableConsoleLog());
|
||||
|
||||
let mf: Miniflare | undefined;
|
||||
describe("StorageR2Adapter", async () => {
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import { nodeSqlite } from "./NodeSqliteConnection";
|
||||
import { DatabaseSync } from "node:sqlite";
|
||||
import { connectionTestSuite } from "data/connection/connection-test-suite";
|
||||
import { describe } from "vitest";
|
||||
import { describe, beforeAll, afterAll } from "vitest";
|
||||
import { viTestRunner } from "../vitest";
|
||||
import { disableConsoleLog, enableConsoleLog } from "core/utils/test";
|
||||
|
||||
beforeAll(() => disableConsoleLog());
|
||||
afterAll(() => enableConsoleLog());
|
||||
|
||||
describe("NodeSqliteConnection", () => {
|
||||
connectionTestSuite(viTestRunner, {
|
||||
|
||||
@@ -2,10 +2,6 @@ import { describe, beforeAll, afterAll } from "vitest";
|
||||
import * as node from "./node.adapter";
|
||||
import { adapterTestSuite } from "adapter/adapter-test-suite";
|
||||
import { viTestRunner } from "adapter/node/vitest";
|
||||
import { disableConsoleLog, enableConsoleLog } from "core/utils";
|
||||
|
||||
beforeAll(() => disableConsoleLog());
|
||||
afterAll(enableConsoleLog);
|
||||
|
||||
describe("node adapter", () => {
|
||||
adapterTestSuite(viTestRunner, {
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import { describe } from "vitest";
|
||||
import { describe, beforeAll, afterAll } from "vitest";
|
||||
import { viTestRunner } from "adapter/node/vitest";
|
||||
import { StorageLocalAdapter } from "adapter/node";
|
||||
import { adapterTestSuite } from "media/storage/adapters/adapter-test-suite";
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { disableConsoleLog, enableConsoleLog } from "core/utils/test";
|
||||
|
||||
beforeAll(() => disableConsoleLog());
|
||||
afterAll(() => enableConsoleLog());
|
||||
|
||||
describe("StorageLocalAdapter (node)", async () => {
|
||||
const basePath = path.resolve(import.meta.dirname, "../../../../__test__/_assets");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import nodeAssert from "node:assert/strict";
|
||||
import { test, describe, beforeEach, afterEach } from "node:test";
|
||||
import { test, describe, beforeEach, afterEach, after, before } from "node:test";
|
||||
import type { Matcher, Test, TestFn, TestRunner } from "core/test";
|
||||
|
||||
// Track mock function calls
|
||||
@@ -99,5 +99,6 @@ export const nodeTestRunner: TestRunner = {
|
||||
}),
|
||||
beforeEach: beforeEach,
|
||||
afterEach: afterEach,
|
||||
afterAll: () => {},
|
||||
afterAll: after,
|
||||
beforeAll: before,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { TestFn, TestRunner, Test } from "core/test";
|
||||
import { describe, test, expect, vi, beforeEach, afterEach, afterAll } from "vitest";
|
||||
import { describe, test, expect, vi, beforeEach, afterEach, afterAll, beforeAll } from "vitest";
|
||||
|
||||
function vitestTest(label: string, fn: TestFn, options?: any) {
|
||||
return test(label, fn as any);
|
||||
@@ -50,4 +50,5 @@ export const viTestRunner: TestRunner = {
|
||||
beforeEach: beforeEach,
|
||||
afterEach: afterEach,
|
||||
afterAll: afterAll,
|
||||
beforeAll: beforeAll,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user