From 00bfc1507e41777903475ad1df91ccd5e6d0e652 Mon Sep 17 00:00:00 2001 From: Christian Georgi Date: Tue, 13 Jul 2021 13:22:30 +0200 Subject: [PATCH] Isolate all TS stuff in `hello` package --- jest.config.js => hello/jest.config.js | 0 hello/package.json | 1 + {test => hello/test}/hello-world-ts.test.ts | 2 +- hello/{ => test}/test.http | 0 package.json | 7 ++++++- samples.md | 1 + 6 files changed, 9 insertions(+), 2 deletions(-) rename jest.config.js => hello/jest.config.js (100%) rename {test => hello/test}/hello-world-ts.test.ts (83%) rename hello/{ => test}/test.http (100%) diff --git a/jest.config.js b/hello/jest.config.js similarity index 100% rename from jest.config.js rename to hello/jest.config.js diff --git a/hello/package.json b/hello/package.json index 7ca89125..8e0b374f 100644 --- a/hello/package.json +++ b/hello/package.json @@ -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" }, diff --git a/test/hello-world-ts.test.ts b/hello/test/hello-world-ts.test.ts similarity index 83% rename from test/hello-world-ts.test.ts rename to hello/test/hello-world-ts.test.ts index 4305b3a6..02a8df88 100644 --- a/test/hello-world-ts.test.ts +++ b/hello/test/hello-world-ts.test.ts @@ -2,7 +2,7 @@ process.env.CDS_TYPESCRIPT = 'true'; import * as cds from '@sap/cds'; //@ts-ignore -const {GET} = cds.test.in(__dirname,'../hello').run('serve', 'world.cds'); +const {GET} = cds.test.in(__dirname,'..').run('serve', 'world.cds'); describe('Hello world!', () => { afterAll(() => { delete process.env.CDS_TYPESCRIPT; }); diff --git a/hello/test.http b/hello/test/test.http similarity index 100% rename from hello/test.http rename to hello/test/test.http diff --git a/package.json b/package.json index 8d4d7efd..d796f30b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,12 @@ "media": "cds watch media", "mocha": "npx mocha || echo", "jest": "npx jest", - "test": "npm run jest --silent" + "test": "npm run jest --silent && npm run test:hello", + "test:hello": "cd hello && npm test" + }, + "jest": { + "testEnvironment": "node", + "testMatch": ["**/*.test.js"] }, "mocha": { "parallel": true diff --git a/samples.md b/samples.md index 516d3fa6..e6c8b066 100644 --- a/samples.md +++ b/samples.md @@ -7,6 +7,7 @@ Each sub directory essentially is an individual npm package arranged in an [all- ## [@capire/hello-world](hello) - A simplistic [Hello World](https://cap.cloud.sap/docs/get-started/hello-world) service using [CDS](https://cap.cloud.sap/docs/cds/) and [cds.services](https://cap.cloud.sap/docs/node.js/api#services-api). +- [Typescript support](https://cap.cloud.sap/docs/get-started/using-typescript) ## [@capire/bookshop](bookshop)