Isolate all TS stuff in hello package
This commit is contained in:
13
hello/jest.config.js
Normal file
13
hello/jest.config.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
testEnvironment: 'node',
|
||||
preset: "ts-jest",
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
diagnostics: {
|
||||
ignoreCodes: [
|
||||
151001 // see https://githubmemory.com/repo/kulshekhar/ts-jest/issues/2722
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
"name": "@capire/hello-world",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"test": "npx jest --silent",
|
||||
"watch": "cds serve world.cds",
|
||||
"watch:ts": "cds-ts serve world.cds"
|
||||
},
|
||||
|
||||
15
hello/test/hello-world-ts.test.ts
Normal file
15
hello/test/hello-world-ts.test.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
process.env.CDS_TYPESCRIPT = 'true';
|
||||
import * as cds from '@sap/cds';
|
||||
|
||||
//@ts-ignore
|
||||
const {GET} = cds.test.in(__dirname,'..').run('serve', 'world.cds');
|
||||
|
||||
describe('Hello world!', () => {
|
||||
afterAll(() => { delete process.env.CDS_TYPESCRIPT; });
|
||||
|
||||
it('should say hello with class impl from a typescript file', async () => {
|
||||
const {data} = await GET`/say/hello(to='world')`
|
||||
expect(data.value).toMatch(/Hello world.*typescript.*/i)
|
||||
})
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user