-
-
Notifications
You must be signed in to change notification settings - Fork 111
docs(en): merge docs-cn/sync-docs into docs-cn/dev @ b8458066 #987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
docschina-bot
wants to merge
5
commits into
dev
Choose a base branch
from
sync-b8458066-1
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b636e4f
docs: add releases page (#10432)
sheremet-va 6ddec48
feat(browser)!: enable `locators.exact` by default (#10430)
sheremet-va 988854f
fix: forceRerunTriggers uses directory globs against files (fix #1042…
Patrick-Clausen b845806
docs: update vitest-browser-vue/svelte async render (#10441)
hi-ogawa a9a776d
docs(en): merging all conflicts
docschina-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| <script setup lang="ts"> | ||
| import { computed, ref } from 'vue' | ||
|
|
||
| declare const __VITEST_VERSION__: string | ||
|
|
||
| // Constants | ||
| const supportedVersionMessage = { | ||
| color: 'var(--vp-c-brand-1)', | ||
| text: 'supported', | ||
| } | ||
| const notSupportedVersionMessage = { | ||
| color: 'var(--vp-c-danger-1)', | ||
| text: 'not supported', | ||
| } | ||
| const previousMajorLatestMinors: Record<string, string> = { | ||
| 1: '1.6', | ||
| 2: '2.1', | ||
| 3: '3.2', | ||
| 4: '4.1', | ||
| } | ||
|
|
||
| // Current latest Vitest version and support info | ||
| const parsedViteVersion = parseVersion(__VITEST_VERSION__)! | ||
| const supportInfo = computeSupportInfo(parsedViteVersion) | ||
|
|
||
| // Check supported version input | ||
| const checkedVersion = ref(`${Math.max(parsedViteVersion.major - 2, 2)}.0.0`) | ||
| const checkedResult = computed(() => { | ||
| const version = checkedVersion.value | ||
| if (!isValidVitestVersion(version)) { | ||
| return notSupportedVersionMessage | ||
| } | ||
|
|
||
| const parsedVersion = parseVersion(checkedVersion.value) | ||
| if (!parsedVersion) { | ||
| return notSupportedVersionMessage | ||
| } | ||
|
|
||
| const satisfies = (targetVersion: string) => { | ||
| const compared = parseVersion(targetVersion)! | ||
| return ( | ||
| parsedVersion.major === compared.major | ||
| && parsedVersion.minor >= compared.minor | ||
| ) | ||
| } | ||
| const satisfiesOneSupportedVersion | ||
| = parsedVersion.major >= parsedViteVersion.major // Treat future major versions as supported | ||
| || supportInfo.regularPatches.some(satisfies) | ||
| || supportInfo.importantFixes.some(satisfies) | ||
| || supportInfo.securityPatches.some(satisfies) | ||
|
|
||
| return satisfiesOneSupportedVersion | ||
| ? supportedVersionMessage | ||
| : notSupportedVersionMessage | ||
| }) | ||
|
|
||
| function parseVersion(version: string) { | ||
| let [major, minor, patch] = version.split('.').map((v) => { | ||
| const num = /^\d+$/.exec(v)?.[0] | ||
| return num ? Number.parseInt(num) : null | ||
| }) | ||
| if (!major) { | ||
| return null | ||
| } | ||
| minor ??= 0 | ||
| patch ??= 0 | ||
|
|
||
| return { major, minor, patch } | ||
| } | ||
|
|
||
| function computeSupportInfo( | ||
| version: NonNullable<ReturnType<typeof parseVersion>>, | ||
| ) { | ||
| const { major, minor } = version | ||
| const f = (versions: string[]) => { | ||
| return versions | ||
| .map(v => previousMajorLatestMinors[v] ?? v) | ||
| .filter((version) => { | ||
| if (!isValidVitestVersion(version)) { | ||
| return false | ||
| } | ||
| // Negative versions are invalid | ||
| if (/-\d/.test(version)) { | ||
| return false | ||
| } | ||
| return true | ||
| }) | ||
| } | ||
|
|
||
| return { | ||
| regularPatches: f([`${major}.${minor}`]), | ||
| importantFixes: f([`${major - 1}`, `${major}.${minor - 1}`]), | ||
| // unlike vite, we only support the last major version | ||
| securityPatches: f([`${major - 1}`, `${major}.${minor - 1}`]), | ||
| } | ||
| } | ||
|
|
||
| function versionsToText(versions: string[]) { | ||
| versions = versions.map(v => `<code>vitest@${v}</code>`) | ||
| if (versions.length === 0) { | ||
| return '' | ||
| } | ||
| if (versions.length === 1) { | ||
| return versions[0] | ||
| } | ||
| return ( | ||
| `${versions.slice(0, -1).join(', ')} and ${versions[versions.length - 1]}` | ||
| ) | ||
| } | ||
|
|
||
| function isValidVitestVersion(version: string) { | ||
| if (version.length === 1) { | ||
| version += '.' | ||
| } | ||
| // Vitest 0.x shouldn't be mentioned | ||
| if (version.startsWith('0.')) { | ||
| return false | ||
| } | ||
| return true | ||
| } | ||
| </script> | ||
|
|
||
| <template> | ||
| <div> | ||
| <ul> | ||
| <li v-if="supportInfo.regularPatches.length"> | ||
| Regular patches are released for | ||
| <span v-html="versionsToText(supportInfo.regularPatches)" />. | ||
| </li> | ||
| <li v-if="supportInfo.importantFixes.length"> | ||
| Important fixes and security patches are backported to | ||
| <span v-html="versionsToText(supportInfo.importantFixes)" />. | ||
| </li> | ||
| <li> | ||
| All versions before these are no longer supported. Users should upgrade | ||
| to receive updates. | ||
| </li> | ||
| </ul> | ||
| <p> | ||
| If you're using Vitest | ||
| <input | ||
| v-model="checkedVersion" | ||
| class="checked-input" | ||
| type="text" | ||
| placeholder="0.0.0" | ||
| >, it is | ||
| <strong :style="{ color: checkedResult.color }">{{ | ||
| checkedResult.text | ||
| }}</strong>. | ||
| </p> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style scoped> | ||
| .checked-input { | ||
| display: inline-block; | ||
| padding: 0px 5px; | ||
| width: 100px; | ||
| color: var(--vp-c-text-1); | ||
| background: var(--vp-c-bg-soft); | ||
| font-size: var(--vp-code-font-size); | ||
| font-family: var(--vp-font-family-mono); | ||
| border: 1px solid var(--vp-c-divider); | ||
| border-radius: 5px; | ||
| transition: border-color 0.1s; | ||
| } | ||
|
|
||
| .checked-input:focus, | ||
| .checked-input:hover { | ||
| border-color: var(--vp-c-brand); | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit leaves raw merge-conflict markers (e.g.
<<<<<<< HEAD/=======/>>>>>>>) in multiple published docs pages, which causes users to see conflict noise and contradictory guidance (for example, competing defaults and duplicated headings) instead of a single canonical instruction set. Please resolve the conflicts and keep only one final version of each affected section before merging.Useful? React with 👍 / 👎.