I’m encountering a persistent warning related to follow-redirects
when running unit tests with Axios in Jest:
Warning: exclude follow-redirects from browser builds
Steps to Reproduce:
-
I’m using Axios for making HTTP requests in my Node.js project.
-
When running Jest tests that involve Axios (e.g., axios.get()), I consistently see this warning in the console output.
-
The tests themselves are passing, but the warning appears every time.
What I’ve Tried:
-
I have ensured that Jest is configured to use testEnvironment: ‘node’.
-
I have attempted to mock Axios and the follow-redirects module to avoid the issue.
-
I reviewed my Jest setup to ensure that browser-specific builds are not being triggered, but the warning persists across all test files.
-
Running npm ls follow-redirects shows that Axios is the only direct dependency using this package.
My Environment:
-
Axios Version: 1.7.7
-
Jest Version: 29.7.0
2