Skip to content

Replace chai and axios#71

Open
danjoa wants to merge 1 commit intomainfrom
replace-chai-and-axois
Open

Replace chai and axios#71
danjoa wants to merge 1 commit intomainfrom
replace-chai-and-axois

Conversation

@danjoa
Copy link
Contributor

@danjoa danjoa commented Mar 3, 2026

@danjoa danjoa requested a review from chgeo March 3, 2026 11:57
@danjoa
Copy link
Contributor Author

danjoa commented Mar 3, 2026

Using chai 6 the right way

  • Before this PR chai was made available through cds.test.chai and cds.test.expect
  • With chai version 5 and 6 that doesn't work any longer as chai became an ESM module
  • Use chai explicitly from now on as documented in chai docs, e.g.:
import { export } from 'chai'

@danjoa
Copy link
Contributor Author

danjoa commented Mar 3, 2026

Using ESM modules and tests with jest


function chai() { try {
const chai = require ('chai')
try { chai.use (require('chai-as-promised')) } catch {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chai-subset is built into chai now, see deprecation on https://www.npmjs.com/package/chai-subset

"chai-subset": "^1.6.0"
},
"peerDependencies": {
"@sap/cds": ">=8.8"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should bump here to min 9.8, due to the ESM fix there:

Suggested change
"@sap/cds": ">=8.8"
"@sap/cds": ">=9.8"

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

Successfully merging this pull request may close these issues.

2 participants