Skip to content

Commit

Permalink
fix(types): export correct types for react-instantsearch-hooks-web (a…
Browse files Browse the repository at this point in the history
…lgolia/react-instantsearch#3454)

* fix(types): export correct types for react-instantsearch-hooks-web

The reason the types previously were the wrong directory is because `__testutils/all-widgets.ts` was included, and this imported items from the root, thus changing the output format of the types.

* refactor: move utils file into test

make sure it's ignored using jest instead of typescript
  • Loading branch information
Haroenv authored May 2, 2022
1 parent 6716c31 commit 9db47c8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ module.exports = {
'@testing-library/jest-dom/extend-expect',
'./scripts/jest/setupTests.ts',
],
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/examples/'],
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/examples/',
'/__utils__/',
],
snapshotSerializers: ['enzyme-to-json/serializer'],
testEnvironment: 'jsdom',
watchPlugins: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
InstantSearchServerContext,
} from 'react-instantsearch-hooks';

import * as widgets from '../';
import { createSearchClient } from '../../../../../test/mock';
import * as widgets from '../..';
import { createSearchClient } from '../../../../../../test/mock';

import type { InstantSearch as InstantSearchClass } from 'instantsearch.js';
import type { ComponentProps } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { render } from '@testing-library/react';
import React from 'react';

import { getAllWidgets } from '../__testutils__/all-widgets';
import { getAllWidgets } from './__utils__/all-widgets';

describe('rendering', () => {
const widgets = getAllWidgets();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @jest-environment node
*/

import { getAllInstantSearchWidgets } from '../__testutils__/all-widgets';
import { getAllInstantSearchWidgets } from './__utils__/all-widgets';

describe('widgets', () => {
const widgets = getAllInstantSearchWidgets();
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.declaration.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"emitDeclarationOnly": true,
"noEmit": false
},
"exclude": ["**/__tests__/**/*", "**/dist/**/*"]
"exclude": ["**/__tests__/**/*", "**/dist/**/*"],
}

0 comments on commit 9db47c8

Please sign in to comment.