fix(docs):Docs and Exports
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/push/publish unknown status

- Add documentation for recently released changes
- Update some exports to include enums
This commit is contained in:
2026-08-21 11:45:56 -03:00
parent 2134ba58b8
commit f464fa5017
18 changed files with 1350 additions and 1307 deletions
+15 -15
View File
@@ -1,14 +1,14 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { createConsoleSink } from "../src/index";
import type { LogEvent } from "../src/index";
import { afterEach, describe, expect, it, vi } from 'vitest';
import { createConsoleSink } from '../src/index';
import type { LogEvent } from '../src/index';
function event(overrides: Partial<LogEvent> = {}): LogEvent {
return {
level: "debug",
namespace: "API",
arguments: ["hello"],
level: 'debug',
namespace: 'API',
arguments: ['hello'],
timestamp: new Date(),
environment: "development",
environment: 'development',
sendToSentryLogs: false,
sendToSentryIssue: false,
sendToConsole: true,
@@ -16,25 +16,25 @@ function event(overrides: Partial<LogEvent> = {}): LogEvent {
};
}
describe("createConsoleSink", () => {
describe('createConsoleSink', () => {
afterEach(() => {
vi.restoreAllMocks();
});
it("appends [async] to the namespace label when event.async is set", () => {
const debug = vi.spyOn(console, "debug").mockImplementation(() => undefined);
it('appends [async] to the namespace label when event.async is set', () => {
const debug = vi.spyOn(console, 'debug').mockImplementation(() => undefined);
createConsoleSink().emit(event({ async: true }));
expect(debug).toHaveBeenCalled();
const first = debug.mock.calls[0]?.[0];
expect(String(first)).toContain("[API][async]");
expect(String(first)).toContain('[API][async]');
});
it("omits [async] for synchronous events", () => {
const debug = vi.spyOn(console, "debug").mockImplementation(() => undefined);
it('omits [async] for synchronous events', () => {
const debug = vi.spyOn(console, 'debug').mockImplementation(() => undefined);
createConsoleSink().emit(event());
expect(debug).toHaveBeenCalled();
const first = debug.mock.calls[0]?.[0];
expect(String(first)).toContain("[API]");
expect(String(first)).not.toContain("[async]");
expect(String(first)).toContain('[API]');
expect(String(first)).not.toContain('[async]');
});
});