Skip to content

Commit

Permalink
Actually run integration tests with the corresponding runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Feb 9, 2025
1 parent 9b14e0e commit bbb4385
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
version: '22.x'
- name: 'node'
version: '23.x'
- name: 'deno'
version: 'v1.x'
- name: 'deno'
version: 'v2.x'
- name: 'bun'
Expand All @@ -46,4 +44,4 @@ jobs:
with:
bun-version: ${{ matrix.runtime.version }}
- run: npm ci
- run: SHLINK_VERSION=${{ matrix.shlink-version }} SHLINK_API_VERSION=${{ matrix.shlink-api-version }} npm run test:integration
- run: SHLINK_VERSION=${{ matrix.shlink-version }} SHLINK_API_VERSION=${{ matrix.shlink-api-version }} RUNTIME=${{ matrix.runtime.name }} sh ./test/run-integration-tests.sh
11 changes: 9 additions & 2 deletions test/run-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if [ -z "${SHLINK_VERSION}" ]; then
exit 1
fi

RUNTIME=${RUNTIME:='node'}
export SHLINK_VERSION=${SHLINK_VERSION}
export SHLINK_API_VERSION=${SHLINK_API_VERSION:='3'}
PORT="8765"
Expand All @@ -13,8 +14,14 @@ CONTAINER=$(docker run --rm -d -p ${PORT}:8080 -e DEFAULT_DOMAIN=localhost:${POR
sleep 2 # Let's give the server a couple of seconds to start
export SHLINK_API_KEY=$(docker exec ${CONTAINER} shlink api-key:generate | grep "Generated API key" | sed 's/.*Generated\ API\ key\:\ \"\(.*\)\".*/\1/')

### TODO Run tests here
npm run test -- --config vitest-integration.config.ts
if [ "${RUNTIME}" = "node" ]; then
npm run test -- --config vitest-integration.config.ts
elif [ "${RUNTIME}" = "deno" ]; then
deno run --allow-read=$PWD ./node_modules/.bin/vitest -- run --config vitest-integration.config.ts
elif [ "${RUNTIME}" = "bun" ]; then
bun run test -- --config vitest-integration.config.ts
fi

TESTS_EXIT_CODE=$?

docker stop ${CONTAINER}
Expand Down

0 comments on commit bbb4385

Please sign in to comment.