Skip to content

Commit e3c3c49

Browse files
Merge pull request #153 from RyanClementsHax/vitest
Vitest
2 parents f19c733 + 2fa2143 commit e3c3c49

28 files changed

+4801
-10502
lines changed

.eslintignore

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

.eslintrc.js

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

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
node-version: 22
1616
- name: restore dependencies
1717
uses: bahmutov/npm-install@v1
18+
- name: restore dependencies
19+
uses: bahmutov/npm-install@v1
20+
with:
21+
working-directory: e2e
1822
- run: npm run lint:all
1923
type_check:
2024
name: type check
@@ -39,8 +43,11 @@ jobs:
3943
- name: restore dependencies
4044
uses: bahmutov/npm-install@v1
4145
- run: npm run test
46+
- name: report coverage
47+
if: always()
48+
uses: davelosert/vitest-coverage-report-action@v2
4249
e2e:
43-
timeout-minutes: 60
50+
timeout-minutes: 15
4451
runs-on: ubuntu-latest
4552
steps:
4653
- uses: actions/checkout@v4

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
node_modules
2-
yarn.lock
32
lib
43
dist
54
coverage

.stylelintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
node_modules
2-
yarn.lock
32
lib
4-
dist
53
examples
64
coverage

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"stylelint.vscode-stylelint",
88
"bradlc.vscode-tailwindcss",
99
"csstools.postcss",
10-
"ms-playwright.playwright"
10+
"ms-playwright.playwright",
11+
"vitest.explorer"
1112
]
1213
}

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"scss.validate": false,
1010
"editor.codeActionsOnSave": {
1111
"source.fixAll.markdownlint": "explicit",
12-
"source.fixAll.stylelint": "explicit"
12+
"source.fixAll.stylelint": "explicit",
13+
"source.fixAll.eslint": "explicit"
1314
},
1415
"stylelint.validate": ["css", "scss", "postcss"]
1516
}

e2e/test_repos/drivers/create-react-app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ async function startServerWithRetry({
113113
while (attemptNumber <= maxAttempts) {
114114
attemptNumber++
115115
if (attemptNumber > 1) {
116-
// eslint-disable-next-line no-console
117116
console.log(
118117
`Retrying (attempt ${attemptNumber}) starting the server because: ${failedReason}`
119118
)

e2e/test_repos/drivers/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class IsolatedRepoInstanceImpl implements IsolatedRepoInstance {
157157
})
158158
}, 20_000)
159159
serveProcess.stderr.pipe(process.stderr)
160-
serveProcess.stdout.on('data', chunk => {
160+
serveProcess.stdout.on('data', (chunk: { toString(): string }) => {
161161
if (finishedMonitoring) return
162162
const newChunk = chunk.toString()
163163
stdout += newChunk
@@ -187,7 +187,9 @@ class IsolatedRepoInstanceImpl implements IsolatedRepoInstance {
187187
} catch (e: unknown) {
188188
clearTimeout(failTimeout)
189189
finishedMonitoring = true
190-
void stop().then(() => reject(e))
190+
void stop().then(() =>
191+
reject(e instanceof Error ? e : new Error(JSON.stringify(e)))
192+
)
191193
}
192194
})
193195
})

e2e/test_repos/templates/create-react-app/package-lock.json

Lines changed: 14 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/test_repos/test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class TestRepoBuilderImpl implements TestRepoBuilder {
8080

8181
async open(): Promise<{ repo: TestRepo; root: ThemeRoot }> {
8282
if (!this.#themerConfig) {
83-
throw new Error('cannot open without first defining the themer config')
83+
throw new Error('Cannot open without first defining the themer config')
8484
}
8585

8686
const { url, stop: _stop } = await openWithConfig({
@@ -187,6 +187,8 @@ class ThemeRootImpl implements ThemeRoot {
187187
const attributesInputLocator = this.#attributesInputLocator
188188
return {
189189
async get(): Promise<Record<string, string>> {
190+
// We'll pinky promise here 🤞
191+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
190192
return JSON.parse(await attributesInputLocator.inputValue())
191193
},
192194
async patch(updates: Record<string, string>): Promise<void> {

eslint.config.mjs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import eslint from '@eslint/js'
2+
import tseslint from 'typescript-eslint'
3+
import vitest from 'eslint-plugin-vitest'
4+
import playwright from 'eslint-plugin-playwright'
5+
6+
export default tseslint.config(
7+
{
8+
ignores: [
9+
'lib',
10+
'examples',
11+
'coverage',
12+
'e2e/test_repos/templates',
13+
'**/test-results',
14+
'**/playwright-report'
15+
]
16+
},
17+
eslint.configs.recommended,
18+
...tseslint.configs.recommendedTypeChecked,
19+
{
20+
languageOptions: {
21+
parserOptions: {
22+
projectService: true
23+
}
24+
},
25+
rules: {
26+
quotes: ['warn', 'single'],
27+
'no-unused-vars': 'off',
28+
'@typescript-eslint/no-unused-vars': [
29+
'warn',
30+
{ varsIgnorePattern: '^_', ignoreRestSiblings: true }
31+
],
32+
'@typescript-eslint/no-floating-promises': 'error'
33+
}
34+
},
35+
{
36+
ignores: ['e2e/**'],
37+
languageOptions: {
38+
parserOptions: {
39+
project: './tsconfig.json'
40+
}
41+
},
42+
rules: {
43+
'@typescript-eslint/unbound-method': 'off',
44+
'@typescript-eslint/no-unsafe-assignment': 'off',
45+
'@typescript-eslint/no-unsafe-return': 'off',
46+
'@typescript-eslint/no-unsafe-call': 'off',
47+
'@typescript-eslint/no-unsafe-argument': 'off'
48+
}
49+
},
50+
{
51+
files: ['e2e/**/*.?(c|m)[jt]s?(x)'],
52+
languageOptions: {
53+
parserOptions: {
54+
project: './e2e/tsconfig.json'
55+
}
56+
}
57+
},
58+
{
59+
files: ['src/**/*.{test,spec}.?(c|m)[jt]s?(x)'],
60+
...vitest.configs.recommended
61+
},
62+
{
63+
...playwright.configs['flat/recommended'],
64+
files: ['e2e/tests/**']
65+
}
66+
)

jest.config.js

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

0 commit comments

Comments
 (0)