Skip to content

Commit 5f4eccc

Browse files
build: run example as test
1 parent abc4b3a commit 5f4eccc

File tree

9 files changed

+19
-3
lines changed

9 files changed

+19
-3
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ jobs:
99
- uses: actions/setup-node@v1
1010
- run: npm ci --ignore-scripts
1111
- run: npm run prettier:check
12+
tests:
13+
name: Tests
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: test
18+
steps:
19+
- uses: actions/checkout@v1
20+
- uses: actions/setup-node@v1
21+
- run: npm ci --ignore-scripts
22+
- run: npm run build
23+
- run: npm run start
1224
build:
1325
name: Build
1426
runs-on: ubuntu-latest

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"build:cjs": "tsc --project tsconfig.prod.cjs.json",
2929
"build:types": "tsc --project tsconfig.prod.types.json",
3030
"prettier:fix": "prettier --write \"**/*.{ts,md}\"",
31-
"prettier:check": "prettier --check \"**/*.{ts,md}\""
31+
"prettier:check": "prettier --check \"**/*.{ts,md}\"",
32+
"test": "cd test && npm run test"
3233
},
3334
"devDependencies": {
3435
"@types/node": "^14.14.21",
File renamed without changes.

sample/package.json renamed to test/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"typescript": "^4.1.3"
1212
},
1313
"scripts": {
14-
"test": "npm run build && node ./build/sample/src/main.js",
15-
"build": "rm -rf build && tsc"
14+
"build": "rm -rf build && tsc",
15+
"start": "node ./build/test/src/main.js",
16+
"test": "npm run build && npm run start"
1617
}
1718
}
File renamed without changes.

sample/src/main.ts renamed to test/src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ startApp()
1010
.catch(error => {
1111
console.error(`Ohh noo! Error while running the app!`);
1212
console.error(error);
13+
/** We exit with error code so tests will fail. */
14+
process.exit(-1);
1315
});
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)