nodejs-quickstart-structure 1.1.8 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Node.js CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
node-version: [18.x, 20.x]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v3
|
|
20
|
+
|
|
21
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
22
|
+
uses: actions/setup-node@v3
|
|
23
|
+
with:
|
|
24
|
+
node-version: ${{ matrix.node-version }}
|
|
25
|
+
cache: 'npm'
|
|
26
|
+
|
|
27
|
+
- name: Install Dependencies
|
|
28
|
+
run: npm ci
|
|
29
|
+
|
|
30
|
+
- name: Lint Code
|
|
31
|
+
run: npm run lint
|
|
32
|
+
|
|
33
|
+
- name: Run Tests
|
|
34
|
+
run: npm test
|
|
35
|
+
|
|
36
|
+
- name: Build
|
|
37
|
+
run: npm run build --if-present
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<% if (language === 'TypeScript') { %>import request from 'supertest';
|
|
2
|
+
import express from 'express';<% } else { %>const request = require('supertest');
|
|
3
|
+
const express = require('express');<% } %>
|
|
4
|
+
|
|
5
|
+
const app = express();
|
|
6
|
+
app.get('/health', (req, res) => res.json({ status: 'UP' }));
|
|
7
|
+
|
|
8
|
+
describe('Health Check', () => {
|
|
9
|
+
it('should return 200 OK', async () => {
|
|
10
|
+
const res = await request(app).get('/health');
|
|
11
|
+
expect(res.status).toBe(200);
|
|
12
|
+
expect(res.body).toEqual({ status: 'UP' });
|
|
13
|
+
});
|
|
14
|
+
});
|