diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..5bd561f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Test Project + +on: + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + container: + image: node:20 + steps: + - uses: actions/checkout@v3 + with: + node-version: 20 + - run: npm ci + - run: npm test + - run: npm run build + \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 71ad74c..73a2ff4 100755 --- a/src/index.ts +++ b/src/index.ts @@ -33,7 +33,8 @@ async function startServer() { }); } catch (error) { console.error("Failed to connect to the database:", error); - process.exit(1); + // Instead of process.exit(1); + throw new Error("Failed to connect to the database: " + error); } } @@ -44,4 +45,4 @@ function stop() { export { server, startServer, stop }; -startServer(); \ No newline at end of file +startServer();