diff --git a/code/lib/cli/src/js-package-manager/PNPMProxy.test.ts b/code/lib/cli/src/js-package-manager/PNPMProxy.test.ts index e59bd7354bcc..fc89fd2b32f6 100644 --- a/code/lib/cli/src/js-package-manager/PNPMProxy.test.ts +++ b/code/lib/cli/src/js-package-manager/PNPMProxy.test.ts @@ -213,9 +213,14 @@ describe('PNPM Proxy', () => { .spyOn(pnpmProxy, 'writePackageJson') .mockImplementation(jest.fn()); + const basePackageAttributes = { + dependencies: {}, + devDependencies: {}, + }; + jest.spyOn(pnpmProxy, 'retrievePackageJson').mockImplementation( - // @ts-expect-error (not strict) - jest.fn(() => ({ + jest.fn(async () => ({ + ...basePackageAttributes, overrides: { bar: 'x.x.x', }, @@ -228,6 +233,7 @@ describe('PNPM Proxy', () => { await pnpmProxy.addPackageResolutions(versions); expect(writePackageSpy).toHaveBeenCalledWith({ + ...basePackageAttributes, overrides: { ...versions, bar: 'x.x.x', diff --git a/code/renderers/react/src/docs/typeScript/handleProp.test.tsx b/code/renderers/react/src/docs/typeScript/handleProp.test.tsx index 37527fd501df..a230f0229b5a 100644 --- a/code/renderers/react/src/docs/typeScript/handleProp.test.tsx +++ b/code/renderers/react/src/docs/typeScript/handleProp.test.tsx @@ -64,7 +64,7 @@ function extractPropDef(component: Component, rawDefaultProp?: any): PropDef { describe('enhanceTypeScriptProp', () => { describe('defaultValue', () => { function createTestComponent( - defaultValue: DocgenPropDefaultValue, + defaultValue: DocgenPropDefaultValue | undefined, typeName = 'anything-is-fine' ): Component { return createComponent({ @@ -295,8 +295,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support strings', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef(component, 'foo'); @@ -305,8 +304,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support array of primitives', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef(component, [1, 2, 3]); @@ -315,8 +313,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support array of short object', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef(component, [{ foo: 'bar' }]); @@ -325,8 +322,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support array of long object', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef(component, [{ foo: 'bar', bar: 'foo', hey: 'ho' }]); @@ -342,8 +338,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support short object', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef(component, { foo: 'bar' }); @@ -352,8 +347,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support long object', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef(component, { foo: 'bar', bar: 'foo', hey: 'ho' }); @@ -369,8 +363,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support anonymous function', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef(component, () => 'hey!'); @@ -379,8 +372,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support named function', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef(component, function hello() { return 'world!'; @@ -391,8 +383,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support named function with params', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef(component, function add(a: number, b: number) { return a + b; @@ -403,8 +394,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support React element', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const defaultProp = ; // Simulate babel-plugin-add-react-displayname. @@ -417,8 +407,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support React element with props', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); // @ts-expect-error (Converted from ts-ignore) const defaultProp = ; @@ -432,8 +421,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support short HTML element', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef(component,
HTML element
); @@ -442,8 +430,7 @@ describe('enhanceTypeScriptProp', () => { }); it('should support long HTML element', () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null); + const component = createTestComponent(undefined); const { defaultValue } = extractPropDef( component, @@ -461,8 +448,7 @@ describe('enhanceTypeScriptProp', () => { ['element', 'elementType'].forEach((x) => { it(`should support inlined React class component for ${x}`, () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null, x); + const component = createTestComponent(undefined, x); const { defaultValue } = extractPropDef( component, @@ -478,8 +464,7 @@ describe('enhanceTypeScriptProp', () => { }); it(`should support inlined anonymous React functional component for ${x}`, () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null, x); + const component = createTestComponent(undefined, x); const { defaultValue } = extractPropDef(component, () => { return
Inlined FunctionalComponent!
; @@ -490,8 +475,7 @@ describe('enhanceTypeScriptProp', () => { }); it(`should support inlined anonymous React functional component with props for ${x}`, () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null, x); + const component = createTestComponent(undefined, x); const { defaultValue } = extractPropDef(component, ({ foo }: { foo: string }) => { return
{foo}
; @@ -502,8 +486,7 @@ describe('enhanceTypeScriptProp', () => { }); it(`should support inlined named React functional component for ${x}`, () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null, x); + const component = createTestComponent(undefined, x); const { defaultValue } = extractPropDef(component, function InlinedFunctionalComponent() { return
Inlined FunctionalComponent!
; @@ -514,8 +497,7 @@ describe('enhanceTypeScriptProp', () => { }); it(`should support inlined named React functional component with props for ${x}`, () => { - // @ts-expect-error (not strict) - const component = createTestComponent(null, x); + const component = createTestComponent(undefined, x); const { defaultValue } = extractPropDef( component,