GetStream / stream-chat-js

JS / Browser Client - Build Chat with GetStream.io
https://getstream.io/chat/
Other
183 stars 77 forks source link

Could not find a declaration file for module './lib/axios.js' #1305

Closed aqeelbhat closed 3 months ago

aqeelbhat commented 6 months ago

Hey team, we attempted to upgrade stream-chat from version 8.2.1 to the latest one, but unfortunately, it caused our tests to fail. Please review the attached screenshots for more details.

Screenshot 2024-05-18 at 10 44 27 PM Screenshot 2024-05-18 at 10 46 05 PM

We have decided to revert to version v8.2.1

{
  "jest": "^29.7.0",
  "react": "^18.3.1",
  "react-dom": "^18.3.1",
  "stream-chat": "^8.33.0"
}
MartinCupela commented 3 months ago

Hey @aqeelbhat it sounds like you will need to configure your jest to transpile ES module syntax (using Babel?). Jest needs CommonJS imports and the transpiler will help to transform import statements to require. We have upgraded the dependency and it probably introduced the import statements.

Example using Babel:

Install Babel Jest:

npm install --save-dev babel-jest @babel/preset-env

In the .babelrc file (maybe some more tweaking required):

{
  "presets": ["@babel/preset-env"]
}

Update your Jest configuration in package.json or jest.config.js (maybe some more tweaking required):

{
  "jest": {
    "transform": {
      "^.+\\.[t|j]sx?$": "babel-jest"
    }
  }
}