Skip to content

Refactor CI test runs to run against the code built and packaged instead of source #187

Refactor CI test runs to run against the code built and packaged instead of source

Refactor CI test runs to run against the code built and packaged instead of source #187

Workflow file for this run

name: CI - tests
on:
pull_request:
branches: [master]
jobs:
run_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: ./.github/actions/ci-common-setup
- name: Get "name" from package.json
id: get-name
run: |
echo "package_name=cat ./package.json | jq -r '.name'" >> $GITHUB_OUTPUT
- name: Build and pack library locally
id: pkg-pack
run: |
pnpm pack
- run: |
PACKAGE_FILENAME=$(ls ${{ steps.get-name.outputs.package_name }}-*.tgz)
echo $PACKAGE_FILENAME
# - name: Install locally-packaged library
# run: |
# pnpm i packaged-react-async-iterators@file:./${{fromJson(steps.pkg-pack.outputs.pkg_pack_results)[0].filename}}
# - name: Run tests against packaged library code
# run: |
# [[ -e ./src ]] && mv ./src ./src-ignored-for-packaged-testing
# echo 'export * from "packaged-react-async-iterators";' > ./spec/libEntrypoint.ts
# pnpm test
# [[ -e ./src-ignored-for-packaged-testing ]] && mv ./src-ignored-for-packaged-testing ./src