on 2023 May 21 5:37 AM
Hello Experts,
I am trying to run jest test case as mentioned in the hello folder of the cloud-cap-samples
Please make a note that am using Typescript with SAP CAP which working fine. But Jest Test case is not working
Code has copied from cloud-cap-samples only
world.cds
service say { function hello(to : String) returns String;}
world.ts
import type { Request } from "@sap/cds/apis/services"
module.exports = class say {
hello(req: Request) {
return `Hello ${req.data.to} from a TypeScript file!`
}
}
hello-world-test.js
const cds = require('@sap/cds')
describe('Hello world!', () => {
beforeAll(() => process.env.CDS_TYPESCRIPT = true)
afterAll(() => delete process.env.CDS_TYPESCRIPT)
const { GET } = cds.test.in(__dirname, '../srv').run('serve', 'world.cds')
it('should say hello with class impl', async () => {
const { data } = await GET`/say/hello(to='world')`
expect(data.value).toMatch(/Hello world.*typescript.*/i)
})
})
"jest": { "testMatch": [ "**/*-test.js" ], "testTimeout": 20000 },
I am getting below mentioned error

Kindly let me know if am missing any thing here
Thanks
Sandeep
Request clarification before answering.
sandeep.techie
maybe this blog can you provide some hints.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.