SB-I367: Client service version changes for constructor issues#9420
SB-I367: Client service version changes for constructor issues#9420pallakartheekreddy merged 9 commits intoSunbird-Ed:release-8.0.2from
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the @project-sunbird/client-services package from version 8.0.2 to 8.0.5 to address constructor-related issues (per ticket SB-I367). The update requires adding fetch API polyfills for Jest tests, as the new version likely uses libraries (such as @digitalbazaar/http-client with ky) that depend on browser fetch APIs not available in the Node.js test environment.
Key Changes:
- Upgraded
@project-sunbird/client-servicesfrom 8.0.2 to 8.0.5 - Added fetch API polyfills in
jest-global-mocks.tsto support test execution - Created custom Jest environment and jsonld mock to handle test dependencies
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
src/app/client/package.json |
Upgraded client-services to 8.0.5 and added abort-controller to devDependencies |
src/app/client/jest-global-mocks.ts |
Added fetch API polyfills (Headers, Request, Response, FormData) and improved conditional checks for TextEncoder/TextDecoder |
src/app/client/jest-environment-jsdom-with-fetch.js |
Created custom Jest environment extending jsdom to provide fetch polyfills on global, self, and window objects |
src/app/client/__mocks__/jsonld.js |
Added Jest mock for jsonld library to avoid loading @digitalbazaar/http-client during tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,46 @@ | |||
| const JSDOMEnvironment = require('jest-environment-jsdom').TestEnvironment; | |||
| const nodeFetch = require('node-fetch'); | |||
There was a problem hiding this comment.
node-fetch is required but not listed in dependencies or devDependencies. This will cause a runtime error when the Jest environment tries to load. Add node-fetch to devDependencies in package.json:
"node-fetch": "^2.6.7"
src/app/client/jest-global-mocks.ts
Outdated
| // Required for @digitalbazaar/http-client which uses ky | ||
| if (typeof global.Headers === 'undefined') { | ||
| try { | ||
| const nodeFetch = require('node-fetch'); |
There was a problem hiding this comment.
node-fetch is required but not listed in dependencies or devDependencies. This will cause a runtime error when trying to load the polyfills. Add node-fetch to devDependencies in package.json:
"node-fetch": "^2.6.7"219dd0e
into
Sunbird-Ed:release-8.0.2
SunbirdEd - Portal
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Please choose applicable option
Example
Type of change
Please choose appropriate options.
Checklist: