Skip to content

Commit f51b119

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 f51b119

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 7 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:
@@ -66,7 +62,8 @@ jobs:
6662
- name: Install deps
6763
run: yarn install
6864

69-
- uses: actions/download-artifact@v4
65+
- name: Download build artifact
66+
uses: actions/download-artifact@v4
7067
with:
7168
name: package
7269
path: .
@@ -76,9 +73,12 @@ jobs:
7673
- name: Install build artifact
7774
run: yarn add ./package.tgz
7875

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

8179
- name: Run tests, against dist
80+
env:
81+
TEST_DIST: true
8282
run: yarn test
8383

8484
test-types:
@@ -102,13 +102,27 @@ jobs:
102102
node-version: ${{ matrix.node }}
103103
cache: 'yarn'
104104

105+
- name: Download build artifact
106+
uses: actions/download-artifact@v4
107+
with:
108+
name: package
109+
path: .
110+
105111
- name: Install deps
106112
run: yarn install
107113

108114
- name: Install TypeScript ${{ matrix.ts }}
109115
run: yarn add typescript@${{ matrix.ts }}
110116

117+
- name: Install build artifact
118+
run: yarn add ./package.tgz
119+
120+
- name: Erase path aliases
121+
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json
122+
111123
- name: Test types
124+
env:
125+
TEST_DIST: true
112126
run: |
113127
yarn tsc --version
114128
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)