Skip to content

Commit

Permalink
Fix CI tests
Browse files Browse the repository at this point in the history
- It seems like the new version of Vite much like Node.js allows packages to self-reference themselves, which became a problem considering how we were running the tests against the build artifact during CI.
  • Loading branch information
aryaemami59 committed Jun 24, 2024
1 parent 309934e commit 8f734ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ jobs:
- name: Install build artifact
run: yarn add ./package.tgz

- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./vitest.config.mts
- run: sed -i -e /@remap-prod-remove-line/d tsconfig.base.json

- name: Run tests, against dist
env:
TEST_DIST: true
run: yarn test

test-types:
Expand Down Expand Up @@ -129,6 +131,8 @@ jobs:
run: yarn add ./package.tgz

- name: Test types
env:
TEST_DIST: true
run: |
yarn tsc --version
yarn type-tests
Expand Down
5 changes: 4 additions & 1 deletion vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export default defineConfig({
globals: true,
dir: 'test',
alias: {
redux: path.join(__dirname, './src/index.ts'), // @remap-prod-remove-line
redux: path.join(
__dirname,
process.env.TEST_DIST ? 'node_modules/redux' : 'src/index.ts'
),

// this mapping is disabled as we want `dist` imports in the tests only to be used for "type-only" imports which don't play a role for jest
'@internal': path.join(__dirname, 'src')
Expand Down

0 comments on commit 8f734ae

Please sign in to comment.