Skip to content

Commit

Permalink
Merge branch 'main' into fix-eco-ci-6
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Nov 11, 2024
2 parents ca15bb0 + 9b3c3de commit 00b947d
Show file tree
Hide file tree
Showing 25 changed files with 1,557 additions and 911 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/components/FeaturesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
>
<ListItem><a target="_blank" href="https://vitejs.dev" rel="noopener noreferrer">Vite</a>'s config, transformers, resolvers, and plugins</ListItem>
<ListItem>Use the same setup from your app to run the tests!</ListItem>
<ListItem><a target="_blank" href="https://twitter.com/antfu7/status/1468233216939245579" rel="noopener noreferrer">Smart & instant watch mode, like HMR for tests!</a></ListItem>
<ListItem>Smart & instant watch mode, like HMR for tests!</ListItem>
<ListItem>Component testing for Vue, React, Svelte, Lit, Marko and more</ListItem>
<ListItem>Out-of-the-box TypeScript / JSX support</ListItem>
<ListItem>ESM first, top level await</ListItem>
Expand Down
2 changes: 0 additions & 2 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
ogImage,
ogUrl,
releases,
twitter,
vitestDescription,
vitestName,
} from './meta'
Expand Down Expand Up @@ -107,7 +106,6 @@ export default ({ mode }: { mode: string }) => {
socialLinks: [
{ icon: 'bluesky', link: bluesky },
{ icon: 'mastodon', link: mastodon },
{ icon: 'x', link: twitter },
{ icon: 'discord', link: discord },
{ icon: 'github', link: github },
],
Expand Down
15 changes: 0 additions & 15 deletions docs/.vitepress/contributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export interface Contributor {
export interface CoreTeam extends DefaultTheme.TeamMember {
// required to download avatars from GitHub
github: string
twitter?: string
bluesky?: string
mastodon?: string
discord?: string
Expand Down Expand Up @@ -46,10 +45,6 @@ function createLinks(tm: CoreTeam): CoreTeam {
tm.links.push({ icon: 'youtube', link: `https://www.youtube.com/@${tm.youtube}` })
}

if (tm.twitter) {
tm.links.push({ icon: 'x', link: `https://twitter.com/${tm.twitter}` })
}

return tm
}

Expand All @@ -60,7 +55,6 @@ const plainTeamMembers: CoreTeam[] = [
github: 'sheremet-va',
bluesky: 'https://bsky.app/profile/erus.dev',
mastodon: 'https://elk.zone/m.webtoo.ls/@sheremet_va',
twitter: 'sheremet_va',
sponsor: 'https://github.com/sponsors/sheremet-va',
title: 'An open source fullstack developer',
desc: 'Core team member of Vitest & Vite',
Expand All @@ -71,7 +65,6 @@ const plainTeamMembers: CoreTeam[] = [
github: 'antfu',
bluesky: 'https://bsky.app/profile/antfu.me',
mastodon: 'https://elk.zone/m.webtoo.ls/@antfu',
twitter: 'antfu7',
discord: 'https://chat.antfu.me',
youtube: 'antfu',
sponsor: 'https://github.com/sponsors/antfu',
Expand All @@ -86,7 +79,6 @@ const plainTeamMembers: CoreTeam[] = [
github: 'AriPerkkio',
bluesky: 'https://bsky.app/profile/ariperkkio.dev',
mastodon: 'https://elk.zone/m.webtoo.ls/@AriPerkkio',
twitter: 'ari_perkkio',
sponsor: 'https://github.com/sponsors/AriPerkkio',
title: 'Open source engineer, working',
desc: 'Core team member of Vitest',
Expand All @@ -99,7 +91,6 @@ const plainTeamMembers: CoreTeam[] = [
github: 'patak-dev',
bluesky: 'https://bsky.app/profile/patak.dev',
mastodon: 'https://elk.zone/m.webtoo.ls/@patak',
twitter: 'patak_dev',
sponsor: 'https://github.com/sponsors/patak-dev',
title: 'A collaborative being, working',
org: 'StackBlitz',
Expand All @@ -112,7 +103,6 @@ const plainTeamMembers: CoreTeam[] = [
github: 'userquin',
bluesky: 'https://bsky.app/profile/userquin.bsky.social',
mastodon: 'https://elk.zone/m.webtoo.ls/@userquin',
twitter: 'userquin',
title: 'A fullstack and android developer',
desc: 'Vite\'s fanatical follower',
},
Expand All @@ -121,7 +111,6 @@ const plainTeamMembers: CoreTeam[] = [
name: 'Hiroshi Ogawa',
github: 'hi-ogawa',
bluesky: 'https://bsky.app/profile/hiogawa.bsky.social',
twitter: 'hiroshi_18181',
title: 'Open source enthusiast',
desc: 'Team member of Vitest',
},
Expand All @@ -132,7 +121,6 @@ const plainTeamEmeritiMembers: CoreTeam[] = [
avatar: contributorsAvatars.Dunqing,
name: 'Dunqing',
github: 'Dunqing',
twitter: '@Dunqingg',
title: 'A passionate enthusiast of open source contributions',
desc: 'Team member of oxc & UnoCSS',
},
Expand All @@ -142,7 +130,6 @@ const plainTeamEmeritiMembers: CoreTeam[] = [
github: 'Aslemammad',
bluesky: 'https://bsky.app/profile/aslemammad.bsky.social',
mastodon: 'https://elk.zone/m.webtoo.ls/@aslemammad',
twitter: 'asleMammadam',
title: 'An open source developer',
desc: 'Team member of Poimandres & Vike',
},
Expand All @@ -158,7 +145,6 @@ const plainTeamEmeritiMembers: CoreTeam[] = [
avatar: contributorsAvatars.poyoho,
name: 'Yoho Po',
github: 'poyoho',
twitter: '@yoho_po',
title: 'It\'s no problem in my locall',
desc: 'Core team member of Vite & Team member of Vitest',
},
Expand All @@ -168,7 +154,6 @@ const plainTeamEmeritiMembers: CoreTeam[] = [
github: 'zxch3n',
bluesky: 'https://bsky.app/profile/zxch3n.bsky.social',
mastodon: 'https://elk.zone/hachyderm.io/@zx',
twitter: 'zxch3n',
title: 'A fullstack developer',
desc: 'Working on CRDTs & local-first software',
},
Expand Down
1 change: 0 additions & 1 deletion docs/.vitepress/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const contributing = 'https://github.com/vitest-dev/vitest/blob/main/CONT
export const discord = 'https://chat.vitest.dev'
export const bluesky = 'https://bsky.app/profile/vitest.dev'
export const mastodon = 'https://elk.zone/m.webtoo.ls/@vitest'
export const twitter = 'https://twitter.com/vitest_dev'

/* Avatar/Image/Sponsors servers */
export const preconnectLinks = [googleapis, gstatic]
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/comparisons.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: Comparisons with Other Test Runners | Guide

[Jest](https://jestjs.io/) took over the Testing Framework space by providing out-of-the-box support for most JavaScript projects, a comfortable API (`it` and `expect`), and the full pack of testing features that most setups would require (snapshots, mocks, coverage). We are thankful to the Jest team and community for creating a delightful testing API and pushing forward a lot of the testing patterns that are now a standard in the web ecosystem.

It is possible to use Jest in Vite setups. [@sodatea](https://twitter.com/haoqunjiang) built [vite-jest](https://github.com/sodatea/vite-jest#readme), which aims to provide first-class Vite integration for [Jest](https://jestjs.io/). The last [blockers in Jest](https://github.com/sodatea/vite-jest/blob/main/packages/vite-jest/README.md#vite-jest) have been solved, so this is a valid option for your unit tests.
It is possible to use Jest in Vite setups. [@sodatea](https://bsky.app/profile/haoqun.dev) built [vite-jest](https://github.com/sodatea/vite-jest#readme), which aims to provide first-class Vite integration for [Jest](https://jestjs.io/). The last [blockers in Jest](https://github.com/sodatea/vite-jest/blob/main/packages/vite-jest/README.md#vite-jest) have been solved, so this is a valid option for your unit tests.

However, in a world where we have [Vite](https://vitejs.dev) providing support for the most common web tooling (TypeScript, JSX, most popular UI Frameworks), Jest represents a duplication of complexity. If your app is powered by Vite, having two different pipelines to configure and maintain is not justifiable. With Vitest you get to define the configuration for your dev, build and test environments as a single pipeline, sharing the same plugins and the same vite.config.js.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Learn more at [Configuring Vitest](/guide/#configuring-vitest).
$ vitest
```

When you modify your source code or the test files, Vitest smartly searches the module graph and only reruns the related tests, [just like how HMR works in Vite!](https://twitter.com/antfu7/status/1468233216939245579)
When you modify your source code or the test files, Vitest smartly searches the module graph and only reruns the related tests, just like how HMR works in Vite!

`vitest` starts in `watch mode` **by default in development environment** and `run mode` in CI environment (when `process.env.CI` presents) smartly. You can use `vitest watch` or `vitest run` to explicitly specify the desired mode.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/why.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Why Vitest | Guide
# Why Vitest

:::tip NOTE
This guide assumes that you are familiar with Vite. A good way to start learning more is to read the [Why Vite Guide](https://vitejs.dev/guide/why.html), and [Next generation frontend tooling with ViteJS](https://www.youtube.com/watch?v=UJypSr8IhKY), a stream where [Evan You](https://twitter.com/youyuxi) did a demo explaining the main concepts.
This guide assumes that you are familiar with Vite. A good way to start learning more is to read the [Why Vite Guide](https://vitejs.dev/guide/why.html), and [Next generation frontend tooling with ViteJS](https://www.youtube.com/watch?v=UJypSr8IhKY), a stream where [Evan You](https://bsky.app/profile/evanyou.me) did a demo explaining the main concepts.
:::

## The Need for a Vite Native Test Runner
Expand Down
23 changes: 19 additions & 4 deletions packages/browser/src/node/commands/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export const keyboardCleanup: UserEventCommand<(state: KeyboardState) => Promise
}
}

// fallback to insertText for non US key
// https://github.com/microsoft/playwright/blob/50775698ae13642742f2a1e8983d1d686d7f192d/packages/playwright-core/src/server/input.ts#L95
const VALID_KEYS = new Set(['Escape', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'Backquote', '`', '~', 'Digit1', '1', '!', 'Digit2', '2', '@', 'Digit3', '3', '#', 'Digit4', '4', '$', 'Digit5', '5', '%', 'Digit6', '6', '^', 'Digit7', '7', '&', 'Digit8', '8', '*', 'Digit9', '9', '(', 'Digit0', '0', ')', 'Minus', '-', '_', 'Equal', '=', '+', 'Backslash', '\\', '|', 'Backspace', 'Tab', 'KeyQ', 'q', 'Q', 'KeyW', 'w', 'W', 'KeyE', 'e', 'E', 'KeyR', 'r', 'R', 'KeyT', 't', 'T', 'KeyY', 'y', 'Y', 'KeyU', 'u', 'U', 'KeyI', 'i', 'I', 'KeyO', 'o', 'O', 'KeyP', 'p', 'P', 'BracketLeft', '[', '{', 'BracketRight', ']', '}', 'CapsLock', 'KeyA', 'a', 'A', 'KeyS', 's', 'S', 'KeyD', 'd', 'D', 'KeyF', 'f', 'F', 'KeyG', 'g', 'G', 'KeyH', 'h', 'H', 'KeyJ', 'j', 'J', 'KeyK', 'k', 'K', 'KeyL', 'l', 'L', 'Semicolon', ';', ':', 'Quote', '\'', '"', 'Enter', '\n', '\r', 'ShiftLeft', 'Shift', 'KeyZ', 'z', 'Z', 'KeyX', 'x', 'X', 'KeyC', 'c', 'C', 'KeyV', 'v', 'V', 'KeyB', 'b', 'B', 'KeyN', 'n', 'N', 'KeyM', 'm', 'M', 'Comma', ',', '<', 'Period', '.', '>', 'Slash', '/', '?', 'ShiftRight', 'ControlLeft', 'Control', 'MetaLeft', 'Meta', 'AltLeft', 'Alt', 'Space', ' ', 'AltRight', 'AltGraph', 'MetaRight', 'ContextMenu', 'ControlRight', 'PrintScreen', 'ScrollLock', 'Pause', 'PageUp', 'PageDown', 'Insert', 'Delete', 'Home', 'End', 'ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown', 'NumLock', 'NumpadDivide', 'NumpadMultiply', 'NumpadSubtract', 'Numpad7', 'Numpad8', 'Numpad9', 'Numpad4', 'Numpad5', 'Numpad6', 'NumpadAdd', 'Numpad1', 'Numpad2', 'Numpad3', 'Numpad0', 'NumpadDecimal', 'NumpadEnter'])

export async function keyboardImplementation(
pressed: Set<string>,
provider: BrowserProvider,
Expand All @@ -91,7 +95,9 @@ export async function keyboardImplementation(
// together, and call `type` once for all non special keys,
// and then `press` for special keys
if (pressed.has(key)) {
await page.keyboard.up(key)
if (VALID_KEYS.has(key)) {
await page.keyboard.up(key)
}
pressed.delete(key)
}

Expand All @@ -102,11 +108,18 @@ export async function keyboardImplementation(
}

for (let i = 1; i <= repeat; i++) {
await page.keyboard.down(key)
if (VALID_KEYS.has(key)) {
await page.keyboard.down(key)
}
else {
await page.keyboard.insertText(key)
}
}

if (releaseSelf) {
await page.keyboard.up(key)
if (VALID_KEYS.has(key)) {
await page.keyboard.up(key)
}
}
else {
pressed.add(key)
Expand All @@ -116,7 +129,9 @@ export async function keyboardImplementation(

if (!skipRelease && pressed.size) {
for (const key of pressed) {
await page.keyboard.up(key)
if (VALID_KEYS.has(key)) {
await page.keyboard.up(key)
}
}
}
}
Expand Down
Loading

0 comments on commit 00b947d

Please sign in to comment.