Skip to content

Commit 82ceb40

Browse files
authored
Vite & vitest (#313)
* update deps (matrix crdt) * add force * fix matrix test server conf * disable test * wip: migrate to vite * vitest * small fixes * fix build * add lint * fix star:local * fix test * clean deps * fix ci * add gh ci timeout * small fixes * several vite fixes * improve build configs and playwright * fix pw * update index * fix uris * try pw fix * try fix ci * fix build * undo pw * faster pw? * always collect traces * fix icons * update cache * test pw cache * playwright no deps * run pw * fix deps * dont run * run pw * fix pw * disable lerna hoist and improve playwright (#314) * no hoist * fix patch package * fix build * npm ci root * no test * update pw version * fix overrides * fix build * update packages * force * run tests * add comment * improve playwright * playwright preview * increase build heap space * comments * fix revert
1 parent 3c7924f commit 82ceb40

File tree

78 files changed

+46969
-58814
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+46969
-58814
lines changed

.github/workflows/build.yaml

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ jobs:
66
build:
77
name: Build
88
runs-on: ubuntu-latest
9+
timeout-minutes: 20
910
steps:
1011
- uses: actions/checkout@master
1112

@@ -15,11 +16,12 @@ jobs:
1516
node-version: 16.x
1617

1718
# doesn't seem to cause significant speed up, probably because it still needs to install deps
18-
# - name: cache playwright
19-
# uses: actions/cache@v2
20-
# with:
21-
# path: ~/.cache/ms-playwright
22-
# key: pw-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
19+
- name: cache playwright
20+
id: playwright-cache
21+
uses: actions/cache@v2
22+
with:
23+
path: ~/.cache/ms-playwright
24+
key: pw3-${{ runner.os }}-${{ hashFiles('./packages/**/package-lock.json') }}
2325

2426
# doesn't seem to cause significant speed up, maybe not right conf?
2527
# - name: cache lerna
@@ -37,7 +39,7 @@ jobs:
3739
with:
3840
# npm cache files are stored in `~/.npm` on Linux/macOS
3941
path: ~/.npm
40-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./package-lock.json') }}
42+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./packages/**/package-lock.json') }}
4143
restore-keys: |
4244
${{ runner.os }}-build-${{ env.cache-name }}-
4345
${{ runner.os }}-build-
@@ -55,8 +57,8 @@ jobs:
5557
- name: Check docker logs
5658
run: docker logs synapse
5759

58-
- name: Install Dependencies
59-
run: npm run install-lerna
60+
- name: NPM CI
61+
run: npm ci
6062

6163
- name: Bootstrap packages
6264
run: npm run bootstrap
@@ -69,21 +71,38 @@ jobs:
6971
env:
7072
CI: true
7173

72-
- name: Lint (we don't build React in CI, but at least lint it)
74+
- name: Install Playwright
75+
run: npx playwright install --with-deps
76+
# if: steps.playwright-cache.outputs.cache-hit != 'true'
77+
# env:
78+
# PLAYWRIGHT_BROWSERS_PATH: 0 # https://github.com/microsoft/playwright/blob/main/docs/src/ci.md#caching-browsers
79+
80+
- name: Lint
7381
run: npm run lint
7482
env:
7583
CI: true
7684

77-
- name: Run server
78-
run: npm run start:local & npx wait-on http://localhost:3000
85+
# Option A: don't build in CI, but test against dev server
86+
# (with Vite, building in CI is now fast enough so we can go for option B)
87+
88+
# - name: Run dev server
89+
# # Wait on config file needed for vite dev server: https://github.com/jeffbski/wait-on/issues/78
90+
# run: npm run start:local & npx wait-on http://localhost:5173 -c ./packages/editor/wait-on.conf.json
91+
# env:
92+
# CI: true
93+
94+
# - name: Run Playwright tests (against dev server)
95+
# run: npm run playwright:dev
96+
97+
# Option B: actually build and run react code and run tests against that
98+
- name: Build and run preview server
99+
# Wait on config file needed for vite dev server: https://github.com/jeffbski/wait-on/issues/78
100+
run: npm run start:preview & npx wait-on http://localhost:4173 -c ./packages/editor/wait-on.conf.json
79101
env:
80102
CI: true
81103

82-
- name: Install Playwright
83-
run: npm run install-playwright
84-
85-
- name: Run Playwright tests
86-
run: npm run playwright
104+
- name: Run Playwright tests (against preview server)
105+
run: npm run playwright:preview
87106

88107
- uses: actions/upload-artifact@v2
89108
if: always()

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ types
99

1010
# testing
1111
coverage
12+
playwright-report
1213

1314
# production
1415
/build

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"recommendations": [
55
"esbenp.prettier-vscode",
66
"dbaeumer.vscode-eslint",
7-
"orta.vscode-jest"
7+
"ZixuanChen.vitest-explorer"
88
]
99
}

.vscode/settings.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,12 @@
88
},
99
"search.exclude": {
1010
"packages/editor/public/types": true
11-
}
11+
},
12+
"vitest.exclude": [
13+
"**/node_modules/**",
14+
"**/dist/**",
15+
"**/cypress/**",
16+
"**/.{idea,git,cache,output,temp}/**",
17+
"**/end-to-end/**"
18+
]
1219
}

jest.config.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)