import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { ApiChangesError, apiChanges, checkDescription, commentBody, failureMessage, MARKER, publish, readChangedFiles, run, SUMMARY_BYTES, } from './api-changes.mjs'; const header = '# Generated by `pnpm api:update` from the built declarations. Do not edit by hand.'; const file = (...lines) => `${[header, ...lines].join('\n')}\n`; describe('apiChanges', () => { it('lists added and removed lines and counts each export once', () => { const changes = apiChanges([ { packageName: '@prisma/orm-postgres', before: file( './config: interface Options', './config: interface Options, readonly optional property db?: string', '(not exported) type Gone = string', ), after: file( './config: function defineConfig(): void', './config: interface Options', './config: interface Options, readonly optional property db?: string | undefined', ), }, ]); assert.deepEqual(changes, [ { packageName: '@prisma/orm-postgres', added: [ './config: function defineConfig(): void', './config: interface Options, readonly optional property db?: string | undefined', ], removed: [ '(not exported) type Gone = string', './config: interface Options, readonly optional property db?: string', ], exports: [ '@prisma/orm-postgres (not exported): Gone', '@prisma/orm-postgres/config: Options', '@prisma/orm-postgres/config: defineConfig', ], }, ]); }); it('reads a new package and a deleted one', () => { const changes = apiChanges([ { packageName: '@prisma/new', before: undefined, after: file('.: const a: 1') }, { packageName: '@prisma/old', before: file('.: const b: 2'), after: undefined }, ]); assert.deepEqual( changes.map(({ packageName, exports }) => ({ packageName, exports })), [ { packageName: '@prisma/new', exports: ['@prisma/new: a'] }, { packageName: '@prisma/old', exports: ['@prisma/old: b'] }, ], ); }); it('leaves out a package whose lines did not change', () => { assert.deepEqual( apiChanges([ { packageName: '@prisma/same', before: file('.: const a: 1'), after: file('.: const a: 1'), }, ]), [], ); }); }); describe('checkDescription', () => { const names = ['@prisma/orm-postgres/config: defineConfig', '@prisma/orm-postgres: Client']; const groups = [{ packageName: '@prisma/orm-postgres', exports: names }]; const explained = { section: true, missing: [], withoutReason: [] }; it('passes when the section names every export with a reason', () => { const body = [ 'Adds a config helper.', '', '## API changes', '', '- `@prisma/orm-postgres/config: defineConfig`: new helper users call in prisma.config.ts.', '- `@prisma/orm-postgres: Client`: gains close(), which users asked for.', '', '## Testing', ].join('\n'); assert.deepEqual(checkDescription(body, groups), explained); }); it('accepts several names on one line that gives one reason', () => { const body = '## API changes\n\n`@prisma/orm-postgres/config: defineConfig` and `@prisma/orm-postgres: Client` both serve the new config file.'; assert.deepEqual(checkDescription(body, groups), explained); }); it('accepts the package name with a reason for every change in that package', () => { const body = '## API changes\n\n- `@prisma/orm-postgres`: regenerated after the TypeScript upgrade, no API change.'; assert.deepEqual(checkDescription(body, groups), explained); }); it('does not let a package name without a reason explain its exports', () => { const body = '## API changes\n\n- `@prisma/orm-postgres`:'; assert.deepEqual(checkDescription(body, groups), { section: true, missing: [], withoutReason: names, }); }); it('does not let one package name cover another package', () => { const body = '## API changes\n\n- `@prisma/orm-mysql`: regenerated after the TypeScript upgrade.'; assert.deepEqual(checkDescription(body, groups).missing, names); }); it('counts a name as explained when one of the lines naming it gives a reason', () => { const body = [ '## API changes', '', '- `@prisma/orm-postgres/config: defineConfig`, `@prisma/orm-postgres: Client`:', '- `@prisma/orm-postgres/config: defineConfig` and `@prisma/orm-postgres: Client` are new for config files.', ].join('\n'); assert.deepEqual(checkDescription(body, groups), explained); }); it('does not take a reason from a line that does not name the export', () => { const body = [ '## API changes', '', '- `@prisma/orm-postgres/config: defineConfig`:', '- `@prisma/orm-postgres: Client`: gains close() for users.', ].join('\n'); assert.deepEqual(checkDescription(body, groups).withoutReason, [names[0]]); }); it('fails and lists a name the section leaves out', () => { const body = '## API changes\n\n- `@prisma/orm-postgres: Client`: gains close() for users.'; const result = checkDescription(body, groups); assert.deepEqual(result, { section: true, missing: ['@prisma/orm-postgres/config: defineConfig'], withoutReason: [], }); assert.match(failureMessage(result, groups), /- `@prisma\/orm-postgres\/config: defineConfig`/); }); it('does not count a name written outside the section', () => { const body = '`@prisma/orm-postgres/config: defineConfig` is new.\n\n## API changes\n\n- `@prisma/orm-postgres: Client`: gains close() for users.\n\n## Other\n\n`@prisma/orm-postgres/config: defineConfig` again.'; assert.deepEqual(checkDescription(body, groups).missing, [ '@prisma/orm-postgres/config: defineConfig', ]); }); it('does not count names written only inside an HTML comment', () => { const body = '## API changes\n\n'; assert.deepEqual(checkDescription(body, groups).missing, names); }); it('does not find the heading inside an HTML comment', () => { const body = ''; assert.equal(checkDescription(body, groups).section, false); }); it('does not end the section at a # line inside a code block', () => { const body = [ '## API changes', '', '```sh', '# regenerate the lists', 'pnpm api:update', '```', '', '- `@prisma/orm-postgres`: regenerated after the TypeScript upgrade.', ].join('\n'); assert.deepEqual(checkDescription(body, groups), explained); }); it('does not take a heading inside a code block as the section', () => { const body = [ 'Copied from the bot:', '```markdown', '## API changes', '', '- `@prisma/orm-postgres`:', '```', '', '## API changes', '', '- `@prisma/orm-postgres`: regenerated after the TypeScript upgrade.', ].join('\n'); assert.deepEqual(checkDescription(body, groups), explained); }); it('fails when the section names exports but gives no reason', () => { const body = '## API changes\n\n- `@prisma/orm-postgres/config: defineConfig`\n- `@prisma/orm-postgres: Client`:'; const result = checkDescription(body, groups); assert.deepEqual(result, { section: true, missing: [], withoutReason: names }); assert.match(failureMessage(result, groups), /no reason/); }); it('fails when there is no section, and the message lists every name and the package form', () => { const result = checkDescription('Fixes a bug.', groups); assert.deepEqual(result, { section: false, missing: names, withoutReason: [] }); const message = failureMessage(result, groups); for (const name of names) assert.ok(message.includes(`- \`${name}\`:`), message); assert.match(message, /## API changes/); assert.match(message, /package name in backticks/); }); it('lists a package entry, not every name, for a package with many missing names', () => { const many = Array.from({ length: 60 }, (_, i) => `@prisma/big: value${i}`); const big = [{ packageName: '@prisma/big', exports: many }]; const message = failureMessage(checkDescription('', big), big); assert.ok(message.includes('- `@prisma/big`: (60 exports)'), message); assert.ok(!message.includes('`@prisma/big: value0`'), message); }); it('fails on an empty description', () => { assert.equal(checkDescription(null, groups).section, false); }); }); describe('commentBody', () => { const changes = [ { packageName: '@prisma/orm-postgres', added: ['./config: function defineConfig(): void'], removed: ['./config: function oldConfig(): void'], exports: [ '@prisma/orm-postgres/config: defineConfig', '@prisma/orm-postgres/config: oldConfig', ], }, ]; it('lists each package, its lines and the names to write', () => { assert.equal( commentBody(changes), [ MARKER, '## Public API changes', '', 'This pull request changes the `api.txt` list of 1 package. Its description needs a section headed `## API changes` that names each export below, in backticks, on a line that says why it changes. A package name in backticks, on a line with a reason, covers every change in that package. You can start from this:', '', '```markdown', '## API changes', '', '- `@prisma/orm-postgres/config: defineConfig`:', '- `@prisma/orm-postgres/config: oldConfig`:', '```', '', '### `@prisma/orm-postgres`', '', '```diff', '+ ./config: function defineConfig(): void', '- ./config: function oldConfig(): void', '```', '', ].join('\n'), ); }); it('cuts an over-long list and says how many lines it left out', () => { const many = [ { packageName: '@prisma/big', added: Array.from( { length: 500 }, (_, i) => `.: const value${String(i).padStart(3, '0')}: ${'x'.repeat(100)}`, ), removed: [], exports: ['@prisma/big: value000'], }, ]; const full = commentBody(many); const cut = commentBody(many, { limit: 10_000 }); assert.ok(full.length > 10_000); assert.ok(cut.length <= 10_000, `${cut.length}`); const shown = cut.split('\n').filter((line) => line.startsWith('+ ')).length; assert.ok(shown > 0 && shown < 500); assert.ok( cut.includes(`${500 - shown} lines are left out here. The full list is in the job summary`), cut, ); assert.ok(cut.trimEnd().endsWith('```') || cut.includes('job summary')); }); it('uses a fence longer than any run of backticks in the lines', () => { const body = commentBody([ { packageName: '@prisma/x', added: ['.: const a: "```"'], removed: [], exports: ['@prisma/x: a'], }, ]); assert.ok(body.includes('````diff\n+ .: const a: "```"\n````'), body); }); it('offers one package entry in the template for a package with many names', () => { const exports = Array.from({ length: 51 }, (_, i) => `@prisma/big: value${i}`); const body = commentBody([ { packageName: '@prisma/big', added: exports.map((_, i) => `.: const value${i}: 1`), removed: [], exports, }, ...changes, ]); assert.ok(body.includes('- `@prisma/big`: (51 exports)\n'), body); assert.ok(!body.includes('- `@prisma/big: value0`:'), body); assert.ok(body.includes('- `@prisma/orm-postgres/config: defineConfig`:'), body); assert.match(body, /package name in backticks/); }); it('measures its limit in bytes', () => { const wide = [ { packageName: '@prisma/wide', added: Array.from({ length: 200 }, (_, i) => `.: const v${i}: "${'é'.repeat(50)}"`), removed: [], exports: ['@prisma/wide: v0'], }, ]; const cut = commentBody(wide, { limit: 5_000 }); assert.ok(Buffer.byteLength(cut) <= 5_000, `${Buffer.byteLength(cut)}`); }); it('says the pull request no longer changes the lists when there are no changes', () => { assert.ok(commentBody([]).startsWith(`${MARKER}\n`)); assert.match(commentBody([]), /no longer changes/); }); }); describe('record files', () => { const brk = (name, reason = 'Join scopes merge by name') => ({ path: '.', export: name, test: 'type', kind: 'break', lastRelease: '8.1.0', fingerprint: '0123456789abcdef', reason, }); const err = (app, line) => ({ app, file: 'test/rows.test-d.ts', line, code: 'TS2344', message: 'Type mismatch', kind: 'allowed', lastRelease: '8.1.0', reason: 'Rows gain createdBy', }); const json = (value) => JSON.stringify(value, null, 2); it('lists added and removed deliberate breaks under the package, which must be named', () => { const changes = apiChanges([ { source: 'breaks', packageName: '@prisma/p', before: json([brk('Old'), brk('Kept')]), after: json([brk('Kept'), brk('New')]), }, ]); assert.deepEqual(changes, [ { packageName: '@prisma/p', heading: 'packages/9-public/@prisma/p/api-breaks.json', added: [ '{"path":".","export":"New","test":"type","kind":"break","lastRelease":"8.1.0","fingerprint":"0123456789abcdef","reason":"Join scopes merge by name"}', ], removed: [ '{"path":".","export":"Old","test":"type","kind":"break","lastRelease":"8.1.0","fingerprint":"0123456789abcdef","reason":"Join scopes merge by name"}', ], exports: ['@prisma/p'], }, ]); }); it('groups expected example-app errors by app, each named as examples/', () => { const changes = apiChanges([ { source: 'examples', before: json([err('demo', 1)]), after: json([err('demo', 2), err('shop', 3)]), }, ]); assert.deepEqual( changes.map(({ packageName, heading, added, removed, exports }) => ({ packageName, heading, added: added.length, removed: removed.length, exports, })), [ { packageName: 'examples/demo', heading: 'examples/last-release-errors.json: demo', added: 1, removed: 1, exports: ['examples/demo'], }, { packageName: 'examples/shop', heading: 'examples/last-release-errors.json: shop', added: 1, removed: 0, exports: ['examples/shop'], }, ], ); }); it('lists a changed record of a removed package under the package, which must be named', () => { const gone = { package: '@prisma/orm-gone', lastRelease: '8.1.0', reason: 'merged into orm-x' }; assert.deepEqual(apiChanges([{ source: 'removed', before: undefined, after: json([gone]) }]), [ { packageName: '@prisma/orm-gone', heading: 'packages/9-public/removed-packages.json: @prisma/orm-gone', added: [ '{"package":"@prisma/orm-gone","lastRelease":"8.1.0","reason":"merged into orm-x"}', ], removed: [], exports: ['@prisma/orm-gone'], }, ]); }); it('counts no change when only the order of keys or records changes', () => { const reordered = { reason: 'Join scopes merge by name', fingerprint: '0123456789abcdef', lastRelease: '8.1.0', kind: 'break', test: 'type', export: 'A', path: '.', }; assert.deepEqual( apiChanges([ { source: 'breaks', packageName: '@prisma/p', before: json([brk('B'), brk('A')]), after: json([reordered, brk('B')]), }, ]), [], ); }); it('fails with the file name when a record file is not a JSON array', () => { assert.throws( () => apiChanges([ { source: 'breaks', packageName: '@prisma/p', before: undefined, after: '{ nope' }, ]), (error) => error instanceof ApiChangesError && error.message.includes('packages/9-public/@prisma/p/api-breaks.json'), ); assert.throws( () => apiChanges([{ source: 'examples', before: undefined, after: '{}' }]), (error) => error instanceof ApiChangesError && error.message.includes('examples/last-release-errors.json'), ); }); it('requires the package or app named with a reason', () => { const changes = apiChanges([ { source: 'breaks', packageName: '@prisma/p', before: undefined, after: json([brk('A')]) }, { source: 'examples', before: undefined, after: json([err('demo', 1)]) }, ]); assert.deepEqual(checkDescription('## API changes\n\n- `@prisma/p`:', changes), { section: true, missing: ['examples/demo'], withoutReason: ['@prisma/p'], }); const body = '## API changes\n\n- `@prisma/p`: A breaks on purpose, named in the release notes.\n- `examples/demo`: rows gain the optional createdBy field.'; assert.deepEqual(checkDescription(body, changes), { section: true, missing: [], withoutReason: [], }); assert.match(failureMessage(checkDescription('', changes), changes), /api-breaks\.json/); }); it('lists the records in the comment under their file', () => { const body = commentBody( apiChanges([ { source: 'breaks', packageName: '@prisma/p', before: undefined, after: json([brk('A')]) }, ]), ); assert.ok( body.includes( '### `packages/9-public/@prisma/p/api-breaks.json`\n\n```diff\n+ {"path":".","export":"A","test":"type","kind":"break","lastRelease":"8.1.0","fingerprint":"0123456789abcdef","reason":"Join scopes merge by name"}\n```', ), body, ); assert.ok(body.includes('- `@prisma/p`:'), body); }); it('fails a pull request that changes only a record file until the description names it', async () => { const quiet = { repository: 'o/r', readFiles: () => [ { source: 'breaks', packageName: '@prisma/p', before: undefined, after: json([brk('A')]) }, ], appendSummary: () => {}, log: () => {}, request: async (method) => (method === 'GET' ? [] : {}), }; const event = (body) => ({ number: 7, pull_request: { body, head: { repo: { full_name: 'o/r' } } }, }); assert.equal((await run({ ...quiet, event: event('Nothing.') })).ok, false); assert.equal( ( await run({ ...quiet, event: event('## API changes\n\n- `@prisma/p`: A breaks on purpose for the join rework.'), }) ).ok, true, ); }); }); describe('readChangedFiles', () => { it('compares the merge commit with its first parent, file by file', () => { const calls = []; const contents = { 'HEAD^1:packages/9-public/@prisma/orm-postgres/api.txt': 'before', 'HEAD:packages/9-public/@prisma/orm-postgres/api.txt': 'after', 'HEAD:packages/9-public/@prisma/orm-new/api.txt': 'new', 'HEAD^1:packages/9-public/@prisma/orm-old/api.txt': 'old', 'HEAD:packages/9-public/@prisma/orm-postgres/api-breaks.json': '[]', 'HEAD^1:examples/last-release-errors.json': '[1]', 'HEAD:examples/last-release-errors.json': '[2]', 'HEAD:packages/9-public/removed-packages.json': '[]', }; const git = (args) => { calls.push(args.join(' ')); if (args[0] === 'diff') { return [ 'M\tpackages/9-public/@prisma/orm-postgres/api.txt', 'A\tpackages/9-public/@prisma/orm-new/api.txt', 'D\tpackages/9-public/@prisma/orm-old/api.txt', 'M\tpackages/9-public/@prisma/orm-postgres/src/api.txt', 'A\tpackages/9-public/@prisma/orm-postgres/api-breaks.json', 'M\texamples/last-release-errors.json', 'M\texamples/demo/last-release-errors.json', 'A\tpackages/9-public/removed-packages.json', '', ].join('\n'); } if (args[0] === 'show' && contents[args[1]] !== undefined) return contents[args[1]]; throw new ApiChangesError(`unexpected git ${args.join(' ')}`); }; assert.deepEqual(readChangedFiles({ git }), [ { source: 'examples', packageName: undefined, before: '[1]', after: '[2]' }, { source: 'api', packageName: '@prisma/orm-new', before: undefined, after: 'new' }, { source: 'api', packageName: '@prisma/orm-old', before: 'old', after: undefined }, { source: 'breaks', packageName: '@prisma/orm-postgres', before: undefined, after: '[]' }, { source: 'api', packageName: '@prisma/orm-postgres', before: 'before', after: 'after' }, { source: 'removed', packageName: undefined, before: undefined, after: '[]' }, ]); assert.equal( calls[0], 'diff --name-status --no-renames HEAD^1 HEAD -- packages/9-public/@prisma/*/api.txt packages/9-public/@prisma/*/api-breaks.json examples/last-release-errors.json packages/9-public/removed-packages.json', ); assert.ok(!calls.some((call) => call.startsWith('merge-base'))); }); }); describe('publish', () => { const base = { comment: `${MARKER}\nshort`, summary: `${MARKER}\nfull`, createComment: true, prNumber: 7, repository: 'o/r', log: () => {}, }; it('on a fork, writes the summary and calls no comment API', async () => { const summary = []; let called = false; await publish({ ...base, isFork: true, appendSummary: (text) => summary.push(text), request: async () => { called = true; }, }); assert.equal(called, false); assert.deepEqual(summary, [base.summary]); }); it('keeps going with the summary when the token may not comment', async () => { const summary = []; await publish({ ...base, isFork: false, appendSummary: (text) => summary.push(text), request: async () => { throw new ApiChangesError('forbidden', 403); }, }); assert.deepEqual(summary, [base.summary]); }); it('logs a warning and carries on when the API fails', async () => { const summary = []; const logged = []; await publish({ ...base, isFork: false, appendSummary: (text) => summary.push(text), log: (text) => logged.push(text), request: async () => { throw new ApiChangesError('GitHub GET responded 500: oops', 500); }, }); assert.deepEqual(summary, [base.summary]); assert.ok( logged.some((text) => text.startsWith('::warning::') && text.includes('500')), logged, ); }); it('carries on when the request itself throws, such as on a timeout', async () => { await publish({ ...base, isFork: false, appendSummary: () => {}, request: async () => { throw new DOMException('The operation timed out.', 'TimeoutError'); }, }); }); const bot = { login: 'github-actions[bot]' }; it('does not take a marked comment by someone else as its own', async () => { const requests = []; await publish({ ...base, isFork: false, appendSummary: () => {}, request: async (method, path, body) => { requests.push({ method, path, body }); if (method === 'GET') return [{ id: 3, body: `${MARKER}\nquoted`, user: { login: 'someone' } }]; return {}; }, }); assert.ok(!requests.some((r) => r.method === 'PATCH')); assert.equal(requests.at(-1).method, 'POST'); }); it('does not edit its comment when the text is unchanged', async () => { const requests = []; await publish({ ...base, isFork: false, appendSummary: () => {}, request: async (method, path, body) => { requests.push({ method, path, body }); return method === 'GET' ? [{ id: 2, body: base.comment, user: bot }] : {}; }, }); assert.deepEqual( requests.map((r) => r.method), ['GET'], ); }); it('edits the comment it posted before', async () => { const requests = []; await publish({ ...base, isFork: false, appendSummary: () => {}, request: async (method, path, body) => { requests.push({ method, path, body }); if (method === 'GET' && path.includes('page=1')) { return [ { id: 1, body: 'hello', user: bot }, { id: 2, body: `${MARKER}\nold`, user: bot }, ]; } if (method === 'GET') return []; return {}; }, }); assert.deepEqual(requests.at(-1), { method: 'PATCH', path: '/repos/o/r/issues/comments/2', body: { body: base.comment }, }); assert.ok(!requests.some((r) => r.method === 'POST')); }); it('posts a comment when there is none', async () => { const requests = []; await publish({ ...base, isFork: false, appendSummary: () => {}, request: async (method, path, body) => { requests.push({ method, path, body }); return method === 'GET' ? [] : {}; }, }); assert.deepEqual(requests.at(-1), { method: 'POST', path: '/repos/o/r/issues/7/comments', body: { body: base.comment }, }); }); it('posts nothing when there are no changes and no earlier comment', async () => { const requests = []; await publish({ ...base, summary: undefined, createComment: false, isFork: false, appendSummary: () => {}, request: async (method, path) => { requests.push(method); return method === 'GET' ? [] : {}; }, }); assert.deepEqual(requests, ['GET']); }); }); describe('run', () => { const event = (body, fork = false) => ({ number: 7, pull_request: { body, base: { sha: 'base', repo: { full_name: 'o/r' } }, head: { sha: 'head', repo: { full_name: fork ? 'someone/r' : 'o/r' } }, }, }); const unchanged = () => []; const changed = () => [ { packageName: '@prisma/p', before: file('.: const a: 1'), after: file('.: const a: 2') }, ]; it('passes and comments nothing when no api.txt changes', async () => { const summary = []; const requests = []; const result = await run({ event: event('Nothing.'), repository: 'o/r', token: 't', readFiles: unchanged, appendSummary: (text) => summary.push(text), request: async (method) => { requests.push(method); return []; }, log: () => {}, }); assert.equal(result.ok, true); assert.deepEqual(summary, []); assert.ok(!requests.some((method) => method === 'POST')); }); it('fails until the description names the change, then passes', async () => { const quiet = { repository: 'o/r', token: 't', readFiles: changed, appendSummary: () => {}, log: () => {}, }; const request = async (method) => (method === 'GET' ? [] : {}); const failing = await run({ ...quiet, event: event('No section.'), request }); assert.equal(failing.ok, false); assert.match(failing.message, /`@prisma\/p: a`/); const passing = await run({ ...quiet, event: event('## API changes\n\n- `@prisma/p: a`: its value is now 2 for the new default.'), request, }); assert.equal(passing.ok, true); }); it('on a fork, puts the list and the failure in the summary', async () => { const summary = []; const result = await run({ event: event('No section.', true), repository: 'o/r', token: 't', readFiles: changed, appendSummary: (text) => summary.push(text), request: async () => { throw new ApiChangesError('must not call the API'); }, log: () => {}, }); assert.equal(result.ok, false); assert.ok(summary.join('\n').includes('+ .: const a: 2')); assert.ok(summary.join('\n').includes('`@prisma/p: a`')); }); it('keeps the whole summary, failure included, under the summary limit', async () => { const summary = []; const exports = Array.from( { length: 4000 }, (_, i) => `.: const value${i}: "${'x'.repeat(300)}"`, ); const result = await run({ event: event('No section.', true), repository: 'o/r', readFiles: () => [ { packageName: '@prisma/p', before: file(), after: file(...exports) }, ...Array.from({ length: 30 }, (_, i) => ({ packageName: `@prisma/small${String(i).padStart(2, '0')}`, before: file(), after: file( ...Array.from( { length: 40 }, (_, j) => `.: const name${j}WithAFairlyLongExportName: 1`, ), ), })), ], appendSummary: (text) => summary.push(text), request: async () => [], log: () => {}, }); assert.equal(result.ok, false); const text = summary.join('\n'); assert.ok(Buffer.byteLength(text) <= SUMMARY_BYTES, `${Buffer.byteLength(text)}`); assert.ok(text.includes('lines are left out here'), 'the line list is cut'); assert.ok(text.includes('## Description check'), 'the failure is kept'); }); }); describe('failureMessage', () => { it('ends with an example section in a markdown code block, so the job summary does not render it as a heading', () => { const message = failureMessage({ section: false, missing: [], withoutReason: [] }, []); assert.match( message, /For example:\n\n```markdown\n## API changes\n\n- `@prisma\/orm-postgres\/config: defineConfig`: [^\n]*\n- [^\n]*\n```$/, ); }); });