I just added my first API tests to my redwood project, and they pass locally but fail when I run them on github actions.
This is my action config:
name: Run RW Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
DB_URL: postgresql://postgres:postgres@localhost:5432/postgres
CLERK_API_KEY: <redacted>
CLERK_FRONTEND_API_URL: <redacted>
CLERK_JWT_KEY: <redacted>
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn rw build
- run: yarn rw test --no-watch
and this is the error the tests fail with:
TypeError: Cannot redefine property: __RESOLVED_TMP_DIR__
at Function.defineProperty (<anonymous>)
at Object.get (node_modules/jest-environment-node/build/index.js:100:20)
at Object.<anonymous> (node_modules/temp-write/node_modules/temp-dir/index.js:7:12)
at Object.<anonymous> (node_modules/temp-write/index.js:8:17)
at Object.<anonymous> (node_modules/@prisma/internals/dist/engine-commands/queryEngineCommons.js:44:33)
at Object.<anonymous> (node_modules/@prisma/internals/dist/engine-commands/getConfig.js:43:33)
at Object.<anonymous> (node_modules/@prisma/internals/dist/engine-commands/index.js:29:24)
at Object.<anonymous> (node_modules/@prisma/internals/dist/index.js:120:25)
at configureTeardown (node_modules/@redwoodjs/testing/config/jest/api/jest.setup.js:35:23)
at Object.<anonymous> (node_modules/@redwoodjs/testing/config/jest/api/jest.setup.js:225:11)
I tried running the tests locally with both node v14 and node v16, but they pass.
I saw a post on the Discord from someone with a similar issue here: Discord but it didn’t look like there was any resolution.
Any ideas about what I should look into next?