Use transform option to make ts test work
This commit is contained in:
8216
package-lock.json
generated
8216
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@@ -33,14 +33,24 @@
|
|||||||
"media": "cds watch media",
|
"media": "cds watch media",
|
||||||
"mocha": "npx mocha || echo",
|
"mocha": "npx mocha || echo",
|
||||||
"jest": "npx jest",
|
"jest": "npx jest",
|
||||||
"test": "npm run jest --silent --testMatch test/*.test.js && npm run test:ts",
|
"test": "npm run jest --silent"
|
||||||
"test:ts": "npm run jest --silent --preset ts-jest --testMatch test/*.test.ts"
|
|
||||||
},
|
},
|
||||||
"mocha": {
|
"mocha": {
|
||||||
"parallel": true
|
"parallel": true
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"testEnvironment": "node"
|
"testEnvironment": "node",
|
||||||
|
"transform": {
|
||||||
|
"\\.ts$": "ts-jest"
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"ts-jest": {
|
||||||
|
"diagnostics": {
|
||||||
|
"_comment": "see https://githubmemory.com/repo/kulshekhar/ts-jest/issues/2722",
|
||||||
|
"ignoreCodes": [151001]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"license": "SAP SAMPLE CODE LICENSE",
|
"license": "SAP SAMPLE CODE LICENSE",
|
||||||
"private": true
|
"private": true
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
const testKit = require('../test')
|
process.env.CDS_TYPESCRIPT = 'true';
|
||||||
process.env.TYPESCRIPT_SUPPORT = 'true';
|
import * as cds from '@sap/cds';
|
||||||
|
|
||||||
const {GET} = testKit.run('serve', 'hello/world.cds')
|
//@ts-ignore
|
||||||
|
const {GET} = cds.test.in(__dirname,'../hello').run('serve', 'world.cds')
|
||||||
|
|
||||||
describe('Hello world!', () => {
|
describe('Hello world!', () => {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user