Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Cannot find module 'linq-to-typescript'" with @testing-library/react #31

Open
maxime-aubry opened this issue May 28, 2024 · 3 comments

Comments

@maxime-aubry
Copy link

Hello.

When i test a component with @testing-library/react, i get an error "Cannot find module 'linq-to-typescript'..."
Could you help me please ?

"linq-to-typescript": "^11.1.0",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^14.5.2",

@maxime-aubry
Copy link
Author

Cannot find module 'linq-to-typescript' from 'src/indirectTime/redux/slices/clientSelectionSlice/service.ts'

Require stack:
  src/indirectTime/redux/slices/clientSelectionSlice/service.ts
  src/indirectTime/redux/slices/clientSelectionSlice/index.ts
  src/indirectTime/redux/reducers/index.ts
  src/indirectTime/redux/store/index.ts
  src/indirectTime/__test__/redux/index.tsx
  src/indirectTime/__test__/components/common/TimesheetColumnMapper/component.test.tsx

> 1 | import { from } from 'linq-to-typescript';
    | ^
  2 | import { ClientHierarchyClientState } from '../../states/clientHierarchyClient.state';
  3 | import { ClientHierarchyLegalEntityState } from '../../states/clientHierarchyLegalEntity.state';
  4 | import { ClientHierarchyRegionBusinessUnitState } from '../../states/clientHierarchyRegionBusinessUnit.state';

  at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
  at Object.<anonymous> (src/indirectTime/redux/slices/clientSelectionSlice/service.ts:1:1)
  at Object.<anonymous> (src/indirectTime/redux/slices/clientSelectionSlice/index.ts:11:1)
  at Object.<anonymous> (src/indirectTime/redux/reducers/index.ts:2:1)
  at Object.<anonymous> (src/indirectTime/redux/store/index.ts:2:1)
  at Object.<anonymous> (src/indirectTime/__test__/redux/index.tsx:5:1)
  at Object.<anonymous> (src/indirectTime/__test__/components/common/TimesheetColumnMapper/component.test.tsx:4:1)

@merklegroot
Copy link

I'm running into the same issue with Jest.
The library works great outside of Jest.

Cannot find module 'linq-to-typescript' from '__tests__/State/stateAggregator.ts'

> 1 | import { from } from "linq-to-typescript";
    | ^
  2 |
  3 | describe('stateAggregator', () => {
  4 |     it('getStats', () => {

  at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
  at Object.<anonymous> (__tests__/State/stateAggregator.ts:1:1)

@arogozine
Copy link
Owner

@merklegroot My unit tests use jest, take a look at jest.config.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants