Skip to content

Commit 76e3cc6

Browse files
committed
Fix CI tests
- 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.
1 parent af3b7b6 commit 76e3cc6

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: CI
22

3-
on:
4-
push:
5-
branches: [master]
6-
pull_request:
7-
branches: [master]
3+
on: [push, pull_request, workflow_dispatch]
84

95
jobs:
106
build:
@@ -76,9 +72,12 @@ jobs:
7672
- name: Install build artifact
7773
run: yarn add ./package.tgz
7874

79-
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./vitest.config.mts
75+
- name: Erase path aliases
76+
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json
8077

8178
- name: Run tests, against dist
79+
env:
80+
TEST_DIST: true
8281
run: yarn test
8382

8483
test-types:
@@ -108,7 +107,15 @@ jobs:
108107
- name: Install TypeScript ${{ matrix.ts }}
109108
run: yarn add typescript@${{ matrix.ts }}
110109

110+
- name: Install build artifact
111+
run: yarn add ./package.tgz
112+
113+
- name: Erase path aliases
114+
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json
115+
111116
- name: Test types
117+
env:
118+
TEST_DIST: true
112119
run: |
113120
yarn tsc --version
114121
yarn type-tests

vitest.config.mts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ export default defineConfig({
44
test: {
55
globals: true,
66
alias: {
7-
'redux-thunk': new URL('src/index.ts', import.meta.url).pathname, // @remap-prod-remove-line
7+
'redux-thunk': new URL(
8+
process.env.TEST_DIST ? 'node_modules/redux-thunk' : 'src/index.ts',
9+
import.meta.url
10+
).pathname,
811

912
// 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
1013
'@internal': new URL('src', import.meta.url).pathname

0 commit comments

Comments
 (0)