Skip to content

Commit

Permalink
fix: Run test sequentially. Improve test command and compose
Browse files Browse the repository at this point in the history
  • Loading branch information
mateopresacastro committed Nov 7, 2024
1 parent 50cfdee commit 1447b6a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,18 @@ jobs:
FORCE_COLOR: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: "22"

- name: Install Dependencies
run: npm install --legacy-peer-deps

- name: Start Docker Compose Services
run: docker compose up -d --remove-orphans

- name: Run Prisma Migrations
run: npm run db:push

- name: Run Tests
run: npx jest --detectOpenHandles --forceExit
run: npm test

- name: Stop Docker Compose Services
if: always()
Expand All @@ -52,7 +46,7 @@ jobs:
runs-on: ubuntu-latest
needs: Test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install Vercel CLI
run: npm install --global vercel@latest
Expand Down
4 changes: 2 additions & 2 deletions lib/aws/aws.mod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import {
} from "@aws-sdk/client-s3";

describe("AWS S3 integration tests with LocalStack", () => {
beforeAll(async () => {
beforeEach(async () => {
try {
await s3.send(new CreateBucketCommand({ Bucket: "test-bucket" }));
} catch (error) {
console.error("Error in beforeAll bucket creation", error);
console.log(error);
}
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"db:format": "npx prisma format",
"db:seed": "npx prisma db seed",
"db:push": "npx prisma db push",
"test": "docker compose up -d --remove-orphans && npx jest --detectOpenHandles --forceExit --silent"
"test": "docker compose up -d --remove-orphans && npm run db:push && npx jest --detectOpenHandles --forceExit --silent"
},
"prisma": {
"schema": "lib/db/schema.prisma",
Expand Down

0 comments on commit 1447b6a

Please sign in to comment.