From ae3ba243b1eb835c4571889ce1d15aeaacdc52a5 Mon Sep 17 00:00:00 2001
From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
Date: Tue, 8 Nov 2022 16:05:51 +0530
Subject: [PATCH] tests: refactor (#1587)
---
.github/workflows/test.yml | 51 +---
.../theme-default/support/utils.spec.ts | 13 -
__tests__/e2e/.vitepress/config.ts | 66 +++++
.../e2e/__snapshots__/index.test.ts.snap | 3 +-
.../frontmatter/multiple-levels-outline.md | 41 +++
.../multiple-levels-outline.test.ts | 12 +-
{examples/minimal => __tests__/e2e}/index.md | 0
.../e2e/index.test.ts | 17 +-
__tests__/e2e/multi-sidebar/index.md | 1 +
__tests__/e2e/multi-sidebar/index.test.ts | 30 ++
{examples => __tests__/e2e}/package.json | 1 -
__tests__/e2e/shims.ts | 6 +
.../__snapshots__/data.test.ts.snap | 14 +
.../e2e}/static-data/data.md | 4 +-
__tests__/e2e/static-data/data.test.ts | 12 +
.../e2e}/static-data/data/bar.json | 0
.../e2e}/static-data/data/foo.json | 0
.../e2e/static-data/static.data.ts | 5 +-
__tests__/e2e/text-literals/index.md | 1 +
__tests__/e2e/vitest.config.ts | 14 +
__tests__/e2e/vitestGlobalSetup.ts | 41 +++
__tests__/e2e/vitestSetup.ts | 21 ++
__tests__/shims.ts | 1 -
__tests__/tsconfig.json | 3 +-
.../composables/outline.test.ts} | 9 +-
.../theme-default/support/sidebar.test.ts} | 1 -
.../theme-default/support/utils.test.ts | 12 +
__tests__/unit/shims.ts | 1 +
__tests__/{ => unit}/vitest.config.ts | 8 +-
examples/configured/.vitepress/config.js | 64 -----
.../configured/__test__/multisidebar.spec.ts | 41 ---
.../frontmatter/multiple-levels-outline.md | 41 ---
examples/configured/index.md | 3 -
examples/configured/multi-sidebar/index.md | 5 -
examples/configured/package.json | 13 -
examples/configured/text-literals/index.md | 5 -
examples/minimal/package.json | 12 -
examples/test-utils.ts | 7 -
examples/tsconfig.json | 21 --
examples/vitestGlobalSetup.ts | 49 ----
examples/vitestSetup.ts | 233 ----------------
netlify.toml | 2 +-
package.json | 38 ++-
pnpm-lock.yaml | 259 +++++++++---------
pnpm-workspace.yaml | 3 +-
src/node/serve/serve.ts | 4 +-
vitest.config.e2e.ts | 28 --
47 files changed, 446 insertions(+), 770 deletions(-)
delete mode 100644 __tests__/client/theme-default/support/utils.spec.ts
create mode 100644 __tests__/e2e/.vitepress/config.ts
rename examples/minimal/__test__/__snapshots__/content.spec.ts.snap => __tests__/e2e/__snapshots__/index.test.ts.snap (97%)
create mode 100644 __tests__/e2e/frontmatter/multiple-levels-outline.md
rename examples/configured/__test__/outline.spec.ts => __tests__/e2e/frontmatter/multiple-levels-outline.test.ts (66%)
rename {examples/minimal => __tests__/e2e}/index.md (100%)
rename examples/minimal/__test__/content.spec.ts => __tests__/e2e/index.test.ts (62%)
create mode 100644 __tests__/e2e/multi-sidebar/index.md
create mode 100644 __tests__/e2e/multi-sidebar/index.test.ts
rename {examples => __tests__/e2e}/package.json (71%)
create mode 100644 __tests__/e2e/shims.ts
create mode 100644 __tests__/e2e/static-data/__snapshots__/data.test.ts.snap
rename {examples/configured => __tests__/e2e}/static-data/data.md (60%)
create mode 100644 __tests__/e2e/static-data/data.test.ts
rename {examples/configured => __tests__/e2e}/static-data/data/bar.json (100%)
rename {examples/configured => __tests__/e2e}/static-data/data/foo.json (100%)
rename examples/configured/static-data/static.data.js => __tests__/e2e/static-data/static.data.ts (80%)
create mode 100644 __tests__/e2e/text-literals/index.md
create mode 100644 __tests__/e2e/vitest.config.ts
create mode 100644 __tests__/e2e/vitestGlobalSetup.ts
create mode 100644 __tests__/e2e/vitestSetup.ts
delete mode 100644 __tests__/shims.ts
rename __tests__/{client/theme-default/composables/outline.spec.ts => unit/client/theme-default/composables/outline.test.ts} (93%)
rename __tests__/{client/theme-default/support/sidebar.spec.ts => unit/client/theme-default/support/sidebar.test.ts} (97%)
create mode 100644 __tests__/unit/client/theme-default/support/utils.test.ts
create mode 100644 __tests__/unit/shims.ts
rename __tests__/{ => unit}/vitest.config.ts (59%)
delete mode 100644 examples/configured/.vitepress/config.js
delete mode 100644 examples/configured/__test__/multisidebar.spec.ts
delete mode 100644 examples/configured/frontmatter/multiple-levels-outline.md
delete mode 100644 examples/configured/index.md
delete mode 100644 examples/configured/multi-sidebar/index.md
delete mode 100644 examples/configured/package.json
delete mode 100644 examples/configured/text-literals/index.md
delete mode 100644 examples/minimal/package.json
delete mode 100644 examples/test-utils.ts
delete mode 100644 examples/tsconfig.json
delete mode 100644 examples/vitestGlobalSetup.ts
delete mode 100644 examples/vitestSetup.ts
delete mode 100644 vitest.config.e2e.ts
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9898a3c5..42c4d145 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,17 +1,21 @@
name: Test
env:
- # 7 GiB by default on GitHub, setting to 6 GiB
- # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
NODE_OPTIONS: --max-old-space-size=6144
- # install playwright binary manually (because pnpm only runs install script once)
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
+ VITEST_SEGFAULT_RETRY: 3
on:
push:
- branches:
- - main
+ branches: [main]
pull_request:
+ branches: [main]
+ types: [opened, synchronize, reopened]
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
+ cancel-in-progress: true
jobs:
test:
@@ -19,7 +23,7 @@ jobs:
strategy:
matrix:
- node-version: [14, 16, 18]
+ node_version: [14, 16, 18]
steps:
- name: Checkout
@@ -32,42 +36,13 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
- cache: 'pnpm'
+ cache: pnpm
- name: Install deps
run: pnpm install
- # Install playwright's binary under custom directory to cache
- - name: Set Playwright path (non-windows)
- if: runner.os != 'Windows'
- run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
- - name: Set Playwright path (windows)
- if: runner.os == 'Windows'
- run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
-
- - name: Cache Playwright's binary
- uses: actions/cache@v3
- with:
- # Playwright removes unused browsers automatically
- # So does not need to add playwright version to key
- key: ${{ runner.os }}-playwright-bin-v1
- path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
-
- name: Install Playwright
- # does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
run: pnpm playwright install chromium
- - name: Build
- run: pnpm run build
-
- - name: Lint
- run: pnpm run lint-fail
-
- - name: Test unit
- run: pnpm run test-unit
-
- - name: Test serve
- run: pnpm run test-serve
-
- - name: Test build
- run: pnpm run test-build
+ - name: Check
+ run: pnpm check
diff --git a/__tests__/client/theme-default/support/utils.spec.ts b/__tests__/client/theme-default/support/utils.spec.ts
deleted file mode 100644
index ac6a668d..00000000
--- a/__tests__/client/theme-default/support/utils.spec.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { describe, test, expect } from 'vitest'
-import * as Utils from 'client/theme-default/support/utils'
-
-describe('client/theme-default/utils', () => {
- describe('ensureStartingSlash', () => {
- test('it adds slash to the beginning of the given path', () => {
- expect(Utils.ensureStartingSlash('path')).toBe('/path')
- expect(Utils.ensureStartingSlash('path/nested')).toBe('/path/nested')
- expect(Utils.ensureStartingSlash('/path')).toBe('/path')
- expect(Utils.ensureStartingSlash('/path/nested')).toBe('/path/nested')
- })
- })
-})
diff --git a/__tests__/e2e/.vitepress/config.ts b/__tests__/e2e/.vitepress/config.ts
new file mode 100644
index 00000000..d115ca6e
--- /dev/null
+++ b/__tests__/e2e/.vitepress/config.ts
@@ -0,0 +1,66 @@
+import { defineConfig, type DefaultTheme } from 'vitepress'
+
+const sidebar: DefaultTheme.Config['sidebar'] = {
+ '/': [
+ {
+ text: 'Frontmatter',
+ collapsible: true,
+ items: [
+ {
+ text: 'Multiple Levels Outline',
+ link: '/frontmatter/multiple-levels-outline'
+ }
+ ]
+ },
+ {
+ text: '& <Text Literals &> code
',
+ items: [
+ {
+ text: '& <Test Page &> code
',
+ link: '/text-literals/'
+ }
+ ]
+ },
+ {
+ text: 'Static Data',
+ items: [
+ {
+ text: 'Test Page',
+ link: '/static-data/data'
+ }
+ ]
+ },
+ {
+ text: 'Multi Sidebar Test',
+ items: [
+ {
+ text: 'Test Page',
+ link: '/multi-sidebar/'
+ }
+ ]
+ }
+ ],
+ '/multi-sidebar/': [
+ {
+ text: 'Multi Sidebar',
+ items: [
+ {
+ text: 'Test Page',
+ link: '/multi-sidebar/'
+ },
+ {
+ text: 'Back',
+ link: '/'
+ }
+ ]
+ }
+ ]
+}
+
+export default defineConfig({
+ title: 'Example',
+ description: 'An example app using VitePress.',
+ themeConfig: {
+ sidebar
+ }
+})
diff --git a/examples/minimal/__test__/__snapshots__/content.spec.ts.snap b/__tests__/e2e/__snapshots__/index.test.ts.snap
similarity index 97%
rename from examples/minimal/__test__/__snapshots__/content.spec.ts.snap
rename to __tests__/e2e/__snapshots__/index.test.ts.snap
index 2732e781..ab5ce9c2 100644
--- a/examples/minimal/__test__/__snapshots__/content.spec.ts.snap
+++ b/__tests__/e2e/__snapshots__/index.test.ts.snap
@@ -1,8 +1,7 @@
// Vitest Snapshot v1
-exports[`render corrent content > main content 1`] = `
+exports[`render correct content > main content 1`] = `
[
- "Appearance",
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of \\"de Finibus Bonorum et Malorum\\" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, \\"Lorem ipsum dolor sit amet..\\", comes from a line in section 1.10.32.",
diff --git a/__tests__/e2e/frontmatter/multiple-levels-outline.md b/__tests__/e2e/frontmatter/multiple-levels-outline.md
new file mode 100644
index 00000000..332a7cda
--- /dev/null
+++ b/__tests__/e2e/frontmatter/multiple-levels-outline.md
@@ -0,0 +1,41 @@
+---
+title: Multiple Levels Outline
+editLink: true
+outline: 'deep'
+---
+
+# h1 - 1
+
+Lorem ipsum
+
+## h2 - 1
+
+Lorem ipsum
+
+### h3 - 1
+
+Lorem ipsum
+
+#### h4 - 1
+
+Lorem ipsum
+
+### h3 - 2
+
+Lorem ipsum
+
+#### h4 - 2
+
+Lorem ipsum
+
+## h2 - 2
+
+Lorem ipsum
+
+### h3 - 3
+
+Lorem ipsum
+
+#### h4 - 3
+
+Lorem ipsum
diff --git a/examples/configured/__test__/outline.spec.ts b/__tests__/e2e/frontmatter/multiple-levels-outline.test.ts
similarity index 66%
rename from examples/configured/__test__/outline.spec.ts
rename to __tests__/e2e/frontmatter/multiple-levels-outline.test.ts
index 542e8ae4..7073db20 100644
--- a/examples/configured/__test__/outline.spec.ts
+++ b/__tests__/e2e/frontmatter/multiple-levels-outline.test.ts
@@ -1,18 +1,10 @@
-import { expect, test } from 'vitest'
-import { page, vitePressTestUrl, waitForLayout } from '~utils'
-
describe('outline', () => {
beforeAll(async () => {
- await page.goto(
- vitePressTestUrl + '/frontmatter/multiple-levels-outline.html'
- )
- await waitForLayout()
+ await goto('/frontmatter/multiple-levels-outline')
})
test('set outline to deep', async () => {
- const outlineLinksLocator = await page.locator(
- '.VPDocAsideOutline .root .outline-link'
- )
+ const outlineLinksLocator = page.locator('.VPDocAsideOutline .outline-link')
const outlineLinksContent = await outlineLinksLocator.allTextContents()
expect(outlineLinksContent).toEqual([
diff --git a/examples/minimal/index.md b/__tests__/e2e/index.md
similarity index 100%
rename from examples/minimal/index.md
rename to __tests__/e2e/index.md
diff --git a/examples/minimal/__test__/content.spec.ts b/__tests__/e2e/index.test.ts
similarity index 62%
rename from examples/minimal/__test__/content.spec.ts
rename to __tests__/e2e/index.test.ts
index f0bb4fc1..76279036 100644
--- a/examples/minimal/__test__/content.spec.ts
+++ b/__tests__/e2e/index.test.ts
@@ -1,24 +1,21 @@
-import { beforeAll, expect, test } from 'vitest'
-import { page, waitForLayout } from '~utils'
-
-describe('render corrent content', () => {
+describe('render correct content', async () => {
beforeAll(async () => {
- await waitForLayout()
+ await goto('/')
})
test('main content', async () => {
- const h1Locator = page.locator('h1')
- const h2Locator = page.locator('h2')
- const pLocator = page.locator('.Layout p')
+ const h1Locator = page.locator('.VPContent h1')
+ const h2Locator = page.locator('.VPContent h2')
+ const pLocator = page.locator('.VPContent p')
- const [h1Contents, h2Conetents, pContents] = await Promise.all([
+ const [h1Contents, h2Contents, pContents] = await Promise.all([
h1Locator.allTextContents(),
h2Locator.allTextContents(),
pLocator.allTextContents()
])
expect(h1Contents).toEqual(['Lorem Ipsum #'])
- expect(h2Conetents).toEqual([
+ expect(h2Contents).toEqual([
'What is Lorem Ipsum? #',
'Where does it come from? #',
'Why do we use it? #',
diff --git a/__tests__/e2e/multi-sidebar/index.md b/__tests__/e2e/multi-sidebar/index.md
new file mode 100644
index 00000000..518b072b
--- /dev/null
+++ b/__tests__/e2e/multi-sidebar/index.md
@@ -0,0 +1 @@
+# Multi Sidebar
diff --git a/__tests__/e2e/multi-sidebar/index.test.ts b/__tests__/e2e/multi-sidebar/index.test.ts
new file mode 100644
index 00000000..a8576993
--- /dev/null
+++ b/__tests__/e2e/multi-sidebar/index.test.ts
@@ -0,0 +1,30 @@
+describe('test multi sidebar sort root', () => {
+ beforeAll(async () => {
+ await goto('/frontmatter/multiple-levels-outline')
+ })
+
+ test('using / sidebar', async () => {
+ const sidebarLocator = page.locator('.VPSidebarGroup .title-text')
+
+ const sidebarContent = await sidebarLocator.allTextContents()
+ expect(sidebarContent).toEqual([
+ 'Frontmatter',
+ '& code',
+ 'Static Data',
+ 'Multi Sidebar Test'
+ ])
+ })
+})
+
+describe('test multi sidebar sort order', () => {
+ beforeAll(async () => {
+ await goto('/multi-sidebar/')
+ })
+
+ test('using /multi-sidebar/ sidebar', async () => {
+ const sidebarLocator = page.locator('.VPSidebarGroup .title-text')
+
+ const sidebarContent = await sidebarLocator.allTextContents()
+ expect(sidebarContent).toEqual(['Multi Sidebar'])
+ })
+})
diff --git a/examples/package.json b/__tests__/e2e/package.json
similarity index 71%
rename from examples/package.json
rename to __tests__/e2e/package.json
index 91223d00..25ac3538 100644
--- a/examples/package.json
+++ b/__tests__/e2e/package.json
@@ -1,5 +1,4 @@
{
- "name": "vitepress-examples",
"private": true,
"devDependencies": {
"vitepress": "workspace:*"
diff --git a/__tests__/e2e/shims.ts b/__tests__/e2e/shims.ts
new file mode 100644
index 00000000..744b352f
--- /dev/null
+++ b/__tests__/e2e/shims.ts
@@ -0,0 +1,6 @@
+import { type Page } from 'playwright-chromium'
+
+declare global {
+ var page: Page
+ var goto: (path: string) => Promise
+}
diff --git a/__tests__/e2e/static-data/__snapshots__/data.test.ts.snap b/__tests__/e2e/static-data/__snapshots__/data.test.ts.snap
new file mode 100644
index 00000000..0e000a37
--- /dev/null
+++ b/__tests__/e2e/static-data/__snapshots__/data.test.ts.snap
@@ -0,0 +1,14 @@
+// Vitest Snapshot v1
+
+exports[`static data file support in vite 3 > render correct content 1`] = `
+[
+ "[
+ {
+ \\"foo\\": true
+ },
+ {
+ \\"bar\\": true
+ }
+]",
+]
+`;
diff --git a/examples/configured/static-data/data.md b/__tests__/e2e/static-data/data.md
similarity index 60%
rename from examples/configured/static-data/data.md
rename to __tests__/e2e/static-data/data.md
index d92433ee..9e2348eb 100644
--- a/examples/configured/static-data/data.md
+++ b/__tests__/e2e/static-data/data.md
@@ -1,4 +1,6 @@
-
diff --git a/__tests__/e2e/static-data/data.test.ts b/__tests__/e2e/static-data/data.test.ts
new file mode 100644
index 00000000..48248206
--- /dev/null
+++ b/__tests__/e2e/static-data/data.test.ts
@@ -0,0 +1,12 @@
+describe('static data file support in vite 3', () => {
+ beforeAll(async () => {
+ await goto('/static-data/data')
+ })
+
+ test('render correct content', async () => {
+ const pLocator = page.locator('.VPContent p')
+
+ const pContents = await pLocator.allTextContents()
+ expect(pContents).toMatchSnapshot()
+ })
+})
diff --git a/examples/configured/static-data/data/bar.json b/__tests__/e2e/static-data/data/bar.json
similarity index 100%
rename from examples/configured/static-data/data/bar.json
rename to __tests__/e2e/static-data/data/bar.json
diff --git a/examples/configured/static-data/data/foo.json b/__tests__/e2e/static-data/data/foo.json
similarity index 100%
rename from examples/configured/static-data/data/foo.json
rename to __tests__/e2e/static-data/data/foo.json
diff --git a/examples/configured/static-data/static.data.js b/__tests__/e2e/static-data/static.data.ts
similarity index 80%
rename from examples/configured/static-data/static.data.js
rename to __tests__/e2e/static-data/static.data.ts
index 9c66771b..a9ae896b 100644
--- a/examples/configured/static-data/static.data.js
+++ b/__tests__/e2e/static-data/static.data.ts
@@ -4,9 +4,12 @@ import { fileURLToPath } from 'url'
const dirname = path.dirname(fileURLToPath(import.meta.url))
+type Data = Record[]
+export declare const data: Data
+
export default {
watch: ['./data/*'],
- async load() {
+ async load(): Promise {
const foo = fs.readFileSync(
path.resolve(dirname, './data/foo.json'),
'utf-8'
diff --git a/__tests__/e2e/text-literals/index.md b/__tests__/e2e/text-literals/index.md
new file mode 100644
index 00000000..a4d150b8
--- /dev/null
+++ b/__tests__/e2e/text-literals/index.md
@@ -0,0 +1 @@
+# Text Literals
diff --git a/__tests__/e2e/vitest.config.ts b/__tests__/e2e/vitest.config.ts
new file mode 100644
index 00000000..d94a39b9
--- /dev/null
+++ b/__tests__/e2e/vitest.config.ts
@@ -0,0 +1,14 @@
+import { defineConfig } from 'vitest/config'
+
+const timeout = 60_000
+
+export default defineConfig({
+ test: {
+ setupFiles: ['vitestSetup.ts'],
+ globalSetup: ['__tests__/e2e/vitestGlobalSetup.ts'],
+ testTimeout: timeout,
+ hookTimeout: timeout,
+ teardownTimeout: timeout,
+ globals: true
+ }
+})
diff --git a/__tests__/e2e/vitestGlobalSetup.ts b/__tests__/e2e/vitestGlobalSetup.ts
new file mode 100644
index 00000000..5cca4bc6
--- /dev/null
+++ b/__tests__/e2e/vitestGlobalSetup.ts
@@ -0,0 +1,41 @@
+import getPort from 'get-port'
+import { Server } from 'net'
+import { chromium, type BrowserServer } from 'playwright-chromium'
+import { type ViteDevServer } from 'vite'
+import { build, createServer, serve } from 'vitepress'
+
+let browserServer: BrowserServer
+let server: ViteDevServer | Server
+
+const root = '__tests__/e2e'
+
+export async function setup() {
+ browserServer = await chromium.launchServer({
+ headless: !process.env.DEBUG,
+ args: process.env.CI
+ ? ['--no-sandbox', '--disable-setuid-sandbox']
+ : undefined
+ })
+ process.env['WS_ENDPOINT'] = browserServer.wsEndpoint()
+ const port = await getPort()
+ process.env['PORT'] = port.toString()
+
+ if (process.env['VITE_TEST_BUILD']) {
+ await build(root)
+ server = (await serve({ root, port })).server
+ } else {
+ server = await createServer(root, { port })
+ await server!.listen()
+ }
+}
+
+export async function teardown() {
+ await browserServer.close()
+ if ('ws' in server) {
+ await server.close()
+ } else {
+ await new Promise((resolve, reject) => {
+ server.close((error) => (error ? reject(error) : resolve()))
+ })
+ }
+}
diff --git a/__tests__/e2e/vitestSetup.ts b/__tests__/e2e/vitestSetup.ts
new file mode 100644
index 00000000..63b7adc4
--- /dev/null
+++ b/__tests__/e2e/vitestSetup.ts
@@ -0,0 +1,21 @@
+import { chromium, type Browser } from 'playwright-chromium'
+
+let browser: Browser
+
+beforeAll(async () => {
+ browser = await chromium.connect(process.env['WS_ENDPOINT']!)
+ globalThis.page = await browser.newPage()
+ globalThis.goto = async (path: string) => {
+ await page.goto(`http://localhost:${process.env['PORT']}${path}`)
+ await page.waitForSelector('#app .Layout')
+ }
+})
+
+afterAll(async () => {
+ await page.close()
+ await browser.close()
+ // @ts-ignore
+ delete globalThis.page
+ // @ts-ignore
+ delete globalThis.goto
+})
diff --git a/__tests__/shims.ts b/__tests__/shims.ts
deleted file mode 100644
index 64aacc6f..00000000
--- a/__tests__/shims.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default '{}'
diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json
index 49605e11..ce496b85 100644
--- a/__tests__/tsconfig.json
+++ b/__tests__/tsconfig.json
@@ -7,6 +7,5 @@
"node/*": ["../src/node/*"],
"client/*": ["../src/client/*"]
}
- },
- "include": ["../src", "."]
+ }
}
diff --git a/__tests__/client/theme-default/composables/outline.spec.ts b/__tests__/unit/client/theme-default/composables/outline.test.ts
similarity index 93%
rename from __tests__/client/theme-default/composables/outline.spec.ts
rename to __tests__/unit/client/theme-default/composables/outline.test.ts
index 93568926..06180f1a 100644
--- a/__tests__/client/theme-default/composables/outline.spec.ts
+++ b/__tests__/unit/client/theme-default/composables/outline.test.ts
@@ -1,11 +1,10 @@
-import { describe, test, expect } from 'vitest'
-import * as outline from 'client/theme-default/composables/outline'
+import { resolveHeaders } from 'client/theme-default/composables/outline'
describe('client/theme-default/composables/outline', () => {
describe('resolveHeader', () => {
test('levels range', () => {
expect(
- outline.resolveHeaders(
+ resolveHeaders(
[
{
level: 2,
@@ -38,7 +37,7 @@ describe('client/theme-default/composables/outline', () => {
test('specific level', () => {
expect(
- outline.resolveHeaders(
+ resolveHeaders(
[
{
level: 2,
@@ -64,7 +63,7 @@ describe('client/theme-default/composables/outline', () => {
test('complex deep', () => {
expect(
- outline.resolveHeaders(
+ resolveHeaders(
[
{
level: 2,
diff --git a/__tests__/client/theme-default/support/sidebar.spec.ts b/__tests__/unit/client/theme-default/support/sidebar.test.ts
similarity index 97%
rename from __tests__/client/theme-default/support/sidebar.spec.ts
rename to __tests__/unit/client/theme-default/support/sidebar.test.ts
index 9f41d417..4b451c7b 100644
--- a/__tests__/client/theme-default/support/sidebar.spec.ts
+++ b/__tests__/unit/client/theme-default/support/sidebar.test.ts
@@ -1,4 +1,3 @@
-import { describe, test, expect } from 'vitest'
import { getSidebar } from 'client/theme-default/support/sidebar'
describe('client/theme-default/support/sidebar', () => {
diff --git a/__tests__/unit/client/theme-default/support/utils.test.ts b/__tests__/unit/client/theme-default/support/utils.test.ts
new file mode 100644
index 00000000..880d4232
--- /dev/null
+++ b/__tests__/unit/client/theme-default/support/utils.test.ts
@@ -0,0 +1,12 @@
+import { ensureStartingSlash } from 'client/theme-default/support/utils'
+
+describe('client/theme-default/utils', () => {
+ describe('ensureStartingSlash', () => {
+ test('it adds slash to the beginning of the given path', () => {
+ expect(ensureStartingSlash('path')).toBe('/path')
+ expect(ensureStartingSlash('path/nested')).toBe('/path/nested')
+ expect(ensureStartingSlash('/path')).toBe('/path')
+ expect(ensureStartingSlash('/path/nested')).toBe('/path/nested')
+ })
+ })
+})
diff --git a/__tests__/unit/shims.ts b/__tests__/unit/shims.ts
new file mode 100644
index 00000000..b1c6ea43
--- /dev/null
+++ b/__tests__/unit/shims.ts
@@ -0,0 +1 @@
+export default {}
diff --git a/__tests__/vitest.config.ts b/__tests__/unit/vitest.config.ts
similarity index 59%
rename from __tests__/vitest.config.ts
rename to __tests__/unit/vitest.config.ts
index 8dc0fade..88d82e51 100644
--- a/__tests__/vitest.config.ts
+++ b/__tests__/unit/vitest.config.ts
@@ -1,6 +1,6 @@
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'
-import { defineConfig } from 'vite'
+import { defineConfig } from 'vitest/config'
const dir = dirname(fileURLToPath(import.meta.url))
@@ -8,9 +8,9 @@ export default defineConfig({
resolve: {
alias: {
'@siteData': resolve(dir, './shims.ts'),
- client: resolve(dir, '../src/client'),
- node: resolve(dir, '../src/node'),
- vitepress: resolve(dir, '../src/client')
+ client: resolve(dir, '../../src/client'),
+ node: resolve(dir, '../../src/node'),
+ vitepress: resolve(dir, '../../src/client')
}
},
test: {
diff --git a/examples/configured/.vitepress/config.js b/examples/configured/.vitepress/config.js
deleted file mode 100644
index 75ece0e4..00000000
--- a/examples/configured/.vitepress/config.js
+++ /dev/null
@@ -1,64 +0,0 @@
-import { defineConfig } from 'vitepress'
-
-export default defineConfig({
- title: 'Configured Example',
- description: 'Example of configured options of VitePress',
- themeConfig: {
- sidebar: {
- '/': [
- {
- text: 'Frontmatter',
- collapsible: true,
- items: [
- {
- text: 'Multiple levels outline',
- link: '/frontmatter/multiple-levels-outline'
- }
- ]
- },
- {
- text: '& <Text Literals &> code
',
- items: [
- {
- text: '& <Test Page &> code
',
- link: '/text-literals/'
- }
- ]
- },
- {
- text: 'Static Data',
- items: [
- {
- text: 'Test Page',
- link: '/static-data/data'
- }
- ]
- },
- {
- text: 'Multi Sidebar Test',
- items: [
- {
- text: 'Test Page',
- link: '/multi-sidebar/'
- }
- ]
- }
- ],
- '/multi-sidebar/': [
- {
- text: 'Multi Sidebar',
- items: [
- {
- text: 'Test Page',
- link: '/multi-sidebar/'
- },
- {
- text: 'Back',
- link: '/'
- }
- ]
- }
- ]
- }
- }
-})
diff --git a/examples/configured/__test__/multisidebar.spec.ts b/examples/configured/__test__/multisidebar.spec.ts
deleted file mode 100644
index e6a19e2b..00000000
--- a/examples/configured/__test__/multisidebar.spec.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { expect, test } from 'vitest'
-import { page, vitePressTestUrl, waitForLayout } from '~utils'
-
-describe('test multi sidebar sort root', () => {
- beforeAll(async () => {
- await page.goto(
- vitePressTestUrl + '/frontmatter/multiple-levels-outline.html'
- )
- await waitForLayout()
- })
-
- test('using / sidebar', async () => {
- const sidebarLocator = await page.locator(
- '.VPSidebarGroup .title .title-text'
- )
-
- const sidebarContent = await sidebarLocator.allTextContents()
- expect(sidebarContent).toEqual([
- 'Frontmatter',
- '& code',
- 'Static Data',
- 'Multi Sidebar Test'
- ])
- })
-})
-
-describe('test multi sidebar sort other', () => {
- beforeAll(async () => {
- await page.goto(vitePressTestUrl + '/multi-sidebar/index.html')
- await waitForLayout()
- })
-
- test('using /multi-sidebar/ sidebar', async () => {
- const sidebarLocator = await page.locator(
- '.VPSidebarGroup .title .title-text'
- )
-
- const sidebarContent = await sidebarLocator.allTextContents()
- expect(sidebarContent).toEqual(['Multi Sidebar'])
- })
-})
diff --git a/examples/configured/frontmatter/multiple-levels-outline.md b/examples/configured/frontmatter/multiple-levels-outline.md
deleted file mode 100644
index 51dd54d5..00000000
--- a/examples/configured/frontmatter/multiple-levels-outline.md
+++ /dev/null
@@ -1,41 +0,0 @@
----
-title: Multiple levels outline
-editLink: true
-outline: 'deep'
----
-
-# h1 - 1
-
-Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
-
-## h2 - 1
-
-Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
-
-### h3 - 1
-
-Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
-
-#### h4 - 1
-
-Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
-
-### h3 - 2
-
-Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
-
-#### h4 - 2
-
-Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
-
-## h2 - 2
-
-Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
-
-### h3 - 3
-
-Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
-
-#### h4 - 3
-
-Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
diff --git a/examples/configured/index.md b/examples/configured/index.md
deleted file mode 100644
index 5319d12d..00000000
--- a/examples/configured/index.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Full Configured VitePress Example
-
-WIP
diff --git a/examples/configured/multi-sidebar/index.md b/examples/configured/multi-sidebar/index.md
deleted file mode 100644
index c5d8b949..00000000
--- a/examples/configured/multi-sidebar/index.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Multi Sidebar Test
----
-
-# Multi Sidebar Test
diff --git a/examples/configured/package.json b/examples/configured/package.json
deleted file mode 100644
index 5f59c830..00000000
--- a/examples/configured/package.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "private": true,
- "type": "module",
- "name": "vitepress-example-configured",
- "scripts": {
- "dev": "vitepress dev",
- "build": "vitepress build",
- "serve": "vitepress serve"
- },
- "devDependencies": {
- "vitepress": "workspace:*"
- }
-}
diff --git a/examples/configured/text-literals/index.md b/examples/configured/text-literals/index.md
deleted file mode 100644
index 14b5f619..00000000
--- a/examples/configured/text-literals/index.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Text Literals
----
-
-# Text Literals Test
diff --git a/examples/minimal/package.json b/examples/minimal/package.json
deleted file mode 100644
index ff3290eb..00000000
--- a/examples/minimal/package.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "private": true,
- "name": "vitepress-example-minimal",
- "scripts": {
- "dev": "vitepress dev",
- "build": "vitepress build",
- "serve": "vitepress serve"
- },
- "devDependencies": {
- "vitepress": "workspace:*"
- }
-}
diff --git a/examples/test-utils.ts b/examples/test-utils.ts
deleted file mode 100644
index b1cb7163..00000000
--- a/examples/test-utils.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { page } from './vitestSetup'
-
-export * from './vitestSetup'
-
-export async function waitForLayout() {
- await page.waitForSelector('#app .Layout')
-}
diff --git a/examples/tsconfig.json b/examples/tsconfig.json
deleted file mode 100644
index 4fab4199..00000000
--- a/examples/tsconfig.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "include": ["."],
- "exclude": ["**/dist/**"],
- "compilerOptions": {
- "target": "ES2020",
- "module": "ESNext",
- "outDir": "dist",
- "baseUrl": ".",
- "allowJs": true,
- "esModuleInterop": true,
- "resolveJsonModule": true,
- "moduleResolution": "Node",
- "skipLibCheck": true,
- "noUnusedLocals": true,
- "jsx": "preserve",
- "types": ["vitepress/client", "vitest/globals", "node"],
- "paths": {
- "~utils": ["./test-utils.ts"]
- }
- }
-}
diff --git a/examples/vitestGlobalSetup.ts b/examples/vitestGlobalSetup.ts
deleted file mode 100644
index c354aa13..00000000
--- a/examples/vitestGlobalSetup.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import os from 'os'
-import path from 'path'
-import fs from 'fs-extra'
-import type { BrowserServer } from 'playwright-chromium'
-import { chromium } from 'playwright-chromium'
-
-const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup')
-
-let browserServer: BrowserServer | undefined
-
-export async function setup(): Promise {
- browserServer = await chromium.launchServer({
- headless: !process.env.VITE_DEBUG_SERVE,
- args: process.env.CI
- ? ['--no-sandbox', '--disable-setuid-sandbox']
- : undefined
- })
-
- await fs.mkdirp(DIR)
- await fs.writeFile(path.join(DIR, 'wsEndpoint'), browserServer.wsEndpoint())
-
- const tempDir = path.resolve(__dirname, '../examples-temp')
- await fs.ensureDir(tempDir)
- await fs.emptyDir(tempDir)
- await fs
- .copy(path.resolve(__dirname, '../examples'), tempDir, {
- dereference: false,
- filter(file) {
- file = file.replace(/\\/g, '/')
- return !file.includes('__tests__') && !file.match(/dist(\/|$)/)
- }
- })
- .catch(async (error) => {
- if (error.code === 'EPERM' && error.syscall === 'symlink') {
- throw new Error(
- 'Could not create symlinks. On Windows, consider activating Developer Mode to allow non-admin users to create symlinks by following the instructions at https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development.'
- )
- } else {
- throw error
- }
- })
-}
-
-export async function teardown(): Promise {
- browserServer?.close()
- if (!process.env.VITE_PRESERVE_BUILD_ARTIFACTS) {
- fs.removeSync(path.resolve(__dirname, '../examples-temp'))
- }
-}
diff --git a/examples/vitestSetup.ts b/examples/vitestSetup.ts
deleted file mode 100644
index cc6f1464..00000000
--- a/examples/vitestSetup.ts
+++ /dev/null
@@ -1,233 +0,0 @@
-import fs from 'fs-extra'
-import * as http from 'http'
-import os from 'os'
-import path, { dirname, join, resolve } from 'path'
-import type { Browser, Page } from 'playwright-chromium'
-import { chromium } from 'playwright-chromium'
-import type { RollupWatcher } from 'rollup'
-import sirv from 'sirv'
-import type { ResolvedConfig, ServerOptions, ViteDevServer } from 'vite'
-import { build, createServer } from 'vitepress'
-import type { File } from 'vitest'
-import { beforeAll } from 'vitest'
-
-type VitePressBuildOptions = Parameters[1]
-
-// #region env
-
-export const workspaceRoot = resolve(__dirname, '../')
-
-export const isBuild = !!process.env.VITE_TEST_BUILD
-export const isServe = !isBuild
-export const isWindows = process.platform === 'win32'
-export const vitePressBinPath = path.posix.join(
- workspaceRoot,
- 'bin/vitepress.js'
-)
-
-// #endregion
-
-// #region context
-
-let server: ViteDevServer | http.Server
-
-/**
- * Vite Dev Server when testing serve
- */
-export let viteServer: ViteDevServer
-/**
- * Root of the VitePress fixture
- */
-export let rootDir: string
-/**
- * Path to the current test file
- */
-export let testPath: string
-/**
- * Path to the test folder
- */
-export let testDir: string
-/**
- * Test folder name
- */
-export let testName: string
-
-export const serverLogs: string[] = []
-export const browserLogs: string[] = []
-export const browserErrors: Error[] = []
-
-export let resolvedConfig: ResolvedConfig = undefined!
-
-export let page: Page = undefined!
-export let browser: Browser = undefined!
-export let vitePressTestUrl: string = ''
-export let watcher: RollupWatcher | undefined = undefined
-
-declare module 'vite' {
- interface InlineConfig {
- testConfig?: {
- // relative base output use relative path
- // rewrite the url to truth file path
- baseRoute: string
- }
- }
-}
-
-export function setViteUrl(url: string): void {
- vitePressTestUrl = url
-}
-
-// #endregion
-
-const DIR = join(os.tmpdir(), 'vitest_playwright_global_setup')
-
-beforeAll(async (s) => {
- const suite = s as File
- // skip browser setup for non-examples tests
- if (!suite.filepath.includes('examples')) {
- return
- }
-
- const wsEndpoint = fs.readFileSync(join(DIR, 'wsEndpoint'), 'utf-8')
- if (!wsEndpoint) {
- throw new Error('wsEndpoint not found')
- }
-
- browser = await chromium.connect(wsEndpoint)
- page = await browser.newPage()
-
- const globalConsole = global.console
- const warn = globalConsole.warn
- globalConsole.warn = (msg, ...args) => {
- // suppress @vue/reactivity-transform warning
- if (msg.includes('@vue/reactivity-transform')) return
- if (msg.includes('Generated an empty chunk')) return
- warn.call(globalConsole, msg, ...args)
- }
-
- try {
- page.on('console', (msg) => {
- browserLogs.push(msg.text())
- })
- page.on('pageerror', (error) => {
- browserErrors.push(error)
- })
-
- testPath = suite.filepath!
- testName = slash(testPath).match(/examples\/([\w-]+)\//)?.[1]
- testDir = dirname(testPath)
-
- // if this is a test placed under examples/xxx/__tests__
- // start a vite server in that directory.
- if (testName) {
- testDir = resolve(workspaceRoot, 'examples-temp', testName)
-
- // when `root` dir is present, use it as vite's root
- const testCustomRoot = resolve(testDir, 'root')
- rootDir = fs.existsSync(testCustomRoot) ? testCustomRoot : testDir
- await startDefaultServe()
- }
- } catch (e) {
- // Closing the page since an error in the setup, for example a runtime error
- // when building the examples should skip further tests.
- // If the page remains open, a command like `await page.click(...)` produces
- // a timeout with an exception that hides the real error in the console.
- await page.close()
- await server?.close()
- throw e
- }
-
- return async () => {
- serverLogs.length = 0
- await page?.close()
- await server?.close()
- watcher?.close()
- if (browser) {
- await browser.close()
- }
- }
-})
-
-export async function startDefaultServe(): Promise {
- const options: ServerOptions = undefined
- setupConsoleWarnCollector(serverLogs)
-
- if (!isBuild) {
- viteServer = server = await (await createServer(rootDir, options)).listen()
- const devBase = server.config.base
- vitePressTestUrl = `http://localhost:${server.config.server.port}${
- devBase === '/' ? '' : devBase
- }`
- await page.goto(vitePressTestUrl)
- // TODO: A manual reload is needed because the first load of page will crash
- // because of multiple vue instances. (see https://github.com/vuejs/vitepress/issues/1016)
- // Try to remove this after migrating to Vite3.
- if (isServe) {
- await page.reload()
- }
- } else {
- const options: VitePressBuildOptions = {}
- await build(rootDir, options)
- vitePressTestUrl = await startStaticServer()
- await page.goto(vitePressTestUrl)
- }
-}
-
-function startStaticServer(config?: VitePressBuildOptions): Promise {
- if (!config) {
- // check if the test project has base config
- const configFile = resolve(rootDir, '.vitepress/config.ts')
- try {
- config = require(configFile)
- } catch (e) {}
- }
-
- // fallback internal base to ''
- let base = config?.base
- if (!base || base === '/' || base === './') {
- base = ''
- }
-
- // start static file server
- const serve = sirv(resolve(rootDir, '.vitepress/dist'))
- const baseDir = config?.base
- const httpServer = (server = http.createServer((req, res) => {
- if (req.url === '/ping') {
- res.statusCode = 200
- res.end('pong')
- } else {
- if (baseDir) {
- req.url = path.posix.join(baseDir, req.url)
- }
- serve(req, res)
- }
- }))
- let port = 4173
- return new Promise((resolve, reject) => {
- const onError = (e: any) => {
- if (e.code === 'EADDRINUSE') {
- httpServer.close()
- httpServer.listen(++port)
- } else {
- reject(e)
- }
- }
- httpServer.on('error', onError)
- httpServer.listen(port, () => {
- httpServer.removeListener('error', onError)
- resolve(`http://localhost:${port}${base}`)
- })
- })
-}
-
-function setupConsoleWarnCollector(logs: string[]) {
- const warn = console.warn
- console.warn = (...args) => {
- serverLogs.push(args.join(' '))
- return warn.call(console, ...args)
- }
-}
-
-export function slash(p: string): string {
- return p.replace(/\\/g, '/')
-}
diff --git a/netlify.toml b/netlify.toml
index 533247ac..8ebbb56e 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -3,4 +3,4 @@
[build]
publish = "docs/.vitepress/dist"
- command = "pnpm ci-docs"
+ command = "pnpm docs-build"
diff --git a/package.json b/package.json
index 024510b3..c3008c60 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,7 @@
"dev": "rimraf dist && run-s dev-shared dev-start",
"dev-start": "run-p dev-client dev-node dev-watch",
"dev-client": "tsc -w -p src/client",
- "dev-node": "DEV=true pnpm run build-node -w",
+ "dev-node": "DEV=true pnpm build-node -w",
"dev-shared": "node scripts/copyShared",
"dev-watch": "node scripts/watchAndCopy",
"build": "run-s build-prepare build-client build-node",
@@ -61,34 +61,31 @@
"build-node": "tsc -p src/node --noEmit && rollup --config rollup.config.ts --configPlugin esbuild",
"format": "prettier --check --write .",
"format-fail": "prettier --check .",
- "lint": "pnpm run format",
- "lint-fail": "pnpm run format-fail",
- "test": "vitest -r __tests__",
- "test-unit": "vitest run -r __tests__",
- "test-serve": "vitest run -c vitest.config.e2e.ts",
- "test-build": "VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts",
- "debug-serve": "VITE_DEBUG_SERVE=1 vitest run -c vitest.config.e2e.ts",
- "debug-build": "VITE_TEST_BUILD=1 VITE_PRESERVE_BUILD_ARTIFACTS=1 vitest run -c vitest.config.e2e.ts",
- "check": "run-s lint test-unit docs-build",
+ "check": "run-s format-fail build test",
+ "test": "run-p --aggregate-output test-unit test-serve test-build",
+ "test-unit": "vitest run -r __tests__/unit",
+ "test-serve": "vitest run -r __tests__/e2e",
+ "test-build": "VITE_TEST_BUILD=1 pnpm test-serve",
+ "debug-serve": "DEBUG=1 vitest -r __tests__/e2e",
+ "debug-build": "VITE_TEST_BUILD=1 pnpm debug-serve",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"release": "node scripts/release.js",
"docs": "run-p dev docs-dev",
- "docs-dev": "wait-on -d 1000 dist/node/cli.js && node ./bin/vitepress dev docs",
+ "docs-dev": "wait-on -d 100 dist/node/cli.js && node ./bin/vitepress dev docs",
"docs-debug": "node --inspect-brk ./bin/vitepress dev docs",
"docs-build": "run-s build docs-build-only",
"docs-build-only": "node ./bin/vitepress build docs",
- "docs-serve": "node ./bin/vitepress serve docs",
- "ci-docs": "run-s docs-build"
+ "docs-serve": "node ./bin/vitepress serve docs"
},
"dependencies": {
"@docsearch/css": "^3.3.0",
"@docsearch/js": "^3.3.0",
- "@vitejs/plugin-vue": "^3.1.2",
+ "@vitejs/plugin-vue": "^3.2.0",
"@vue/devtools-api": "^6.4.5",
"@vueuse/core": "^9.4.0",
"body-scroll-lock": "4.0.0-beta.0",
"shiki": "^0.11.1",
- "vite": "^3.1.8",
+ "vite": "^3.2.2",
"vue": "^3.2.41"
},
"devDependencies": {
@@ -118,7 +115,7 @@
"@types/markdown-it-emoji": "^2.0.2",
"@types/micromatch": "^4.0.2",
"@types/minimist": "^1.2.2",
- "@types/node": "^18.11.5",
+ "@types/node": "^18.11.9",
"@types/prompts": "^2.4.1",
"chokidar": "^3.5.3",
"compression": "^1.7.4",
@@ -126,13 +123,14 @@
"cross-spawn": "^7.0.3",
"debug": "^4.3.4",
"enquirer": "^2.3.6",
- "esbuild": "^0.15.12",
+ "esbuild": "^0.15.13",
"escape-html": "^1.0.3",
"execa": "^6.1.0",
"fast-glob": "^3.2.12",
"fs-extra": "^10.1.0",
+ "get-port": "^5.1.1",
"lint-staged": "^13.0.3",
- "lru-cache": "^7.14.0",
+ "lru-cache": "^7.14.1",
"markdown-it": "^13.0.1",
"markdown-it-anchor": "^8.6.5",
"markdown-it-attrs": "^4.1.4",
@@ -154,12 +152,12 @@
"rollup-plugin-dts": "^4.2.3",
"rollup-plugin-esbuild": "^4.10.1",
"semver": "^7.3.8",
+ "shiki-processor": "^0.1.1",
"simple-git-hooks": "^2.8.1",
"sirv": "^2.0.2",
- "shiki-processor": "^0.1.1",
"supports-color": "^9.2.3",
"typescript": "~4.8.4",
- "vitest": "^0.24.3",
+ "vitest": "^0.24.5",
"vue-tsc": "^1.0.9",
"wait-on": "^6.0.1"
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e6333d2b..e1f5ecff 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -32,9 +32,9 @@ importers:
'@types/markdown-it-emoji': ^2.0.2
'@types/micromatch': ^4.0.2
'@types/minimist': ^1.2.2
- '@types/node': ^18.11.5
+ '@types/node': ^18.11.9
'@types/prompts': ^2.4.1
- '@vitejs/plugin-vue': ^3.1.2
+ '@vitejs/plugin-vue': ^3.2.0
'@vue/devtools-api': ^6.4.5
'@vueuse/core': ^9.4.0
body-scroll-lock: 4.0.0-beta.0
@@ -44,13 +44,14 @@ importers:
cross-spawn: ^7.0.3
debug: ^4.3.4
enquirer: ^2.3.6
- esbuild: ^0.15.12
+ esbuild: ^0.15.13
escape-html: ^1.0.3
execa: ^6.1.0
fast-glob: ^3.2.12
fs-extra: ^10.1.0
+ get-port: ^5.1.1
lint-staged: ^13.0.3
- lru-cache: ^7.14.0
+ lru-cache: ^7.14.1
markdown-it: ^13.0.1
markdown-it-anchor: ^8.6.5
markdown-it-attrs: ^4.1.4
@@ -78,20 +79,20 @@ importers:
sirv: ^2.0.2
supports-color: ^9.2.3
typescript: ~4.8.4
- vite: ^3.1.8
- vitest: ^0.24.3
+ vite: ^3.2.2
+ vitest: ^0.24.5
vue: ^3.2.41
vue-tsc: ^1.0.9
wait-on: ^6.0.1
dependencies:
'@docsearch/css': 3.3.0
'@docsearch/js': 3.3.0
- '@vitejs/plugin-vue': 3.1.2_vite@3.1.8+vue@3.2.41
+ '@vitejs/plugin-vue': 3.2.0_vite@3.2.2+vue@3.2.41
'@vue/devtools-api': 6.4.5
'@vueuse/core': 9.4.0_vue@3.2.41
body-scroll-lock: 4.0.0-beta.0
shiki: 0.11.1
- vite: 3.1.8
+ vite: 3.2.2
vue: 3.2.41
devDependencies:
'@mdit-vue/plugin-component': 0.11.1
@@ -120,7 +121,7 @@ importers:
'@types/markdown-it-emoji': 2.0.2
'@types/micromatch': 4.0.2
'@types/minimist': 1.2.2
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
'@types/prompts': 2.4.1
chokidar: 3.5.3
compression: 1.7.4_supports-color@9.2.3
@@ -128,13 +129,14 @@ importers:
cross-spawn: 7.0.3
debug: 4.3.4_supports-color@9.2.3
enquirer: 2.3.6
- esbuild: 0.15.12
+ esbuild: 0.15.13
escape-html: 1.0.3
execa: 6.1.0
fast-glob: 3.2.12
fs-extra: 10.1.0
+ get-port: 5.1.1
lint-staged: 13.0.3_ajx7kz6qaaccfdrfvtykaxkwdi
- lru-cache: 7.14.0
+ lru-cache: 7.14.1
markdown-it: 13.0.1
markdown-it-anchor: 8.6.5_ea7kj7wzjkld5jo2noyjqxi764
markdown-it-attrs: 4.1.4_markdown-it@13.0.1
@@ -154,40 +156,28 @@ importers:
rimraf: 3.0.2
rollup: 2.79.1
rollup-plugin-dts: 4.2.3_gypgyaqhine6mwjfvh7icfhviq
- rollup-plugin-esbuild: 4.10.1_g3cmpcqb4ptt4sr26x7hjpe6wu
+ rollup-plugin-esbuild: 4.10.1_y52ntm5ehro3ksqbdsj5ejqhna
semver: 7.3.8
shiki-processor: 0.1.1_shiki@0.11.1
simple-git-hooks: 2.8.1
sirv: 2.0.2
supports-color: 9.2.3
typescript: 4.8.4
- vitest: 0.24.3_supports-color@9.2.3
+ vitest: 0.24.5_supports-color@9.2.3
vue-tsc: 1.0.9_typescript@4.8.4
wait-on: 6.0.1_debug@4.3.4
- docs:
- specifiers:
- vitepress: workspace:*
- devDependencies:
- vitepress: link:..
-
- examples:
- specifiers:
- vitepress: workspace:*
- devDependencies:
- vitepress: link:..
-
- examples/configured:
+ __tests__/e2e:
specifiers:
vitepress: workspace:*
devDependencies:
vitepress: link:../..
- examples/minimal:
+ docs:
specifiers:
vitepress: workspace:*
devDependencies:
- vitepress: link:../..
+ vitepress: link:..
packages:
@@ -381,16 +371,16 @@ packages:
- '@algolia/client-search'
dev: false
- /@esbuild/android-arm/0.15.12:
- resolution: {integrity: sha512-IC7TqIqiyE0MmvAhWkl/8AEzpOtbhRNDo7aph47We1NbE5w2bt/Q+giAhe0YYeVpYnIhGMcuZY92qDK6dQauvA==}
+ /@esbuild/android-arm/0.15.13:
+ resolution: {integrity: sha512-RY2fVI8O0iFUNvZirXaQ1vMvK0xhCcl0gqRj74Z6yEiO1zAUa7hbsdwZM1kzqbxHK7LFyMizipfXT3JME+12Hw==}
engines: {node: '>=12'}
cpu: [arm]
os: [android]
requiresBuild: true
optional: true
- /@esbuild/linux-loong64/0.15.12:
- resolution: {integrity: sha512-tZEowDjvU7O7I04GYvWQOS4yyP9E/7YlsB0jjw1Ycukgr2ycEzKyIk5tms5WnLBymaewc6VmRKnn5IJWgK4eFw==}
+ /@esbuild/linux-loong64/0.15.13:
+ resolution: {integrity: sha512-+BoyIm4I8uJmH/QDIH0fu7MG0AEx9OXEDXnqptXCwKOlOqZiS4iraH1Nr7/ObLMokW3sOCeBNyD68ATcV9b9Ag==}
engines: {node: '>=12'}
cpu: [loong64]
os: [linux]
@@ -616,14 +606,14 @@ packages:
/@types/accepts/1.3.5:
resolution: {integrity: sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==}
dependencies:
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
dev: true
/@types/body-parser/1.19.2:
resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==}
dependencies:
'@types/connect': 3.4.35
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
dev: true
/@types/body-scroll-lock/3.1.0:
@@ -653,7 +643,7 @@ packages:
/@types/connect/3.4.35:
resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==}
dependencies:
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
dev: true
/@types/content-disposition/0.5.5:
@@ -666,13 +656,13 @@ packages:
'@types/connect': 3.4.35
'@types/express': 4.17.14
'@types/keygrip': 1.0.2
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
dev: true
/@types/cross-spawn/6.0.2:
resolution: {integrity: sha512-KuwNhp3eza+Rhu8IFI5HUXRP0LIhqH5cAjubUvGXXthh4YYBuP2ntwEX+Cz8GJoZUHlKo247wPWOfA9LYEq4cw==}
dependencies:
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
dev: true
/@types/debug/4.1.7:
@@ -692,7 +682,7 @@ packages:
/@types/express-serve-static-core/4.17.31:
resolution: {integrity: sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==}
dependencies:
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
'@types/qs': 6.9.7
'@types/range-parser': 1.2.4
dev: true
@@ -709,7 +699,7 @@ packages:
/@types/fs-extra/9.0.13:
resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==}
dependencies:
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
dev: true
/@types/http-assert/1.5.3:
@@ -753,7 +743,7 @@ packages:
'@types/http-errors': 1.8.2
'@types/keygrip': 1.0.2
'@types/koa-compose': 3.2.5
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
dev: true
/@types/linkify-it/3.0.2:
@@ -807,8 +797,8 @@ packages:
resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==}
dev: true
- /@types/node/18.11.5:
- resolution: {integrity: sha512-3JRwhbjI+cHLAkUorhf8RnqUbFXajvzX4q6fMn5JwkgtuwfYtRQYI3u4V92vI6NJuTsbBQWWh3RZjFsuevyMGQ==}
+ /@types/node/18.11.9:
+ resolution: {integrity: sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==}
dev: true
/@types/normalize-package-data/2.4.1:
@@ -818,7 +808,7 @@ packages:
/@types/prompts/2.4.1:
resolution: {integrity: sha512-1Mqzhzi9W5KlooNE4o0JwSXGUDeQXKldbGn9NO4tpxwZbHXYd+WcKpCksG2lbhH7U9I9LigfsdVsP2QAY0lNPA==}
dependencies:
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
dev: true
/@types/qs/6.9.7:
@@ -837,21 +827,21 @@ packages:
resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==}
dependencies:
'@types/mime': 3.0.1
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
dev: true
/@types/web-bluetooth/0.0.16:
resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==}
dev: false
- /@vitejs/plugin-vue/3.1.2_vite@3.1.8+vue@3.2.41:
- resolution: {integrity: sha512-3zxKNlvA3oNaKDYX0NBclgxTQ1xaFdL7PzwF6zj9tGFziKwmBa3Q/6XcJQxudlT81WxDjEhHmevvIC4Orc1LhQ==}
+ /@vitejs/plugin-vue/3.2.0_vite@3.2.2+vue@3.2.41:
+ resolution: {integrity: sha512-E0tnaL4fr+qkdCNxJ+Xd0yM31UwMkQje76fsDVBBUCoGOUPexu2VDUYHL8P4CwV+zMvWw6nlRw19OnRKmYAJpw==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
vite: ^3.0.0
vue: ^3.2.25
dependencies:
- vite: 3.1.8
+ vite: 3.2.2
vue: 3.2.41
dev: false
@@ -1229,7 +1219,7 @@ packages:
check-error: 1.0.2
deep-eql: 3.0.1
get-func-name: 2.0.0
- loupe: 2.3.4
+ loupe: 2.3.5
pathval: 1.1.1
type-detect: 4.0.8
dev: true
@@ -1726,194 +1716,194 @@ packages:
is-symbol: 1.0.4
dev: true
- /esbuild-android-64/0.15.12:
- resolution: {integrity: sha512-MJKXwvPY9g0rGps0+U65HlTsM1wUs9lbjt5CU19RESqycGFDRijMDQsh68MtbzkqWSRdEtiKS1mtPzKneaAI0Q==}
+ /esbuild-android-64/0.15.13:
+ resolution: {integrity: sha512-yRorukXBlokwTip+Sy4MYskLhJsO0Kn0/Fj43s1krVblfwP+hMD37a4Wmg139GEsMLl+vh8WXp2mq/cTA9J97g==}
engines: {node: '>=12'}
cpu: [x64]
os: [android]
requiresBuild: true
optional: true
- /esbuild-android-arm64/0.15.12:
- resolution: {integrity: sha512-Hc9SEcZbIMhhLcvhr1DH+lrrec9SFTiRzfJ7EGSBZiiw994gfkVV6vG0sLWqQQ6DD7V4+OggB+Hn0IRUdDUqvA==}
+ /esbuild-android-arm64/0.15.13:
+ resolution: {integrity: sha512-TKzyymLD6PiVeyYa4c5wdPw87BeAiTXNtK6amWUcXZxkV51gOk5u5qzmDaYSwiWeecSNHamFsaFjLoi32QR5/w==}
engines: {node: '>=12'}
cpu: [arm64]
os: [android]
requiresBuild: true
optional: true
- /esbuild-darwin-64/0.15.12:
- resolution: {integrity: sha512-qkmqrTVYPFiePt5qFjP8w/S+GIUMbt6k8qmiPraECUWfPptaPJUGkCKrWEfYFRWB7bY23FV95rhvPyh/KARP8Q==}
+ /esbuild-darwin-64/0.15.13:
+ resolution: {integrity: sha512-WAx7c2DaOS6CrRcoYCgXgkXDliLnFv3pQLV6GeW1YcGEZq2Gnl8s9Pg7ahValZkpOa0iE/ojRVQ87sbUhF1Cbg==}
engines: {node: '>=12'}
cpu: [x64]
os: [darwin]
requiresBuild: true
optional: true
- /esbuild-darwin-arm64/0.15.12:
- resolution: {integrity: sha512-z4zPX02tQ41kcXMyN3c/GfZpIjKoI/BzHrdKUwhC/Ki5BAhWv59A9M8H+iqaRbwpzYrYidTybBwiZAIWCLJAkw==}
+ /esbuild-darwin-arm64/0.15.13:
+ resolution: {integrity: sha512-U6jFsPfSSxC3V1CLiQqwvDuj3GGrtQNB3P3nNC3+q99EKf94UGpsG9l4CQ83zBs1NHrk1rtCSYT0+KfK5LsD8A==}
engines: {node: '>=12'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
optional: true
- /esbuild-freebsd-64/0.15.12:
- resolution: {integrity: sha512-XFL7gKMCKXLDiAiBjhLG0XECliXaRLTZh6hsyzqUqPUf/PY4C6EJDTKIeqqPKXaVJ8+fzNek88285krSz1QECw==}
+ /esbuild-freebsd-64/0.15.13:
+ resolution: {integrity: sha512-whItJgDiOXaDG/idy75qqevIpZjnReZkMGCgQaBWZuKHoElDJC1rh7MpoUgupMcdfOd+PgdEwNQW9DAE6i8wyA==}
engines: {node: '>=12'}
cpu: [x64]
os: [freebsd]
requiresBuild: true
optional: true
- /esbuild-freebsd-arm64/0.15.12:
- resolution: {integrity: sha512-jwEIu5UCUk6TjiG1X+KQnCGISI+ILnXzIzt9yDVrhjug2fkYzlLbl0K43q96Q3KB66v6N1UFF0r5Ks4Xo7i72g==}
+ /esbuild-freebsd-arm64/0.15.13:
+ resolution: {integrity: sha512-6pCSWt8mLUbPtygv7cufV0sZLeylaMwS5Fznj6Rsx9G2AJJsAjQ9ifA+0rQEIg7DwJmi9it+WjzNTEAzzdoM3Q==}
engines: {node: '>=12'}
cpu: [arm64]
os: [freebsd]
requiresBuild: true
optional: true
- /esbuild-linux-32/0.15.12:
- resolution: {integrity: sha512-uSQuSEyF1kVzGzuIr4XM+v7TPKxHjBnLcwv2yPyCz8riV8VUCnO/C4BF3w5dHiVpCd5Z1cebBtZJNlC4anWpwA==}
+ /esbuild-linux-32/0.15.13:
+ resolution: {integrity: sha512-VbZdWOEdrJiYApm2kkxoTOgsoCO1krBZ3quHdYk3g3ivWaMwNIVPIfEE0f0XQQ0u5pJtBsnk2/7OPiCFIPOe/w==}
engines: {node: '>=12'}
cpu: [ia32]
os: [linux]
requiresBuild: true
optional: true
- /esbuild-linux-64/0.15.12:
- resolution: {integrity: sha512-QcgCKb7zfJxqT9o5z9ZUeGH1k8N6iX1Y7VNsEi5F9+HzN1OIx7ESxtQXDN9jbeUSPiRH1n9cw6gFT3H4qbdvcA==}
+ /esbuild-linux-64/0.15.13:
+ resolution: {integrity: sha512-rXmnArVNio6yANSqDQlIO4WiP+Cv7+9EuAHNnag7rByAqFVuRusLbGi2697A5dFPNXoO//IiogVwi3AdcfPC6A==}
engines: {node: '>=12'}
cpu: [x64]
os: [linux]
requiresBuild: true
optional: true
- /esbuild-linux-arm/0.15.12:
- resolution: {integrity: sha512-Wf7T0aNylGcLu7hBnzMvsTfEXdEdJY/hY3u36Vla21aY66xR0MS5I1Hw8nVquXjTN0A6fk/vnr32tkC/C2lb0A==}
+ /esbuild-linux-arm/0.15.13:
+ resolution: {integrity: sha512-Ac6LpfmJO8WhCMQmO253xX2IU2B3wPDbl4IvR0hnqcPrdfCaUa2j/lLMGTjmQ4W5JsJIdHEdW12dG8lFS0MbxQ==}
engines: {node: '>=12'}
cpu: [arm]
os: [linux]
requiresBuild: true
optional: true
- /esbuild-linux-arm64/0.15.12:
- resolution: {integrity: sha512-HtNq5xm8fUpZKwWKS2/YGwSfTF+339L4aIA8yphNKYJckd5hVdhfdl6GM2P3HwLSCORS++++7++//ApEwXEuAQ==}
+ /esbuild-linux-arm64/0.15.13:
+ resolution: {integrity: sha512-alEMGU4Z+d17U7KQQw2IV8tQycO6T+rOrgW8OS22Ua25x6kHxoG6Ngry6Aq6uranC+pNWNMB6aHFPh7aTQdORQ==}
engines: {node: '>=12'}
cpu: [arm64]
os: [linux]
requiresBuild: true
optional: true
- /esbuild-linux-mips64le/0.15.12:
- resolution: {integrity: sha512-Qol3+AvivngUZkTVFgLpb0H6DT+N5/zM3V1YgTkryPYFeUvuT5JFNDR3ZiS6LxhyF8EE+fiNtzwlPqMDqVcc6A==}
+ /esbuild-linux-mips64le/0.15.13:
+ resolution: {integrity: sha512-47PgmyYEu+yN5rD/MbwS6DxP2FSGPo4Uxg5LwIdxTiyGC2XKwHhHyW7YYEDlSuXLQXEdTO7mYe8zQ74czP7W8A==}
engines: {node: '>=12'}
cpu: [mips64el]
os: [linux]
requiresBuild: true
optional: true
- /esbuild-linux-ppc64le/0.15.12:
- resolution: {integrity: sha512-4D8qUCo+CFKaR0cGXtGyVsOI7w7k93Qxb3KFXWr75An0DHamYzq8lt7TNZKoOq/Gh8c40/aKaxvcZnTgQ0TJNg==}
+ /esbuild-linux-ppc64le/0.15.13:
+ resolution: {integrity: sha512-z6n28h2+PC1Ayle9DjKoBRcx/4cxHoOa2e689e2aDJSaKug3jXcQw7mM+GLg+9ydYoNzj8QxNL8ihOv/OnezhA==}
engines: {node: '>=12'}
cpu: [ppc64]
os: [linux]
requiresBuild: true
optional: true
- /esbuild-linux-riscv64/0.15.12:
- resolution: {integrity: sha512-G9w6NcuuCI6TUUxe6ka0enjZHDnSVK8bO+1qDhMOCtl7Tr78CcZilJj8SGLN00zO5iIlwNRZKHjdMpfFgNn1VA==}
+ /esbuild-linux-riscv64/0.15.13:
+ resolution: {integrity: sha512-+Lu4zuuXuQhgLUGyZloWCqTslcCAjMZH1k3Xc9MSEJEpEFdpsSU0sRDXAnk18FKOfEjhu4YMGaykx9xjtpA6ow==}
engines: {node: '>=12'}
cpu: [riscv64]
os: [linux]
requiresBuild: true
optional: true
- /esbuild-linux-s390x/0.15.12:
- resolution: {integrity: sha512-Lt6BDnuXbXeqSlVuuUM5z18GkJAZf3ERskGZbAWjrQoi9xbEIsj/hEzVnSAFLtkfLuy2DE4RwTcX02tZFunXww==}
+ /esbuild-linux-s390x/0.15.13:
+ resolution: {integrity: sha512-BMeXRljruf7J0TMxD5CIXS65y7puiZkAh+s4XFV9qy16SxOuMhxhVIXYLnbdfLrsYGFzx7U9mcdpFWkkvy/Uag==}
engines: {node: '>=12'}
cpu: [s390x]
os: [linux]
requiresBuild: true
optional: true
- /esbuild-netbsd-64/0.15.12:
- resolution: {integrity: sha512-jlUxCiHO1dsqoURZDQts+HK100o0hXfi4t54MNRMCAqKGAV33JCVvMplLAa2FwviSojT/5ZG5HUfG3gstwAG8w==}
+ /esbuild-netbsd-64/0.15.13:
+ resolution: {integrity: sha512-EHj9QZOTel581JPj7UO3xYbltFTYnHy+SIqJVq6yd3KkCrsHRbapiPb0Lx3EOOtybBEE9EyqbmfW1NlSDsSzvQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [netbsd]
requiresBuild: true
optional: true
- /esbuild-openbsd-64/0.15.12:
- resolution: {integrity: sha512-1o1uAfRTMIWNOmpf8v7iudND0L6zRBYSH45sofCZywrcf7NcZA+c7aFsS1YryU+yN7aRppTqdUK1PgbZVaB1Dw==}
+ /esbuild-openbsd-64/0.15.13:
+ resolution: {integrity: sha512-nkuDlIjF/sfUhfx8SKq0+U+Fgx5K9JcPq1mUodnxI0x4kBdCv46rOGWbuJ6eof2n3wdoCLccOoJAbg9ba/bT2w==}
engines: {node: '>=12'}
cpu: [x64]
os: [openbsd]
requiresBuild: true
optional: true
- /esbuild-sunos-64/0.15.12:
- resolution: {integrity: sha512-nkl251DpoWoBO9Eq9aFdoIt2yYmp4I3kvQjba3jFKlMXuqQ9A4q+JaqdkCouG3DHgAGnzshzaGu6xofGcXyPXg==}
+ /esbuild-sunos-64/0.15.13:
+ resolution: {integrity: sha512-jVeu2GfxZQ++6lRdY43CS0Tm/r4WuQQ0Pdsrxbw+aOrHQPHV0+LNOLnvbN28M7BSUGnJnHkHm2HozGgNGyeIRw==}
engines: {node: '>=12'}
cpu: [x64]
os: [sunos]
requiresBuild: true
optional: true
- /esbuild-windows-32/0.15.12:
- resolution: {integrity: sha512-WlGeBZHgPC00O08luIp5B2SP4cNCp/PcS+3Pcg31kdcJPopHxLkdCXtadLU9J82LCfw4TVls21A6lilQ9mzHrw==}
+ /esbuild-windows-32/0.15.13:
+ resolution: {integrity: sha512-XoF2iBf0wnqo16SDq+aDGi/+QbaLFpkiRarPVssMh9KYbFNCqPLlGAWwDvxEVz+ywX6Si37J2AKm+AXq1kC0JA==}
engines: {node: '>=12'}
cpu: [ia32]
os: [win32]
requiresBuild: true
optional: true
- /esbuild-windows-64/0.15.12:
- resolution: {integrity: sha512-VActO3WnWZSN//xjSfbiGOSyC+wkZtI8I4KlgrTo5oHJM6z3MZZBCuFaZHd8hzf/W9KPhF0lY8OqlmWC9HO5AA==}
+ /esbuild-windows-64/0.15.13:
+ resolution: {integrity: sha512-Et6htEfGycjDrtqb2ng6nT+baesZPYQIW+HUEHK4D1ncggNrDNk3yoboYQ5KtiVrw/JaDMNttz8rrPubV/fvPQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [win32]
requiresBuild: true
optional: true
- /esbuild-windows-arm64/0.15.12:
- resolution: {integrity: sha512-Of3MIacva1OK/m4zCNIvBfz8VVROBmQT+gRX6pFTLPngFYcj6TFH/12VveAqq1k9VB2l28EoVMNMUCcmsfwyuA==}
+ /esbuild-windows-arm64/0.15.13:
+ resolution: {integrity: sha512-3bv7tqntThQC9SWLRouMDmZnlOukBhOCTlkzNqzGCmrkCJI7io5LLjwJBOVY6kOUlIvdxbooNZwjtBvj+7uuVg==}
engines: {node: '>=12'}
cpu: [arm64]
os: [win32]
requiresBuild: true
optional: true
- /esbuild/0.15.12:
- resolution: {integrity: sha512-PcT+/wyDqJQsRVhaE9uX/Oq4XLrFh0ce/bs2TJh4CSaw9xuvI+xFrH2nAYOADbhQjUgAhNWC5LKoUsakm4dxng==}
+ /esbuild/0.15.13:
+ resolution: {integrity: sha512-Cu3SC84oyzzhrK/YyN4iEVy2jZu5t2fz66HEOShHURcjSkOSAVL8C/gfUT+lDJxkVHpg8GZ10DD0rMHRPqMFaQ==}
engines: {node: '>=12'}
hasBin: true
requiresBuild: true
optionalDependencies:
- '@esbuild/android-arm': 0.15.12
- '@esbuild/linux-loong64': 0.15.12
- esbuild-android-64: 0.15.12
- esbuild-android-arm64: 0.15.12
- esbuild-darwin-64: 0.15.12
- esbuild-darwin-arm64: 0.15.12
- esbuild-freebsd-64: 0.15.12
- esbuild-freebsd-arm64: 0.15.12
- esbuild-linux-32: 0.15.12
- esbuild-linux-64: 0.15.12
- esbuild-linux-arm: 0.15.12
- esbuild-linux-arm64: 0.15.12
- esbuild-linux-mips64le: 0.15.12
- esbuild-linux-ppc64le: 0.15.12
- esbuild-linux-riscv64: 0.15.12
- esbuild-linux-s390x: 0.15.12
- esbuild-netbsd-64: 0.15.12
- esbuild-openbsd-64: 0.15.12
- esbuild-sunos-64: 0.15.12
- esbuild-windows-32: 0.15.12
- esbuild-windows-64: 0.15.12
- esbuild-windows-arm64: 0.15.12
+ '@esbuild/android-arm': 0.15.13
+ '@esbuild/linux-loong64': 0.15.13
+ esbuild-android-64: 0.15.13
+ esbuild-android-arm64: 0.15.13
+ esbuild-darwin-64: 0.15.13
+ esbuild-darwin-arm64: 0.15.13
+ esbuild-freebsd-64: 0.15.13
+ esbuild-freebsd-arm64: 0.15.13
+ esbuild-linux-32: 0.15.13
+ esbuild-linux-64: 0.15.13
+ esbuild-linux-arm: 0.15.13
+ esbuild-linux-arm64: 0.15.13
+ esbuild-linux-mips64le: 0.15.13
+ esbuild-linux-ppc64le: 0.15.13
+ esbuild-linux-riscv64: 0.15.13
+ esbuild-linux-s390x: 0.15.13
+ esbuild-netbsd-64: 0.15.13
+ esbuild-openbsd-64: 0.15.13
+ esbuild-sunos-64: 0.15.13
+ esbuild-windows-32: 0.15.13
+ esbuild-windows-64: 0.15.13
+ esbuild-windows-arm64: 0.15.13
/escalade/3.1.1:
resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
@@ -2084,6 +2074,11 @@ packages:
yargs: 16.2.0
dev: true
+ /get-port/5.1.1:
+ resolution: {integrity: sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==}
+ engines: {node: '>=8'}
+ dev: true
+
/get-stream/6.0.1:
resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==}
engines: {node: '>=10'}
@@ -2648,8 +2643,8 @@ packages:
wrap-ansi: 6.2.0
dev: true
- /loupe/2.3.4:
- resolution: {integrity: sha512-OvKfgCC2Ndby6aSTREl5aCCPTNIzlDfQZvZxNUrBrihDhL3xcrYegTblhmEiCrg2kKQz4XsFIaemE5BF4ybSaQ==}
+ /loupe/2.3.5:
+ resolution: {integrity: sha512-KNGVjhsXDxvY/cYE8GNi7SBaJSfJIT+/+/8GlprqBXpoU6cSR7/RT7OBJOsoYtyxq0L3q6oIcO8tX7dbEEXr3A==}
dependencies:
get-func-name: 2.0.0
dev: true
@@ -2661,8 +2656,8 @@ packages:
yallist: 4.0.0
dev: true
- /lru-cache/7.14.0:
- resolution: {integrity: sha512-EIRtP1GrSJny0dqb50QXRUNBxHJhcpxHC++M5tD7RYbvLLn5KVWKsbyswSSqDuU15UFi3bgTQIY8nhDMeF6aDQ==}
+ /lru-cache/7.14.1:
+ resolution: {integrity: sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==}
engines: {node: '>=12'}
dev: true
@@ -3335,7 +3330,7 @@ packages:
'@babel/code-frame': 7.18.6
dev: true
- /rollup-plugin-esbuild/4.10.1_g3cmpcqb4ptt4sr26x7hjpe6wu:
+ /rollup-plugin-esbuild/4.10.1_y52ntm5ehro3ksqbdsj5ejqhna:
resolution: {integrity: sha512-/ymcRB283zjFp1JTBXO8ekxv0c9vRc2L6OTljghsLthQ4vqeDSDWa9BVz1tHiVrx6SbUnUpDPLC0K/MXK7j5TA==}
engines: {node: '>=12'}
peerDependencies:
@@ -3345,7 +3340,7 @@ packages:
'@rollup/pluginutils': 4.2.1
debug: 4.3.4_supports-color@9.2.3
es-module-lexer: 0.9.3
- esbuild: 0.15.12
+ esbuild: 0.15.13
joycon: 3.1.1
jsonc-parser: 3.2.0
rollup: 2.79.1
@@ -3353,20 +3348,12 @@ packages:
- supports-color
dev: true
- /rollup/2.78.1:
- resolution: {integrity: sha512-VeeCgtGi4P+o9hIg+xz4qQpRl6R401LWEXBmxYKOV4zlF82lyhgh2hTZnheFUbANE8l2A41F458iwj2vEYaXJg==}
- engines: {node: '>=10.0.0'}
- hasBin: true
- optionalDependencies:
- fsevents: 2.3.2
-
/rollup/2.79.1:
resolution: {integrity: sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==}
engines: {node: '>=10.0.0'}
hasBin: true
optionalDependencies:
fsevents: 2.3.2
- dev: true
/run-parallel/1.2.0:
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
@@ -3861,14 +3848,15 @@ packages:
engines: {node: '>= 0.8'}
dev: true
- /vite/3.1.8:
- resolution: {integrity: sha512-m7jJe3nufUbuOfotkntGFupinL/fmuTNuQmiVE7cH2IZMuf4UbfbGYMUT3jVWgGYuRVLY9j8NnrRqgw5rr5QTg==}
+ /vite/3.2.2:
+ resolution: {integrity: sha512-pLrhatFFOWO9kS19bQ658CnRYzv0WLbsPih6R+iFeEEhDOuYgYCX2rztUViMz/uy/V8cLCJvLFeiOK7RJEzHcw==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
peerDependencies:
less: '*'
sass: '*'
stylus: '*'
+ sugarss: '*'
terser: ^5.4.0
peerDependenciesMeta:
less:
@@ -3877,18 +3865,20 @@ packages:
optional: true
stylus:
optional: true
+ sugarss:
+ optional: true
terser:
optional: true
dependencies:
- esbuild: 0.15.12
+ esbuild: 0.15.13
postcss: 8.4.18
resolve: 1.22.1
- rollup: 2.78.1
+ rollup: 2.79.1
optionalDependencies:
fsevents: 2.3.2
- /vitest/0.24.3_supports-color@9.2.3:
- resolution: {integrity: sha512-aM0auuPPgMSstWvr851hB74g/LKaKBzSxcG3da7ejfZbx08Y21JpZmbmDYrMTCGhVZKqTGwzcnLMwyfz2WzkhQ==}
+ /vitest/0.24.5_supports-color@9.2.3:
+ resolution: {integrity: sha512-zw6JhPUHtLILQDe5Q39b/SzoITkG+R7hcFjuthp4xsi6zpmfQPOZcHodZ+3bqoWl4EdGK/p1fuMiEwdxgbGLOA==}
engines: {node: '>=v14.16.0'}
hasBin: true
peerDependencies:
@@ -3911,7 +3901,7 @@ packages:
dependencies:
'@types/chai': 4.3.3
'@types/chai-subset': 1.3.3
- '@types/node': 18.11.5
+ '@types/node': 18.11.9
chai: 4.3.6
debug: 4.3.4_supports-color@9.2.3
local-pkg: 0.4.2
@@ -3919,11 +3909,12 @@ packages:
tinybench: 2.3.1
tinypool: 0.3.0
tinyspy: 1.0.2
- vite: 3.1.8
+ vite: 3.2.2
transitivePeerDependencies:
- less
- sass
- stylus
+ - sugarss
- supports-color
- terser
dev: true
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 7db7dce7..8d0353c9 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -1,4 +1,3 @@
packages:
- - examples/*
- - examples
- docs
+ - __tests__/*
diff --git a/src/node/serve/serve.ts b/src/node/serve/serve.ts
index 3212be54..02edb0c2 100644
--- a/src/node/serve/serve.ts
+++ b/src/node/serve/serve.ts
@@ -51,13 +51,13 @@ export async function serve(options: ServeOptions = {}) {
})
if (base) {
- polka({ onNoMatch })
+ return polka({ onNoMatch })
.use(base, compress, serve)
.listen(port, () => {
console.log(`Built site served at http://localhost:${port}/${base}/\n`)
})
} else {
- polka({ onNoMatch })
+ return polka({ onNoMatch })
.use(compress, serve)
.listen(port, () => {
console.log(`Built site served at http://localhost:${port}/\n`)
diff --git a/vitest.config.e2e.ts b/vitest.config.e2e.ts
deleted file mode 100644
index 6c03ccfb..00000000
--- a/vitest.config.e2e.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { resolve } from 'path'
-import { defineConfig } from 'vitest/config'
-
-const timeout = process.env.CI ? 50000 : 30000
-
-export default defineConfig({
- resolve: {
- alias: {
- '~utils': resolve(__dirname, './examples/test-utils')
- }
- },
- test: {
- include: ['./examples/**/*.spec.[tj]s'],
- setupFiles: ['./examples/vitestSetup.ts'],
- globalSetup: ['./examples/vitestGlobalSetup.ts'],
- testTimeout: timeout,
- hookTimeout: timeout,
- globals: true,
- reporters: 'dot',
- onConsoleLog(log) {
- if (log.match(/experimental|jit engine|emitted file|tailwind/i))
- return false
- }
- },
- esbuild: {
- target: 'node14'
- }
-})