diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 6ee6bd7..75682ab 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -32,7 +32,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{env.node_version }} - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v3 name: Install pnpm with: version: ${{ env.pnpm_version }} @@ -56,11 +56,11 @@ jobs: - name: Use Node.js ${{ matrix.version }} if: matrix.runtime == 'node' - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.version }} - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v3 name: Install pnpm with: version: ${{ env.pnpm_version }} @@ -83,7 +83,7 @@ jobs: path: examples/with-${{ matrix.runtime }}/.nmt/dist retention-days: 1 - e2e: + deploy: runs-on: ubuntu-latest needs: - build @@ -94,21 +94,6 @@ jobs: include: ${{fromJson(needs.get-matrix.outputs.deployable_matrix)}} steps: - - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v1 - - - name: Use Node.js ${{ matrix.version }} - if: matrix.runtime == 'node' - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.version }} - - - uses: pnpm/action-setup@v2 - name: Install pnpm - with: - version: ${{ env.pnpm_version }} - - run: pnpm install - - name: Azure Login uses: azure/login@v2 with: @@ -126,8 +111,31 @@ jobs: app-name: nmt-e2e-${{ matrix.target }}-${{ secrets[matrix.resource_identifier_key] }} package: . - - name: Wait for the deployment to finish - run: sleep 15 + e2e: + runs-on: ubuntu-latest + needs: + - build + - deploy + - get-matrix + timeout-minutes: 10 + strategy: + matrix: + include: ${{fromJson(needs.get-matrix.outputs.deployable_matrix)}} + + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v1 + + - name: Use Node.js ${{ env.node_version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.node_version }} + + - uses: pnpm/action-setup@v3 + name: Install pnpm + with: + version: ${{ env.pnpm_version }} + - run: pnpm install - name: Run E2E tests run: pnpm exec nx run @infra/azure-functions:test diff --git a/examples/with-node/nammatham.config.mjs b/examples/with-node/nammatham.config.mjs index 5b36314..fcb8cc8 100644 --- a/examples/with-node/nammatham.config.mjs +++ b/examples/with-node/nammatham.config.mjs @@ -28,9 +28,9 @@ const nammathamConfig = { excludedTypes: 'Request', }, }, - // logLevel: { - // default: 'Trace', - // }, + logLevel: { + default: 'Trace', + }, }, }, }; diff --git a/infra/azure-functions/src/e2e.test.ts b/infra/azure-functions/src/e2e.test.ts index 0fb62ab..f02eacc 100644 --- a/infra/azure-functions/src/e2e.test.ts +++ b/infra/azure-functions/src/e2e.test.ts @@ -1,4 +1,5 @@ import { test, expect } from 'bun:test'; +import supertest from 'supertest'; const url = process.env.AZURE_FUNCTIONS_URL; const apiKey = process.env.AZURE_FUNCTIONS_API_KEY; @@ -6,6 +7,6 @@ if (!url) throw new Error('AZURE_FUNCTIONS_URL not set'); if (!apiKey) throw new Error('AZURE_FUNCTIONS_API_KEY not set'); test('e2e', async () => { - const response = await fetch(new URL(`/api/SimpleHttpTrigger?code=${apiKey}`, url).toString()); + const response = await supertest(url).get(`/api/SimpleHttpTrigger?code=${apiKey}`); expect(response.status).toBe(200); });