@logtape/testing 2.2.0-dev.718 → 2.2.0-dev.720
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/mod.cjs +12 -9
- package/dist/mod.js +12 -9
- package/dist/mod.js.map +1 -1
- package/package.json +3 -3
package/dist/mod.cjs
CHANGED
|
@@ -103,7 +103,8 @@ function matchesCategoryPrefix(category, prefix) {
|
|
|
103
103
|
return expectedPrefix.length <= category.length && expectedPrefix.every((part, index) => part === category[index]);
|
|
104
104
|
}
|
|
105
105
|
function parseCategory(category) {
|
|
106
|
-
|
|
106
|
+
if (typeof category !== "string") return category;
|
|
107
|
+
return category === "" ? [] : category.split(".");
|
|
107
108
|
}
|
|
108
109
|
function matchesMessage(renderedMessage, record, matcher) {
|
|
109
110
|
if (typeof matcher === "function") return matcher(record);
|
|
@@ -113,16 +114,17 @@ function matchesText(text, matcher) {
|
|
|
113
114
|
return typeof matcher === "string" ? text === matcher : testRegExp(matcher, text);
|
|
114
115
|
}
|
|
115
116
|
function matchesProperties(properties, record, matcher) {
|
|
116
|
-
|
|
117
|
+
const props = properties ?? {};
|
|
118
|
+
if (typeof matcher === "function") return matcher(props, record);
|
|
117
119
|
for (const key of Object.keys(matcher)) {
|
|
118
|
-
if (!Object.hasOwn(
|
|
119
|
-
if (!Object.is(
|
|
120
|
+
if (!Object.hasOwn(props, key)) return false;
|
|
121
|
+
if (!Object.is(props[key], matcher[key])) return false;
|
|
120
122
|
}
|
|
121
123
|
return true;
|
|
122
124
|
}
|
|
123
125
|
function testRegExp(pattern, text) {
|
|
124
|
-
|
|
125
|
-
const clone = new RegExp(pattern.source, flags);
|
|
126
|
+
if (!pattern.global && !pattern.sticky) return pattern.test(text);
|
|
127
|
+
const clone = new RegExp(pattern.source, pattern.flags);
|
|
126
128
|
return clone.test(text);
|
|
127
129
|
}
|
|
128
130
|
function renderRawMessage(rawMessage) {
|
|
@@ -136,7 +138,7 @@ function renderMessage(message) {
|
|
|
136
138
|
function renderMessagePart(part) {
|
|
137
139
|
if (typeof part === "string") return part;
|
|
138
140
|
if (typeof part === "bigint") return `${part}n`;
|
|
139
|
-
if (part instanceof Error) return part.message
|
|
141
|
+
if (part instanceof Error) return `${part.name}: ${part.message}`;
|
|
140
142
|
if (part instanceof RegExp) return String(part);
|
|
141
143
|
if (part instanceof Date) try {
|
|
142
144
|
return part.toISOString();
|
|
@@ -193,9 +195,10 @@ function formatCategory(category) {
|
|
|
193
195
|
return category.length < 1 ? "<root>" : category.join(".");
|
|
194
196
|
}
|
|
195
197
|
function formatProperties(properties) {
|
|
196
|
-
const
|
|
198
|
+
const props = properties ?? {};
|
|
199
|
+
const entries = Object.keys(props);
|
|
197
200
|
if (entries.length < 1) return "";
|
|
198
|
-
const summary = entries.slice(0, 3).map((key) => `${key}: ${formatValue(
|
|
201
|
+
const summary = entries.slice(0, 3).map((key) => `${key}: ${formatValue(props[key])}`);
|
|
199
202
|
if (entries.length > 3) summary.push(`... ${entries.length - 3} more`);
|
|
200
203
|
return ` {${summary.join(", ")}}`;
|
|
201
204
|
}
|
package/dist/mod.js
CHANGED
|
@@ -102,7 +102,8 @@ function matchesCategoryPrefix(category, prefix) {
|
|
|
102
102
|
return expectedPrefix.length <= category.length && expectedPrefix.every((part, index) => part === category[index]);
|
|
103
103
|
}
|
|
104
104
|
function parseCategory(category) {
|
|
105
|
-
|
|
105
|
+
if (typeof category !== "string") return category;
|
|
106
|
+
return category === "" ? [] : category.split(".");
|
|
106
107
|
}
|
|
107
108
|
function matchesMessage(renderedMessage, record, matcher) {
|
|
108
109
|
if (typeof matcher === "function") return matcher(record);
|
|
@@ -112,16 +113,17 @@ function matchesText(text, matcher) {
|
|
|
112
113
|
return typeof matcher === "string" ? text === matcher : testRegExp(matcher, text);
|
|
113
114
|
}
|
|
114
115
|
function matchesProperties(properties, record, matcher) {
|
|
115
|
-
|
|
116
|
+
const props = properties ?? {};
|
|
117
|
+
if (typeof matcher === "function") return matcher(props, record);
|
|
116
118
|
for (const key of Object.keys(matcher)) {
|
|
117
|
-
if (!Object.hasOwn(
|
|
118
|
-
if (!Object.is(
|
|
119
|
+
if (!Object.hasOwn(props, key)) return false;
|
|
120
|
+
if (!Object.is(props[key], matcher[key])) return false;
|
|
119
121
|
}
|
|
120
122
|
return true;
|
|
121
123
|
}
|
|
122
124
|
function testRegExp(pattern, text) {
|
|
123
|
-
|
|
124
|
-
const clone = new RegExp(pattern.source, flags);
|
|
125
|
+
if (!pattern.global && !pattern.sticky) return pattern.test(text);
|
|
126
|
+
const clone = new RegExp(pattern.source, pattern.flags);
|
|
125
127
|
return clone.test(text);
|
|
126
128
|
}
|
|
127
129
|
function renderRawMessage(rawMessage) {
|
|
@@ -135,7 +137,7 @@ function renderMessage(message) {
|
|
|
135
137
|
function renderMessagePart(part) {
|
|
136
138
|
if (typeof part === "string") return part;
|
|
137
139
|
if (typeof part === "bigint") return `${part}n`;
|
|
138
|
-
if (part instanceof Error) return part.message
|
|
140
|
+
if (part instanceof Error) return `${part.name}: ${part.message}`;
|
|
139
141
|
if (part instanceof RegExp) return String(part);
|
|
140
142
|
if (part instanceof Date) try {
|
|
141
143
|
return part.toISOString();
|
|
@@ -192,9 +194,10 @@ function formatCategory(category) {
|
|
|
192
194
|
return category.length < 1 ? "<root>" : category.join(".");
|
|
193
195
|
}
|
|
194
196
|
function formatProperties(properties) {
|
|
195
|
-
const
|
|
197
|
+
const props = properties ?? {};
|
|
198
|
+
const entries = Object.keys(props);
|
|
196
199
|
if (entries.length < 1) return "";
|
|
197
|
-
const summary = entries.slice(0, 3).map((key) => `${key}: ${formatValue(
|
|
200
|
+
const summary = entries.slice(0, 3).map((key) => `${key}: ${formatValue(props[key])}`);
|
|
198
201
|
if (entries.length > 3) summary.push(`... ${entries.length - 3} more`);
|
|
199
202
|
return ` {${summary.join(", ")}}`;
|
|
200
203
|
}
|
package/dist/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","names":["records: LogRecord[]","sink: Sink","record: LogRecord","match: LogRecordMatch","category: readonly string[]","expected: string | readonly string[] | RegExp","prefix: string | readonly string[]","category: string | readonly string[]","renderedMessage: string","matcher: string | RegExp | ((record: LogRecord) => boolean)","text: string","matcher: string | RegExp","properties: Readonly<Record<string, unknown>>","matcher: Readonly<Record<string, unknown>> | PropertyMatcher","pattern: RegExp","rawMessage: string | TemplateStringsArray","message: readonly unknown[]","part: unknown","lines: string[]","category: string | readonly string[] | RegExp","records: readonly LogRecord[]","count: number","noun: string","value: unknown"],"sources":["../src/mod.ts"],"sourcesContent":["import type { LogLevel, LogRecord, Sink } from \"@logtape/logtape\";\n\n/**\n * A predicate that matches log record properties.\n *\n * The first argument is the resolved properties object. The second argument\n * is the full log record for cases where the predicate needs category, level,\n * or message context.\n *\n * @since 2.2.0\n */\nexport type PropertyMatcher = (\n properties: Readonly<Record<string, unknown>>,\n record: LogRecord,\n) => boolean;\n\n/**\n * A matcher for records collected by a {@link LogRecorder}.\n *\n * Object property matching is shallow: every own string key in the matcher\n * must exist on the record properties and have the same value according to\n * `Object.is()`. Use a {@link PropertyMatcher} when a test needs absence\n * checks or deeper matching.\n *\n * @since 2.2.0\n */\nexport interface LogRecordMatch {\n /**\n * Exact category matcher. A string is matched against the dot-joined\n * category, while an array is matched segment by segment. A regular\n * expression is tested against the dot-joined category.\n */\n readonly category?: string | readonly string[] | RegExp;\n\n /**\n * Category prefix matcher. A string is split on dots, while an array is\n * matched segment by segment.\n */\n readonly categoryPrefix?: string | readonly string[];\n\n /**\n * Exact severity level matcher.\n */\n readonly level?: LogLevel;\n\n /**\n * Rendered message matcher. String and regular expression matchers are\n * applied to the rendered message. A predicate receives the full record.\n */\n readonly message?: string | RegExp | ((record: LogRecord) => boolean);\n\n /**\n * Raw message matcher. A string record is matched directly. A tagged\n * template record is matched against the concatenated template strings.\n */\n readonly rawMessage?: string | RegExp;\n\n /**\n * Shallow property matcher or predicate.\n */\n readonly properties?: Readonly<Record<string, unknown>> | PropertyMatcher;\n\n /**\n * Full-record predicate for custom checks.\n */\n readonly predicate?: (record: LogRecord) => boolean;\n}\n\n/**\n * A test recorder for LogTape records.\n *\n * @since 2.2.0\n */\nexport interface LogRecorder {\n /**\n * A sink that appends each received record to {@link LogRecorder.records}.\n */\n readonly sink: Sink;\n\n /**\n * Records collected so far, in sink call order.\n */\n readonly records: readonly LogRecord[];\n\n /**\n * Removes all collected records.\n */\n clear(): void;\n\n /**\n * Returns collected records and clears the recorder.\n */\n take(): readonly LogRecord[];\n\n /**\n * Finds the first collected record matching the given matcher.\n *\n * @param match The matcher to apply.\n * @returns The first matching record, or `undefined`.\n */\n find(match: LogRecordMatch): LogRecord | undefined;\n\n /**\n * Finds all collected records matching the given matcher.\n *\n * @param match The matcher to apply.\n * @returns All matching records in collection order.\n */\n filter(match: LogRecordMatch): readonly LogRecord[];\n\n /**\n * Asserts that at least one collected record matches the given matcher.\n *\n * @param match The matcher to apply.\n * @throws {Error} If no matching record exists.\n */\n assertLogged(match: LogRecordMatch): void;\n\n /**\n * Asserts that no collected record matches the given matcher.\n *\n * @param match The matcher to apply.\n * @throws {Error} If a matching record exists.\n */\n assertNotLogged(match: LogRecordMatch): void;\n}\n\n/**\n * Creates a LogTape test recorder.\n *\n * @example\n * ```ts\n * import { configure, getLogger, reset } from \"@logtape/logtape\";\n * import { createLogRecorder } from \"@logtape/testing\";\n *\n * const recorder = createLogRecorder();\n *\n * try {\n * await configure({\n * sinks: { recorder: recorder.sink },\n * loggers: [\n * { category: [\"my-lib\"], lowestLevel: \"debug\", sinks: [\"recorder\"] },\n * ],\n * });\n *\n * getLogger([\"my-lib\"]).info(\"User {userId} logged in.\", {\n * userId: \"u-123\",\n * });\n *\n * recorder.assertLogged({\n * category: [\"my-lib\"],\n * level: \"info\",\n * message: \"User u-123 logged in.\",\n * properties: { userId: \"u-123\" },\n * });\n * } finally {\n * await reset();\n * }\n * ```\n *\n * @returns A recorder with a sink and assertion helpers.\n * @since 2.2.0\n */\nexport function createLogRecorder(): LogRecorder {\n const records: LogRecord[] = [];\n const sink: Sink = (record: LogRecord): void => {\n records.push(record);\n };\n\n return {\n sink,\n get records(): readonly LogRecord[] {\n return records;\n },\n clear(): void {\n records.length = 0;\n },\n take(): readonly LogRecord[] {\n return records.splice(0);\n },\n find(match: LogRecordMatch): LogRecord | undefined {\n return records.find((record) => matchesLogRecord(record, match));\n },\n filter(match: LogRecordMatch): readonly LogRecord[] {\n return records.filter((record) => matchesLogRecord(record, match));\n },\n assertLogged(match: LogRecordMatch): void {\n if (records.some((record) => matchesLogRecord(record, match))) return;\n\n throw new Error(\n [\n \"Expected a LogTape record matching:\",\n formatMatcher(match),\n \"\",\n `Recorded ${formatCount(records.length, \"record\")}:`,\n formatRecords(records),\n ].join(\"\\n\"),\n );\n },\n assertNotLogged(match: LogRecordMatch): void {\n const matching = records.filter((record) =>\n matchesLogRecord(record, match)\n );\n if (matching.length < 1) return;\n\n throw new Error(\n [\n \"Expected no LogTape record matching:\",\n formatMatcher(match),\n \"\",\n `Found ${formatCount(matching.length, \"matching record\")}:`,\n formatRecords(matching),\n ].join(\"\\n\"),\n );\n },\n };\n}\n\nfunction matchesLogRecord(record: LogRecord, match: LogRecordMatch): boolean {\n if (\n match.category != null &&\n !matchesCategory(record.category, match.category)\n ) {\n return false;\n }\n if (\n match.categoryPrefix != null &&\n !matchesCategoryPrefix(record.category, match.categoryPrefix)\n ) {\n return false;\n }\n if (match.level != null && record.level !== match.level) return false;\n if (\n match.message != null &&\n !matchesMessage(renderMessage(record.message), record, match.message)\n ) {\n return false;\n }\n if (\n match.rawMessage != null &&\n !matchesText(renderRawMessage(record.rawMessage), match.rawMessage)\n ) {\n return false;\n }\n if (\n match.properties != null &&\n !matchesProperties(record.properties, record, match.properties)\n ) {\n return false;\n }\n if (match.predicate != null && !match.predicate(record)) return false;\n return true;\n}\n\nfunction matchesCategory(\n category: readonly string[],\n expected: string | readonly string[] | RegExp,\n): boolean {\n const joinedCategory = category.join(\".\");\n if (expected instanceof RegExp) {\n return testRegExp(expected, joinedCategory);\n }\n if (typeof expected === \"string\") {\n return joinedCategory === expected;\n }\n const expectedCategory = parseCategory(expected);\n return category.length === expectedCategory.length &&\n category.every((part, index) => part === expectedCategory[index]);\n}\n\nfunction matchesCategoryPrefix(\n category: readonly string[],\n prefix: string | readonly string[],\n): boolean {\n const expectedPrefix = parseCategory(prefix);\n return expectedPrefix.length <= category.length &&\n expectedPrefix.every((part, index) => part === category[index]);\n}\n\nfunction parseCategory(\n category: string | readonly string[],\n): readonly string[] {\n return typeof category === \"string\" ? category.split(\".\") : category;\n}\n\nfunction matchesMessage(\n renderedMessage: string,\n record: LogRecord,\n matcher: string | RegExp | ((record: LogRecord) => boolean),\n): boolean {\n if (typeof matcher === \"function\") return matcher(record);\n return matchesText(renderedMessage, matcher);\n}\n\nfunction matchesText(text: string, matcher: string | RegExp): boolean {\n return typeof matcher === \"string\"\n ? text === matcher\n : testRegExp(matcher, text);\n}\n\nfunction matchesProperties(\n properties: Readonly<Record<string, unknown>>,\n record: LogRecord,\n matcher: Readonly<Record<string, unknown>> | PropertyMatcher,\n): boolean {\n if (typeof matcher === \"function\") return matcher(properties, record);\n for (const key of Object.keys(matcher)) {\n if (!Object.hasOwn(properties, key)) return false;\n if (!Object.is(properties[key], matcher[key])) return false;\n }\n return true;\n}\n\nfunction testRegExp(pattern: RegExp, text: string): boolean {\n const flags = pattern.flags;\n const clone = new RegExp(pattern.source, flags);\n return clone.test(text);\n}\n\nfunction renderRawMessage(rawMessage: string | TemplateStringsArray): string {\n return typeof rawMessage === \"string\" ? rawMessage : [...rawMessage].join(\"\");\n}\n\nfunction renderMessage(message: readonly unknown[]): string {\n let rendered = \"\";\n for (const part of message) {\n rendered += renderMessagePart(part);\n }\n return rendered;\n}\n\nfunction renderMessagePart(part: unknown): string {\n if (typeof part === \"string\") return part;\n if (typeof part === \"bigint\") return `${part}n`;\n if (part instanceof Error) return part.message;\n if (part instanceof RegExp) return String(part);\n if (part instanceof Date) {\n try {\n return part.toISOString();\n } catch {\n return String(part);\n }\n }\n if (part == null) return String(part);\n if (typeof part === \"object\") {\n try {\n return JSON.stringify(part) ?? String(part);\n } catch {\n return String(part);\n }\n }\n return String(part);\n}\n\nfunction formatMatcher(match: LogRecordMatch): string {\n const lines: string[] = [];\n if (match.category != null) {\n lines.push(` category: ${formatCategoryMatcher(match.category)}`);\n }\n if (match.categoryPrefix != null) {\n lines.push(\n ` categoryPrefix: ${\n formatCategoryValue(parseCategory(match.categoryPrefix))\n }`,\n );\n }\n if (match.level != null) lines.push(` level: ${formatValue(match.level)}`);\n if (match.message != null) {\n lines.push(` message: ${formatMessageMatcher(match.message)}`);\n }\n if (match.rawMessage != null) {\n lines.push(` rawMessage: ${formatTextMatcher(match.rawMessage)}`);\n }\n if (match.properties != null) {\n lines.push(...formatPropertiesMatcher(match.properties));\n }\n if (match.predicate != null) lines.push(\" predicate: <predicate>\");\n return lines.length < 1 ? \" <any record>\" : lines.join(\"\\n\");\n}\n\nfunction formatCategoryMatcher(\n category: string | readonly string[] | RegExp,\n): string {\n return category instanceof RegExp\n ? String(category)\n : typeof category === \"string\"\n ? formatValue(category)\n : formatCategoryValue(category);\n}\n\nfunction formatCategoryValue(category: readonly string[]): string {\n return `[${category.map((part) => formatValue(part)).join(\", \")}]`;\n}\n\nfunction formatMessageMatcher(\n matcher: string | RegExp | ((record: LogRecord) => boolean),\n): string {\n return typeof matcher === \"function\" ? \"<predicate>\" : formatTextMatcher(\n matcher,\n );\n}\n\nfunction formatTextMatcher(matcher: string | RegExp): string {\n return typeof matcher === \"string\" ? formatValue(matcher) : String(matcher);\n}\n\nfunction formatPropertiesMatcher(\n matcher: Readonly<Record<string, unknown>> | PropertyMatcher,\n): string[] {\n if (typeof matcher === \"function\") return [\" properties: <predicate>\"];\n const lines = Object.keys(matcher).map((key) =>\n ` properties.${key}: ${formatValue(matcher[key])}`\n );\n return lines.length < 1 ? [\" properties: {}\"] : lines;\n}\n\nfunction formatRecords(records: readonly LogRecord[]): string {\n if (records.length < 1) return \" <none>\";\n const lines = records.slice(0, 3).map(formatRecord);\n if (records.length > 3) {\n lines.push(` ... ${records.length - 3} more`);\n }\n return lines.join(\"\\n\");\n}\n\nfunction formatRecord(record: LogRecord): string {\n const category = formatCategory(record.category);\n return ` [${record.level}] ${category}: ${renderMessage(record.message)}${\n formatProperties(record.properties)\n }`;\n}\n\nfunction formatCategory(category: readonly string[]): string {\n return category.length < 1 ? \"<root>\" : category.join(\".\");\n}\n\nfunction formatProperties(\n properties: Readonly<Record<string, unknown>>,\n): string {\n const entries = Object.keys(properties);\n if (entries.length < 1) return \"\";\n const summary = entries.slice(0, 3).map((key) =>\n `${key}: ${formatValue(properties[key])}`\n );\n if (entries.length > 3) summary.push(`... ${entries.length - 3} more`);\n return ` {${summary.join(\", \")}}`;\n}\n\nfunction formatCount(count: number, noun: string): string {\n return `${count} ${noun}${count === 1 ? \"\" : \"s\"}`;\n}\n\nfunction formatValue(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"bigint\") return `${value}n`;\n if (typeof value === \"symbol\") return String(value);\n if (value instanceof RegExp) return String(value);\n if (value instanceof Error) {\n return `${value.name}: ${value.message}`;\n }\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return String(value);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmKA,SAAgB,oBAAiC;CAC/C,MAAMA,UAAuB,CAAE;CAC/B,MAAMC,OAAa,CAACC,WAA4B;AAC9C,UAAQ,KAAK,OAAO;CACrB;AAED,QAAO;EACL;EACA,IAAI,UAAgC;AAClC,UAAO;EACR;EACD,QAAc;AACZ,WAAQ,SAAS;EAClB;EACD,OAA6B;AAC3B,UAAO,QAAQ,OAAO,EAAE;EACzB;EACD,KAAKC,OAA8C;AACjD,UAAO,QAAQ,KAAK,CAAC,WAAW,iBAAiB,QAAQ,MAAM,CAAC;EACjE;EACD,OAAOA,OA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AM,GAAG,EAAE,CAAC,IAAI,CAAC,SACtC,EAAE,IAAI,IAAI,YAAY,WAAW,KAAK,CAAC,EACzC;AACD,KAAI,QAAQ,SAAS,EAAG,SAAQ,MAAM,MAAM,QAAQ,SAAS,EAAE,OAAO;AACtE,SAAQ,IAAI,QAAQ,KAAK,KAAK,CAAC;AAChC;AAED,SAAS,YAAYS,OAAeC,MAAsB;AACxD,SAAQ,EAAE,MAAM,GAAG,KAAK,EAAE,UAAU,IAAI,KAAK,IAAI;AAClD;AAED,SAAS,YAAYC,OAAwB;AAC3C,YAAW,UAAU,SAAU,QAAO,KAAK,UAAU,MAAM;AAC3D,YAAW,UAAU,SAAU,SAAQ,EAAE,MAAM;AAC/C,YAAW,UAAU,SAAU,QAAO,OAAO,MAAM;AACnD,KAAI,iBAAiB,OAAQ,QAAO,OAAO,MAAM;AACjD,KAAI,iBAAiB,MACnB,SAAQ,EAAE,MAAM,KAAK,IAAI,MAAM,QAAQ;AAEzC,KAAI;AACF,SAAO,KAAK,UAAU,MAAM,IAAI,OAAO,MAAM;CAC9C,QAAO;AACN,SAAO,OAAO,MAAM;CACrB;AACF"}
|
|
1
|
+
{"version":3,"file":"mod.js","names":["records: LogRecord[]","sink: Sink","record: LogRecord","match: LogRecordMatch","category: readonly string[]","expected: string | readonly string[] | RegExp","prefix: string | readonly string[]","category: string | readonly string[]","renderedMessage: string","matcher: string | RegExp | ((record: LogRecord) => boolean)","text: string","matcher: string | RegExp","properties: Readonly<Record<string, unknown>> | null | undefined","matcher: Readonly<Record<string, unknown>> | PropertyMatcher","pattern: RegExp","rawMessage: string | TemplateStringsArray","message: readonly unknown[]","part: unknown","lines: string[]","category: string | readonly string[] | RegExp","records: readonly LogRecord[]","count: number","noun: string","value: unknown"],"sources":["../src/mod.ts"],"sourcesContent":["import type { LogLevel, LogRecord, Sink } from \"@logtape/logtape\";\n\n/**\n * A predicate that matches log record properties.\n *\n * The first argument is the resolved properties object. The second argument\n * is the full log record for cases where the predicate needs category, level,\n * or message context.\n *\n * @since 2.2.0\n */\nexport type PropertyMatcher = (\n properties: Readonly<Record<string, unknown>>,\n record: LogRecord,\n) => boolean;\n\n/**\n * A matcher for records collected by a {@link LogRecorder}.\n *\n * Object property matching is shallow: every own string key in the matcher\n * must exist on the record properties and have the same value according to\n * `Object.is()`. Use a {@link PropertyMatcher} when a test needs absence\n * checks or deeper matching.\n *\n * @since 2.2.0\n */\nexport interface LogRecordMatch {\n /**\n * Exact category matcher. A string is matched against the dot-joined\n * category, while an array is matched segment by segment. A regular\n * expression is tested against the dot-joined category.\n */\n readonly category?: string | readonly string[] | RegExp;\n\n /**\n * Category prefix matcher. A string is split on dots, while an array is\n * matched segment by segment.\n */\n readonly categoryPrefix?: string | readonly string[];\n\n /**\n * Exact severity level matcher.\n */\n readonly level?: LogLevel;\n\n /**\n * Rendered message matcher. String and regular expression matchers are\n * applied to the rendered message. A predicate receives the full record.\n */\n readonly message?: string | RegExp | ((record: LogRecord) => boolean);\n\n /**\n * Raw message matcher. A string record is matched directly. A tagged\n * template record is matched against the concatenated template strings.\n */\n readonly rawMessage?: string | RegExp;\n\n /**\n * Shallow property matcher or predicate.\n */\n readonly properties?: Readonly<Record<string, unknown>> | PropertyMatcher;\n\n /**\n * Full-record predicate for custom checks.\n */\n readonly predicate?: (record: LogRecord) => boolean;\n}\n\n/**\n * A test recorder for LogTape records.\n *\n * @since 2.2.0\n */\nexport interface LogRecorder {\n /**\n * A sink that appends each received record to {@link LogRecorder.records}.\n */\n readonly sink: Sink;\n\n /**\n * Records collected so far, in sink call order.\n */\n readonly records: readonly LogRecord[];\n\n /**\n * Removes all collected records.\n */\n clear(): void;\n\n /**\n * Returns collected records and clears the recorder.\n */\n take(): readonly LogRecord[];\n\n /**\n * Finds the first collected record matching the given matcher.\n *\n * @param match The matcher to apply.\n * @returns The first matching record, or `undefined`.\n */\n find(match: LogRecordMatch): LogRecord | undefined;\n\n /**\n * Finds all collected records matching the given matcher.\n *\n * @param match The matcher to apply.\n * @returns All matching records in collection order.\n */\n filter(match: LogRecordMatch): readonly LogRecord[];\n\n /**\n * Asserts that at least one collected record matches the given matcher.\n *\n * @param match The matcher to apply.\n * @throws {Error} If no matching record exists.\n */\n assertLogged(match: LogRecordMatch): void;\n\n /**\n * Asserts that no collected record matches the given matcher.\n *\n * @param match The matcher to apply.\n * @throws {Error} If a matching record exists.\n */\n assertNotLogged(match: LogRecordMatch): void;\n}\n\n/**\n * Creates a LogTape test recorder.\n *\n * @example\n * ```ts\n * import { configure, getLogger, reset } from \"@logtape/logtape\";\n * import { createLogRecorder } from \"@logtape/testing\";\n *\n * const recorder = createLogRecorder();\n *\n * try {\n * await configure({\n * sinks: { recorder: recorder.sink },\n * loggers: [\n * { category: [\"my-lib\"], lowestLevel: \"debug\", sinks: [\"recorder\"] },\n * ],\n * });\n *\n * getLogger([\"my-lib\"]).info(\"User {userId} logged in.\", {\n * userId: \"u-123\",\n * });\n *\n * recorder.assertLogged({\n * category: [\"my-lib\"],\n * level: \"info\",\n * message: \"User u-123 logged in.\",\n * properties: { userId: \"u-123\" },\n * });\n * } finally {\n * await reset();\n * }\n * ```\n *\n * @returns A recorder with a sink and assertion helpers.\n * @since 2.2.0\n */\nexport function createLogRecorder(): LogRecorder {\n const records: LogRecord[] = [];\n const sink: Sink = (record: LogRecord): void => {\n records.push(record);\n };\n\n return {\n sink,\n get records(): readonly LogRecord[] {\n return records;\n },\n clear(): void {\n records.length = 0;\n },\n take(): readonly LogRecord[] {\n return records.splice(0);\n },\n find(match: LogRecordMatch): LogRecord | undefined {\n return records.find((record) => matchesLogRecord(record, match));\n },\n filter(match: LogRecordMatch): readonly LogRecord[] {\n return records.filter((record) => matchesLogRecord(record, match));\n },\n assertLogged(match: LogRecordMatch): void {\n if (records.some((record) => matchesLogRecord(record, match))) return;\n\n throw new Error(\n [\n \"Expected a LogTape record matching:\",\n formatMatcher(match),\n \"\",\n `Recorded ${formatCount(records.length, \"record\")}:`,\n formatRecords(records),\n ].join(\"\\n\"),\n );\n },\n assertNotLogged(match: LogRecordMatch): void {\n const matching = records.filter((record) =>\n matchesLogRecord(record, match)\n );\n if (matching.length < 1) return;\n\n throw new Error(\n [\n \"Expected no LogTape record matching:\",\n formatMatcher(match),\n \"\",\n `Found ${formatCount(matching.length, \"matching record\")}:`,\n formatRecords(matching),\n ].join(\"\\n\"),\n );\n },\n };\n}\n\nfunction matchesLogRecord(record: LogRecord, match: LogRecordMatch): boolean {\n if (\n match.category != null &&\n !matchesCategory(record.category, match.category)\n ) {\n return false;\n }\n if (\n match.categoryPrefix != null &&\n !matchesCategoryPrefix(record.category, match.categoryPrefix)\n ) {\n return false;\n }\n if (match.level != null && record.level !== match.level) return false;\n if (\n match.message != null &&\n !matchesMessage(renderMessage(record.message), record, match.message)\n ) {\n return false;\n }\n if (\n match.rawMessage != null &&\n !matchesText(renderRawMessage(record.rawMessage), match.rawMessage)\n ) {\n return false;\n }\n if (\n match.properties != null &&\n !matchesProperties(record.properties, record, match.properties)\n ) {\n return false;\n }\n if (match.predicate != null && !match.predicate(record)) return false;\n return true;\n}\n\nfunction matchesCategory(\n category: readonly string[],\n expected: string | readonly string[] | RegExp,\n): boolean {\n const joinedCategory = category.join(\".\");\n if (expected instanceof RegExp) {\n return testRegExp(expected, joinedCategory);\n }\n if (typeof expected === \"string\") {\n return joinedCategory === expected;\n }\n const expectedCategory = parseCategory(expected);\n return category.length === expectedCategory.length &&\n category.every((part, index) => part === expectedCategory[index]);\n}\n\nfunction matchesCategoryPrefix(\n category: readonly string[],\n prefix: string | readonly string[],\n): boolean {\n const expectedPrefix = parseCategory(prefix);\n return expectedPrefix.length <= category.length &&\n expectedPrefix.every((part, index) => part === category[index]);\n}\n\nfunction parseCategory(\n category: string | readonly string[],\n): readonly string[] {\n if (typeof category !== \"string\") return category;\n return category === \"\" ? [] : category.split(\".\");\n}\n\nfunction matchesMessage(\n renderedMessage: string,\n record: LogRecord,\n matcher: string | RegExp | ((record: LogRecord) => boolean),\n): boolean {\n if (typeof matcher === \"function\") return matcher(record);\n return matchesText(renderedMessage, matcher);\n}\n\nfunction matchesText(text: string, matcher: string | RegExp): boolean {\n return typeof matcher === \"string\"\n ? text === matcher\n : testRegExp(matcher, text);\n}\n\nfunction matchesProperties(\n properties: Readonly<Record<string, unknown>> | null | undefined,\n record: LogRecord,\n matcher: Readonly<Record<string, unknown>> | PropertyMatcher,\n): boolean {\n const props = properties ?? {};\n if (typeof matcher === \"function\") return matcher(props, record);\n for (const key of Object.keys(matcher)) {\n if (!Object.hasOwn(props, key)) return false;\n if (!Object.is(props[key], matcher[key])) return false;\n }\n return true;\n}\n\nfunction testRegExp(pattern: RegExp, text: string): boolean {\n if (!pattern.global && !pattern.sticky) {\n return pattern.test(text);\n }\n const clone = new RegExp(pattern.source, pattern.flags);\n return clone.test(text);\n}\n\nfunction renderRawMessage(rawMessage: string | TemplateStringsArray): string {\n return typeof rawMessage === \"string\" ? rawMessage : [...rawMessage].join(\"\");\n}\n\nfunction renderMessage(message: readonly unknown[]): string {\n let rendered = \"\";\n for (const part of message) {\n rendered += renderMessagePart(part);\n }\n return rendered;\n}\n\nfunction renderMessagePart(part: unknown): string {\n if (typeof part === \"string\") return part;\n if (typeof part === \"bigint\") return `${part}n`;\n if (part instanceof Error) return `${part.name}: ${part.message}`;\n if (part instanceof RegExp) return String(part);\n if (part instanceof Date) {\n try {\n return part.toISOString();\n } catch {\n return String(part);\n }\n }\n if (part == null) return String(part);\n if (typeof part === \"object\") {\n try {\n return JSON.stringify(part) ?? String(part);\n } catch {\n return String(part);\n }\n }\n return String(part);\n}\n\nfunction formatMatcher(match: LogRecordMatch): string {\n const lines: string[] = [];\n if (match.category != null) {\n lines.push(` category: ${formatCategoryMatcher(match.category)}`);\n }\n if (match.categoryPrefix != null) {\n lines.push(\n ` categoryPrefix: ${\n formatCategoryValue(parseCategory(match.categoryPrefix))\n }`,\n );\n }\n if (match.level != null) lines.push(` level: ${formatValue(match.level)}`);\n if (match.message != null) {\n lines.push(` message: ${formatMessageMatcher(match.message)}`);\n }\n if (match.rawMessage != null) {\n lines.push(` rawMessage: ${formatTextMatcher(match.rawMessage)}`);\n }\n if (match.properties != null) {\n lines.push(...formatPropertiesMatcher(match.properties));\n }\n if (match.predicate != null) lines.push(\" predicate: <predicate>\");\n return lines.length < 1 ? \" <any record>\" : lines.join(\"\\n\");\n}\n\nfunction formatCategoryMatcher(\n category: string | readonly string[] | RegExp,\n): string {\n return category instanceof RegExp\n ? String(category)\n : typeof category === \"string\"\n ? formatValue(category)\n : formatCategoryValue(category);\n}\n\nfunction formatCategoryValue(category: readonly string[]): string {\n return `[${category.map((part) => formatValue(part)).join(\", \")}]`;\n}\n\nfunction formatMessageMatcher(\n matcher: string | RegExp | ((record: LogRecord) => boolean),\n): string {\n return typeof matcher === \"function\" ? \"<predicate>\" : formatTextMatcher(\n matcher,\n );\n}\n\nfunction formatTextMatcher(matcher: string | RegExp): string {\n return typeof matcher === \"string\" ? formatValue(matcher) : String(matcher);\n}\n\nfunction formatPropertiesMatcher(\n matcher: Readonly<Record<string, unknown>> | PropertyMatcher,\n): string[] {\n if (typeof matcher === \"function\") return [\" properties: <predicate>\"];\n const lines = Object.keys(matcher).map((key) =>\n ` properties.${key}: ${formatValue(matcher[key])}`\n );\n return lines.length < 1 ? [\" properties: {}\"] : lines;\n}\n\nfunction formatRecords(records: readonly LogRecord[]): string {\n if (records.length < 1) return \" <none>\";\n const lines = records.slice(0, 3).map(formatRecord);\n if (records.length > 3) {\n lines.push(` ... ${records.length - 3} more`);\n }\n return lines.join(\"\\n\");\n}\n\nfunction formatRecord(record: LogRecord): string {\n const category = formatCategory(record.category);\n return ` [${record.level}] ${category}: ${renderMessage(record.message)}${\n formatProperties(record.properties)\n }`;\n}\n\nfunction formatCategory(category: readonly string[]): string {\n return category.length < 1 ? \"<root>\" : category.join(\".\");\n}\n\nfunction formatProperties(\n properties: Readonly<Record<string, unknown>> | null | undefined,\n): string {\n const props = properties ?? {};\n const entries = Object.keys(props);\n if (entries.length < 1) return \"\";\n const summary = entries.slice(0, 3).map((key) =>\n `${key}: ${formatValue(props[key])}`\n );\n if (entries.length > 3) summary.push(`... ${entries.length - 3} more`);\n return ` {${summary.join(\", \")}}`;\n}\n\nfunction formatCount(count: number, noun: string): string {\n return `${count} ${noun}${count === 1 ? \"\" : \"s\"}`;\n}\n\nfunction formatValue(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"bigint\") return `${value}n`;\n if (typeof value === \"symbol\") return String(value);\n if (value instanceof RegExp) return String(value);\n if (value instanceof Error) {\n return `${value.name}: ${value.message}`;\n }\n try {\n return JSON.stringify(value) ?? String(value);\n } catch {\n return String(value);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmKA,SAAgB,oBAAiC;CAC/C,MAAMA,UAAuB,CAAE;CAC/B,MAAMC,OAAa,CAACC,WAA4B;AAC9C,UAAQ,KAAK,OAAO;CACrB;AAED,QAAO;EACL;EACA,IAAI,UAAgC;AAClC,UAAO;EACR;EACD,QAAc;AACZ,WAAQ,SAAS;EAClB;EACD,OAA6B;AAC3B,UAAO,QAAQ,OAAO,EAAE;EACzB;EACD,KAAKC,OAA8C;AACjD,UAAO,QAAQ,KAAK,CAAC,WAAW,iBAAiB,QAAQ,MAAM,CAAC;EACjE;EACD,OAAOA,OAA6C;AAClD,UAAO,QAAQ,OAAO,CAAC,WAAW,iBAAiB,QAAQ,MAAM,CAAC;EACnE;EACD,aAAaA,OAA6B;AACxC,OAAI,QAAQ,KAAK,CAAC,WAAW,iBAAiB,QAAQ,MAAM,CAAC,CAAE;AAE/D,SAAM,IAAI,MACR;IACE;IACA,cAAc,MAAM;IACpB;KACC,WAAW,YAAY,QAAQ,QAAQ,SAAS,CAAC;IAClD,cAAc,QAAQ;GACvB,EAAC,KAAK,KAAK;EAEf;EACD,gBAAgBA,OAA6B;GAC3C,MAAM,WAAW,QAAQ,OAAO,CAAC,WAC/B,iBAAiB,QAAQ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AAED,SAAS,YAAYS,OAAeC,MAAsB;AACxD,SAAQ,EAAE,MAAM,GAAG,KAAK,EAAE,UAAU,IAAI,KAAK,IAAI;AAClD;AAED,SAAS,YAAYC,OAAwB;AAC3C,YAAW,UAAU,SAAU,QAAO,KAAK,UAAU,MAAM;AAC3D,YAAW,UAAU,SAAU,SAAQ,EAAE,MAAM;AAC/C,YAAW,UAAU,SAAU,QAAO,OAAO,MAAM;AACnD,KAAI,iBAAiB,OAAQ,QAAO,OAAO,MAAM;AACjD,KAAI,iBAAiB,MACnB,SAAQ,EAAE,MAAM,KAAK,IAAI,MAAM,QAAQ;AAEzC,KAAI;AACF,SAAO,KAAK,UAAU,MAAM,IAAI,OAAO,MAAM;CAC9C,QAAO;AACN,SAAO,OAAO,MAAM;CACrB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logtape/testing",
|
|
3
|
-
"version": "2.2.0-dev.
|
|
3
|
+
"version": "2.2.0-dev.720+7e379ca4",
|
|
4
4
|
"description": "Testing utilities for collecting and asserting LogTape records",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logging",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"dist/"
|
|
49
49
|
],
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@logtape/logtape": "^2.2.0-dev.
|
|
51
|
+
"@logtape/logtape": "^2.2.0-dev.720+7e379ca4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"tsdown": "^0.12.7",
|
|
55
55
|
"typescript": "^5.8.3",
|
|
56
|
-
"@logtape/redaction": "^2.2.0-dev.
|
|
56
|
+
"@logtape/redaction": "^2.2.0-dev.720+7e379ca4"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "tsdown",
|