diff --git a/packages/plugin-code-blocks/src/output/markdown-code-blocks.spec.ts b/packages/plugin-code-blocks/src/output/markdown-code-blocks.spec.ts index 8d703ca6..c477cb24 100644 --- a/packages/plugin-code-blocks/src/output/markdown-code-blocks.spec.ts +++ b/packages/plugin-code-blocks/src/output/markdown-code-blocks.spec.ts @@ -1,6 +1,7 @@ import { resolve } from 'path'; -import { DeclarationReflection, ReflectionKind } from 'typedoc'; +import { noop } from 'lodash'; +import { DeclarationReflection, ReflectionKind, RepositoryType } from 'typedoc'; import { MockPlugin, createMockProjectWithPackage, mockPlugin, restoreFs, setVirtualFs, setupMockMarkdownReplacer, setupMockPageMemo } from '#plugintestbed'; @@ -98,6 +99,7 @@ describe( 'Behavior', () => { it( 'should not alter content if region does not exists', () => { readCodeSampleMock.mockReturnValue( new Map( [[ DEFAULT_BLOCK_NAME, { code: FILE_CONTENT, ...defaultBlock } ]] ) ); const content = '{@codeblock foo/baz.txt#nope}'; + plugin.logger.error.mockImplementation( noop ); expect( markdownReplacerTestbed.runMarkdownReplace( content ) ).toEqual( content ); } ); it( 'should throw if invalid mode', () => { diff --git a/packages/plugin-pages/src/converter/page-tree/page-tree-builder.spec.ts b/packages/plugin-pages/src/converter/page-tree/page-tree-builder.spec.ts index 618365d8..af689b10 100644 --- a/packages/plugin-pages/src/converter/page-tree/page-tree-builder.spec.ts +++ b/packages/plugin-pages/src/converter/page-tree/page-tree-builder.spec.ts @@ -1,6 +1,6 @@ import { resolve } from 'path'; -import { isString, omit } from 'lodash'; +import { isString, noop, omit } from 'lodash'; import { Class } from 'type-fest'; import { Comment, DeclarationReflection, LogLevel, ProjectReflection, Reflection, ReflectionKind, SourceReference } from 'typedoc'; @@ -77,6 +77,7 @@ describe( 'Project', () => { ] ); } ); it( 'should strip empty menu', () => { + plugin.logger.warn.mockImplementation( noop ); const out = pageTreeBuilder.buildPagesTree( project, opts( [ { title: 'Foo' } ] ) ); expect( out.childrenNodes ).toEqual( [] ); } ); diff --git a/packages/plugintestbed/src/mock-plugin.ts b/packages/plugintestbed/src/mock-plugin.ts index 079f5059..ce3fe703 100644 --- a/packages/plugintestbed/src/mock-plugin.ts +++ b/packages/plugintestbed/src/mock-plugin.ts @@ -9,8 +9,8 @@ export type MockPlugin = jest.MockedObjectDeep export const mockPlugin = ( props: Partial> = {} ): MockPlugin => { const mockLogger = { makeChildLogger: jest.fn(), - error: jest.fn(), - warn: jest.fn(), + error: jest.fn().mockImplementation( v => fail( `Unexpected error log: ${typeof v === 'function' ? v() : v}` ) ), + warn: jest.fn().mockImplementation( v => fail( `Unexpected warn log: ${typeof v === 'function' ? v() : v}` ) ), log: jest.fn(), verbose: jest.fn(), info: jest.fn(),