Skip to content

Commit fd7165c

Browse files
wmertensmhevery
andauthored
chore: switch to vitest (QwikDev#5300)
* chore: update deps ran npm-check -i on all package.json files and did manual sanity check for safe updates * chore: dep fixes * chore: pnpm api.update * refactor(promise): rename then -> maybeThen The export `then` breaks vitest: vitest-dev/vitest#1767 * chore: switch to vitest most of the time just replace suite with test or describe, and use assert.equal for minimal code changes. * chore(tests): render-ssr no q:key innerhtml these tests seem to have been incorrect * fixup: added settings --------- Co-authored-by: Miško Hevery <[email protected]>
1 parent 7a3191a commit fd7165c

File tree

104 files changed

+3494
-3723
lines changed

Some content is hidden

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

104 files changed

+3494
-3723
lines changed

.all-contributorsrc

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"projectOwner": "BuilderIO",
44
"repoType": "github",
55
"repoHost": "https://github.com",
6-
"files": [
7-
"README.md"
8-
],
6+
"files": ["README.md"],
97
"imageSize": 100,
108
"commit": true,
119
"commitConvention": "angular",

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ lib
3434
tsdoc-metadata.json
3535

3636
# IDE and local environment
37-
.vscode/settings.json
3837
.idea
3938
.eslintcache
4039
test-results

.vscode/extensions.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"ms-azuretools.vscode-docker",
99
"manucorporat.vermoji",
1010
"vadimcn.vscode-lldb",
11-
"streetsidesoftware.code-spell-checker"
11+
"streetsidesoftware.code-spell-checker",
12+
"ZixuanChen.vitest-explorer"
1213
],
1314
"unwantedRecommendations": []
1415
}

.vscode/launch.json

-15
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,6 @@
2222
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
2323
"cwd": "${workspaceFolder}",
2424
"args": ["--runInBand", "--watchAll=false"]
25-
},
26-
{
27-
"name": "uvu Current File",
28-
"type": "node",
29-
"request": "launch",
30-
"skipFiles": ["<node_internals>/**"],
31-
"program": "${workspaceFolder}/node_modules/tsm/bin.js",
32-
"args": [
33-
"${workspaceFolder}/node_modules/uvu/bin.js",
34-
"${fileDirname}",
35-
"${fileBasename}",
36-
"--tsmconfig",
37-
"${workspaceFolder}/tsm.cjs"
38-
],
39-
"console": "integratedTerminal"
4025
}
4126
]
4227
}

.vscode/settings.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"vitest.include": ["**/*.{test,spec,unit}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
3+
"vitest.exclude": [
4+
"**/node_modules/**",
5+
"**/dist/**",
6+
"**/dist-dev/**",
7+
"**/cypress/**",
8+
"**/.{idea,git,cache,output,temp}/**"
9+
]
10+
}

CONTRIBUTING.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -234,20 +234,12 @@ pnpm serve
234234

235235
### Unit Tests Only
236236

237-
Unit tests use [uvu](https://github.com/lukeed/uvu)
237+
Unit tests use [vitest](https://vitest.dev)
238238

239239
```shell
240240
pnpm test.unit
241241
```
242242

243-
To keep _uvu_ open with the watch mode, run:
244-
245-
```shell
246-
pnpm test.watch
247-
```
248-
249-
> Note that the `test.watch` command isn't necessary if you're running the `pnpm start` command, since `start` will also concurrently run the _uvu_ watch process.
250-
251243
### E2E Tests Only
252244

253245
E2E tests use [Playwright](https://playwright.dev/).

package.json

+33-34
Original file line numberDiff line numberDiff line change
@@ -27,66 +27,65 @@
2727
"esbuild-plugin-raw": "^0.1.7"
2828
},
2929
"devDependencies": {
30-
"@builder.io/partytown": "^0.8.0",
30+
"@builder.io/partytown": "^0.8.1",
3131
"@clack/prompts": "^0.7.0",
32-
"@microsoft/api-documenter": "^7.22.30",
33-
"@microsoft/api-extractor": "7.36.3",
34-
"@napi-rs/cli": "2.12.1",
32+
"@microsoft/api-documenter": "^7.23.9",
33+
"@microsoft/api-extractor": "^7.38.0",
34+
"@napi-rs/cli": "^2.16.3",
3535
"@napi-rs/triples": "1.1.0",
3636
"@node-rs/helper": "1.3.3",
3737
"@octokit/action": "3.18.1",
38-
"@playwright/test": "1.36.2",
39-
"@types/brotli": "1.3.1",
40-
"@types/cross-spawn": "6.0.2",
41-
"@types/eslint": "8.44.1",
42-
"@types/express": "4.17.17",
43-
"@types/mri": "1.1.1",
44-
"@types/node": "^20.4.5",
38+
"@playwright/test": "^1.38.1",
39+
"@types/brotli": "^1.3.2",
40+
"@types/cross-spawn": "^6.0.3",
41+
"@types/eslint": "^8.44.4",
42+
"@types/express": "^4.17.19",
43+
"@types/mri": "^1.1.2",
44+
"@types/node": "^20.8.4",
4545
"@types/path-browserify": "1.0.0",
46-
"@types/prettier": "2.7.3",
47-
"@types/prompts": "2.4.4",
48-
"@types/semver": "7.5.0",
46+
"@types/prompts": "^2.4.6",
47+
"@types/semver": "^7.5.3",
4948
"@types/which-pm-runs": "1.0.0",
50-
"@typescript-eslint/eslint-plugin": "6.2.0",
51-
"@typescript-eslint/parser": "6.2.0",
52-
"@typescript-eslint/rule-tester": "^6.2.0",
53-
"@typescript-eslint/utils": "6.2.0",
49+
"@typescript-eslint/eslint-plugin": "^6.7.5",
50+
"@typescript-eslint/parser": "^6.7.5",
51+
"@typescript-eslint/rule-tester": "^6.7.5",
52+
"@typescript-eslint/utils": "^6.7.5",
5453
"all-contributors-cli": "6.26.1",
5554
"brotli": "1.3.3",
5655
"commitizen": "4.3.0",
57-
"concurrently": "8.2.0",
56+
"concurrently": "^8.2.1",
5857
"create-qwik": "workspace:*",
5958
"cross-spawn": "7.0.3",
6059
"cz-conventional-changelog": "3.3.0",
61-
"esbuild": "0.18.17",
62-
"eslint": "8.45.0",
60+
"esbuild": "^0.19.4",
61+
"eslint": "^8.51.0",
6362
"eslint-plugin-no-only-tests": "3.1.0",
64-
"eslint-plugin-qwik": "1.2.6",
63+
"eslint-plugin-qwik": "^1.2.13",
6564
"execa": "7.2.0",
6665
"express": "4.18.2",
6766
"install": "^0.13.0",
68-
"monaco-editor": "^0.39.0",
67+
"monaco-editor": "^0.44.0",
6968
"mri": "1.2.0",
7069
"ora": "6.3.1",
7170
"path-browserify": "1.0.1",
72-
"prettier": "3.0.0",
71+
"prettier": "^3.0.3",
7372
"prettier-plugin-jsdoc": "^1.1.1",
7473
"pretty-quick": "^3.1.3",
7574
"prompts": "2.4.2",
7675
"rollup": "3.26.3",
7776
"semver": "7.5.4",
7877
"snoop": "^1.0.4",
7978
"syncpack": "^10.7.3",
80-
"terser": "5.19.2",
81-
"tsm": "2.2.2",
82-
"typescript": "5.1.6",
83-
"undici": "5.22.1",
84-
"uvu": "0.5.6",
85-
"vite": "4.4.7",
86-
"vite-tsconfig-paths": "4.2.0",
79+
"terser": "^5.21.0",
80+
"tsm": "^2.3.0",
81+
"typescript": "^5.2.2",
82+
"undici": "^5.26.0",
83+
"vite": "^4.4.11",
84+
"vite-tsconfig-paths": "^4.2.1",
85+
"vitest": "0.34.6",
8786
"watchlist": "0.3.1",
8887
"which-pm-runs": "1.1.0",
89-
"zod": "^3.21.4"
88+
"zod": "^3.22.4"
9089
},
9190
"engines": {
9291
"node": ">=16.8.0 <18.0.0 || >=18.11",
@@ -148,8 +147,8 @@
148147
"test.e2e.firefox": "playwright test starters --browser=firefox --config starters/playwright.config.ts",
149148
"test.e2e.webkit": "playwright test starters --browser=webkit --config starters/playwright.config.ts",
150149
"test.rust": "make test",
151-
"test.unit": "tsm node_modules/uvu/bin.js packages unit.ts --tsmconfig tsm.cjs",
152-
"test.unit.debug": "tsm --inspect-brk node_modules/uvu/bin.js packages unit.ts --tsmconfig tsm.cjs",
150+
"test.unit": "vitest packages",
151+
"test.unit.debug": "vitest --inspect-brk packages",
153152
"test.vite": "playwright test starters/e2e/qwikcity --browser=chromium --config starters/playwright.config.ts",
154153
"test.watch": "watchlist packages unit.ts -- pnpm test.unit",
155154
"tsc.check": "tsc --noEmit",

packages/create-qwik/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"bugs": "https://github.com/BuilderIO/qwik/issues",
88
"devDependencies": {
99
"@clack/prompts": "^0.7.0",
10-
"@types/yargs": "17.0.24",
10+
"@types/yargs": "^17.0.28",
1111
"kleur": "4.1.5",
1212
"yargs": "17.7.2"
1313
},

packages/docs/package.json

+24-25
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,48 @@
77
"devDependencies": {
88
"@algolia/autocomplete-core": "1.7.4",
99
"@algolia/client-search": "4.14.3",
10-
"@builder.io/partytown": "^0.8.0",
10+
"@builder.io/partytown": "^0.8.1",
1111
"@builder.io/qwik": "github:BuilderIo/qwik-build#d3722d228e541225f75068160287811ee900a29c",
1212
"@builder.io/qwik-city": "github:BuilderIo/qwik-city-build#86e0034604ef6ecb2e50e7b3c2c2b8f3a36b0118",
1313
"@builder.io/qwik-labs": "github:BuilderIo/qwik-labs-build#f93ef76256c988d57acd24cc5d59ebf2e39c3d02",
1414
"@builder.io/qwik-react": "0.5.0",
15-
"@builder.io/sdk-qwik": "^0.4.5",
16-
"@docsearch/css": "3.3.4",
15+
"@builder.io/sdk-qwik": "^0.6.2",
16+
"@docsearch/css": "^3.5.2",
1717
"@emotion/react": "^11.11.1",
1818
"@emotion/styled": "^11.11.0",
1919
"@modular-forms/qwik": "^0.21.0",
20-
"@mui/material": "^5.13.0",
21-
"@mui/x-data-grid": "^6.4.0",
22-
"@supabase/supabase-js": "^2.33.1",
23-
"@types/prismjs": "^1.26.0",
24-
"@types/react": "18.2.17",
25-
"@types/react-dom": "18.2.7",
26-
"@unpic/core": "^0.0.28",
27-
"@unpic/qwik": "^0.0.24",
20+
"@mui/material": "^5.14.13",
21+
"@mui/x-data-grid": "^6.16.1",
22+
"@supabase/supabase-js": "^2.38.0",
23+
"@types/prismjs": "^1.26.1",
24+
"@types/react": "^18.2.28",
25+
"@types/react-dom": "^18.2.13",
26+
"@unpic/core": "^0.0.31",
27+
"@unpic/qwik": "^0.0.27",
2828
"algoliasearch": "4.16.0",
29-
"autoprefixer": "^10.4.14",
30-
"fflate": "0.8.0",
29+
"autoprefixer": "^10.4.16",
30+
"fflate": "^0.8.1",
3131
"gray-matter": "4.0.3",
3232
"openai": "^3.3.0",
33-
"postcss": "8.4.27",
34-
"prettier": "3.0.0",
33+
"postcss": "^8.4.31",
34+
"prettier": "^3.0.3",
3535
"prism-themes": "1.9.0",
3636
"prismjs": "1.29.0",
3737
"puppeteer": "^20.9.0",
38-
"qwik-image": "^0.0.7",
38+
"qwik-image": "^0.0.8",
3939
"react": "18.2.0",
4040
"react-dom": "18.2.0",
41-
"rehype-pretty-code": "0.9.8",
42-
"shiki": "^0.14.3",
41+
"rehype-pretty-code": "^0.10.1",
42+
"shiki": "^0.14.5",
4343
"snarkdown": "^2.0.0",
4444
"tailwindcss": "3.3.3",
45-
"tsm": "2.2.2",
46-
"typescript": "5.1.6",
47-
"undici": "5.22.1",
48-
"uvu": "0.5.6",
45+
"tsm": "^2.3.0",
46+
"typescript": "^5.2.2",
47+
"undici": "^5.26.0",
4948
"valibot": "^0.17.1",
50-
"vite": "4.4.7",
51-
"vite-plugin-inspect": "^0.7.33",
52-
"wrangler": "^3.3.0"
49+
"vite": "^4.4.11",
50+
"vite-plugin-inspect": "^0.7.40",
51+
"wrangler": "^3.11.0"
5352
},
5453
"engines": {
5554
"node": ">=18.11",

packages/docs/src/repl/repl-share-url.unit.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { test } from 'uvu';
2-
import * as assert from 'uvu/assert';
1+
import { assert, test } from 'vitest';
32
import {
43
filesToStr,
54
strToFiles,
@@ -32,19 +31,22 @@ test('filesToStr', () => {
3231
);
3332
});
3433
test('round trip str', () => {
35-
assert.equal(strToFiles(filesToStr(data.files)), data.files);
34+
assert.deepEqual(strToFiles(filesToStr(data.files)), data.files);
3635
});
3736
test('compressFiles', () => {
3837
assert.equal(compressFiles(data.files), 'M6tJy8/XyyoGeqYGub5UAgoraVrXmNUkJRZhkwcKA+UB');
3938
});
4039
test('parseCompressedFiles', () => {
41-
assert.equal(parseCompressedFiles('M6tJy8/XyyoGeqYGub5UAgoraVrXmNUkJRZhkwcKA+UB'), data.files);
40+
assert.deepEqual(
41+
parseCompressedFiles('M6tJy8/XyyoGeqYGub5UAgoraVrXmNUkJRZhkwcKA+UB'),
42+
data.files
43+
);
4244
});
4345
test('round trip compressed', () => {
44-
assert.equal(parseCompressedFiles(compressFiles(data.files)), data.files);
46+
assert.deepEqual(parseCompressedFiles(compressFiles(data.files)), data.files);
4547
});
4648
test('createPlaygroundShareUrl', () => {
47-
assert.equal(
49+
assert.deepEqual(
4850
createPlaygroundShareUrl(data),
4951
'/playground/#v=1.2.3&f=M6tJy8%2FXyyoGeqYGub5UAgoraVrXmNUkJRZhkwcKA%2BUB'
5052
);
@@ -67,5 +69,3 @@ test('dictionary is unchanged', () => {
6769
"0||1448|<div> </div> </button> props: class return ( story component$( store string state export const span type href={ page strong count useSignal< useStore< qwik import { } from searchInput console.log( searchResults builder useTask$( stories style={ news export default data </article> track onClick$= new nav map link debounced controller user useStyles$( useStylesScoped$( url title timeoutId time_ago second response Date.now() minute main item interface hour disabled aria any State update transform the target suggestion setTimeout selectedValue rotate render people number list label https:// header deg debouncedGetPeople debounce component comments_count comments clock background await new Promise args SuggestionsListComponent IStory IState IComment GrandChild Clock Child AutoComplete 360 yellow with view useVisibleTask$( true tmrId timer then swapi styles signal section search results resolve rel prev points parsedResponse null noreferrer name more length json job items isServer index github getPeople function fetch example domain dev delay css container com click clearTimeout async api _blank Star Wars API This The StoryPreview Stories ReturnType Qwik App Page Nav HackerNewsCSS AbortController server$( routeAction$( routeLoader$( useContent( useDocumentHead( useLocation( useNavigate( validator$( zod$( noSerialize( </Slot> useComputed$( useOnDocument( useOnWindow( useResource$( useContext( useContextProvider( createContextId<|8|/app.tsx|114|import { component$ } from '@builder.io/qwik';\n\nexport default component$(() => {\n return <p>Hello Qwik</p>;\n});\n|17|/entry.server.tsx|201|import { renderToString, type RenderOptions } from '@builder.io/qwik/server';\nimport { Root } from './root';\n\nexport default function (opts: RenderOptions) {\n return renderToString(<Root />, opts);\n}\n|9|/root.tsx|192|import App from './app';\n\nexport const Root = () => {\n return (\n <>\n <head>\n <title>Hello Qwik</title>\n </head>\n <body>\n <App />\n </body>\n </>\n );\n};\n"
6870
);
6971
});
70-
71-
test.run();
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
{
22
"id": "qwik-city-vite-bun-server",
33
"package": "@builder.io/qwik-city/vite/bun-server",
4-
"members": []
4+
"members": [
5+
{
6+
"name": "bunServerAdapter",
7+
"id": "bunserveradapter",
8+
"hierarchy": [
9+
{
10+
"name": "bunServerAdapter",
11+
"id": "bunserveradapter"
12+
}
13+
],
14+
"kind": "Function",
15+
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\n\n\n```typescript\nexport declare function bunServerAdapter(opts?: bunServerAdapterOptions): any;\n```\n\n\n| Parameter | Type | Description |\n| --- | --- | --- |\n| opts | [bunServerAdapterOptions](#bunserveradapteroptions) | _(Optional)_ |\n\n**Returns:**\n\nany",
16+
"editUrl": "https://github.com/BuilderIO/qwik/tree/main/packages/qwik-city/adapters/bun-server/vite/index.ts",
17+
"mdFile": "qwik-city.bunserveradapter.md"
18+
},
19+
{
20+
"name": "bunServerAdapterOptions",
21+
"id": "bunserveradapteroptions",
22+
"hierarchy": [
23+
{
24+
"name": "bunServerAdapterOptions",
25+
"id": "bunserveradapteroptions"
26+
}
27+
],
28+
"kind": "Interface",
29+
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\n\n\n```typescript\nexport interface bunServerAdapterOptions extends ServerAdapterOptions \n```\n**Extends:** ServerAdapterOptions\n\n\n| Property | Modifiers | Type | Description |\n| --- | --- | --- | --- |\n| [name?](#) | | string | **_(ALPHA)_** _(Optional)_ |",
30+
"editUrl": "https://github.com/BuilderIO/qwik/tree/main/packages/qwik-city/adapters/bun-server/vite/index.ts",
31+
"mdFile": "qwik-city.bunserveradapteroptions.md"
32+
}
33+
]
534
}

packages/docs/src/routes/api/qwik-city-vite-bun-server/index.md

+34
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,37 @@ title: \@builder.io/qwik-city/vite/bun-server API Reference
33
---
44

55
# [API](/api) &rsaquo; @builder.io/qwik-city/vite/bun-server
6+
7+
## bunServerAdapter
8+
9+
> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
10+
11+
```typescript
12+
export declare function bunServerAdapter(opts?: bunServerAdapterOptions): any;
13+
```
14+
15+
| Parameter | Type | Description |
16+
| --------- | --------------------------------------------------- | ------------ |
17+
| opts | [bunServerAdapterOptions](#bunserveradapteroptions) | _(Optional)_ |
18+
19+
**Returns:**
20+
21+
any
22+
23+
[Edit this section](https://github.com/BuilderIO/qwik/tree/main/packages/qwik-city/adapters/bun-server/vite/index.ts)
24+
25+
## bunServerAdapterOptions
26+
27+
> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
28+
29+
```typescript
30+
export interface bunServerAdapterOptions extends ServerAdapterOptions
31+
```
32+
33+
**Extends:** ServerAdapterOptions
34+
35+
| Property | Modifiers | Type | Description |
36+
| ---------- | --------- | ------ | -------------------------- |
37+
| [name?](#) | | string | **_(ALPHA)_** _(Optional)_ |
38+
39+
[Edit this section](https://github.com/BuilderIO/qwik/tree/main/packages/qwik-city/adapters/bun-server/vite/index.ts)

0 commit comments

Comments
 (0)