Skip to content

Commit

Permalink
Merge branch 'main' into new-router
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Dec 19, 2023
2 parents 95df8bb + 6c1c93e commit aab1ee2
Show file tree
Hide file tree
Showing 19 changed files with 505 additions and 461 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
},
},
{
files: ['**/e2e/**/*.cy.ts'],
files: ['**/e2e/**/*.cy.ts', '**/e2e/cypress/**/*.ts'],
extends: 'plugin:cypress/recommended',
},
{
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: ['18', '20']
base: ['/', '/e2e/']
bundler: ['vite', 'webpack']

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -61,12 +62,14 @@ jobs:
working-directory: ./e2e
run: pnpm e2e:ci:dev
env:
E2E_BASE: ${{ matrix.base }}
E2E_BUNDLER: ${{ matrix.bundler }}

- name: E2E build
working-directory: ./e2e
run: pnpm e2e:ci:build
env:
E2E_BASE: ${{ matrix.base }}
E2E_BUNDLER: ${{ matrix.bundler }}

e2e-result:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ dist/
# Test coverage files
coverage/

# E2E temp files
e2e/cypress/screenshots/

# Node modules
node_modules/

Expand Down
4 changes: 3 additions & 1 deletion e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export default defineConfig({
e2e: {
baseUrl: 'http://localhost:8080',
specPattern: 'tests/**/*.cy.ts',
supportFile: false,
},
env: {
E2E_BASE: process.env.E2E_BASE ?? '/',
},
})
8 changes: 8 additions & 0 deletions e2e/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const URL_PREFIX = Cypress.env('E2E_BASE').replace(/\/$/, '')

// override the default cy.visit command to prepend base
// @ts-expect-error: could not type this method correctly
Cypress.Commands.overwrite('visit', (originalFn, url, options) =>
// @ts-expect-error: could not type this method correctly
originalFn(`${URL_PREFIX}${url}`, options),
)
1 change: 1 addition & 0 deletions e2e/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './commands'
7 changes: 6 additions & 1 deletion e2e/docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import process from 'node:process'
import { viteBundler } from '@vuepress/bundler-vite'
import { webpackBundler } from '@vuepress/bundler-webpack'
import { defineUserConfig } from '@vuepress/cli'
import { path } from '@vuepress/utils'
import { e2eTheme } from './theme/node/e2eTheme.js'

const E2E_BASE = (process.env.E2E_BASE ?? '/') as '/' | `/${string}/`

export default defineUserConfig({
base: '/',
base: E2E_BASE,

dest: path.join(__dirname, 'dist', E2E_BASE),

head: [
['meta', { name: 'foo', content: 'foo' }],
Expand Down
3 changes: 2 additions & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
"@vuepress/utils": "workspace:*",
"sass": "^1.69.5",
"sass-loader": "^13.3.2",
"vue": "^3.3.11"
"vue": "^3.3.13"
},
"devDependencies": {
"anywhere": "^1.6.0",
"cypress": "^13.6.1",
"process": "^0.11.10",
"start-server-and-test": "^2.0.3"
}
}
8 changes: 5 additions & 3 deletions e2e/tests/markdown/links.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const E2E_BASE = Cypress.env('E2E_BASE')

describe('markdown > links', () => {
it('should render links and navigate between pages correctly', () => {
cy.visit('/markdown/links/foo.html')
Expand All @@ -9,7 +11,7 @@ describe('markdown > links', () => {
.click()

cy.location().should((location) => {
expect(location.pathname).to.eq('/markdown/links/bar.html')
expect(location.pathname).to.eq(`${E2E_BASE}markdown/links/bar.html`)
})

cy.get('.e2e-theme-content ul li a')
Expand All @@ -19,7 +21,7 @@ describe('markdown > links', () => {
.click()

cy.location().should((location) => {
expect(location.pathname).to.eq('/markdown/links/baz.html')
expect(location.pathname).to.eq(`${E2E_BASE}markdown/links/baz.html`)
})

cy.get('.e2e-theme-content ul li a')
Expand All @@ -29,7 +31,7 @@ describe('markdown > links', () => {
.click()

cy.location().should((location) => {
expect(location.pathname).to.eq('/markdown/links/foo.html')
expect(location.pathname).to.eq(`${E2E_BASE}markdown/links/foo.html`)
})
})
})
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
"devDependencies": {
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@types/node": "^20.10.4",
"@types/node": "^20.10.5",
"@types/webpack-env": "^1.18.4",
"@vitest/coverage-istanbul": "^1.0.4",
"@vitest/coverage-istanbul": "^1.1.0",
"bumpp": "^9.2.1",
"conventional-changelog-cli": "^4.1.0",
"eslint": "^8.55.0",
"eslint": "^8.56.0",
"eslint-config-vuepress": "^4.8.0",
"eslint-config-vuepress-typescript": "^4.8.0",
"eslint-plugin-cypress": "^2.15.1",
Expand All @@ -45,10 +45,10 @@
"tsconfig-vuepress": "^4.5.0",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"vite": "~5.0.7",
"vitest": "^1.0.4"
"vite": "~5.0.10",
"vitest": "^1.1.0"
},
"packageManager": "[email protected].0",
"packageManager": "[email protected].1",
"engines": {
"node": ">=18.16.0"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/bundler-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
"connect-history-api-fallback": "^2.0.0",
"postcss": "^8.4.32",
"postcss-load-config": "^5.0.2",
"rollup": "^4.7.0",
"vite": "~5.0.7",
"vue": "^3.3.11",
"rollup": "^4.9.1",
"vite": "~5.0.10",
"vue": "^3.3.13",
"vue-router": "^4.2.5"
},
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/bundler-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
"css-loader": "^6.8.1",
"esbuild-loader": "~4.0.2",
"express": "^4.18.2",
"html-webpack-plugin": "^5.5.4",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.7.6",
"postcss": "^8.4.32",
"postcss-csso": "^6.0.1",
"postcss-loader": "^7.3.3",
"style-loader": "^3.3.3",
"vue": "^3.3.11",
"vue": "^3.3.13",
"vue-loader": "^17.3.1",
"vue-router": "^4.2.5",
"webpack": "^5.89.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"cac": "^6.7.14",
"chokidar": "^3.5.3",
"envinfo": "^7.11.0",
"esbuild": "~0.19.9"
"esbuild": "~0.19.10"
},
"devDependencies": {
"@types/envinfo": "^7.8.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@vue/devtools-api": "^6.5.1",
"@vuepress/shared": "workspace:*",
"@vueuse/core": "^10.7.0",
"vue": "^3.3.11",
"vue": "^3.3.13",
"vue-router": "^4.2.5"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@vuepress/markdown": "workspace:*",
"@vuepress/shared": "workspace:*",
"@vuepress/utils": "workspace:*",
"vue": "^3.3.11"
"vue": "^3.3.13"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"dependencies": {
"@mdit-vue/types": "^2.0.0",
"@vue/shared": "^3.3.11"
"@vue/shared": "^3.3.13"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/vuepress-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@vuepress/bundler-vite": "workspace:*",
"@vuepress/cli": "workspace:*",
"@vuepress/core": "workspace:*",
"vue": "^3.3.11"
"vue": "^3.3.13"
},
"devDependencies": {
"@vuepress/client": "workspace:*"
Expand Down
2 changes: 1 addition & 1 deletion packages/vuepress-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@vuepress/cli": "workspace:*",
"@vuepress/core": "workspace:*",
"sass-loader": "^13.3.2",
"vue": "^3.3.11"
"vue": "^3.3.13"
},
"peerDependencies": {
"vue": "^3.3.4"
Expand Down
Loading

0 comments on commit aab1ee2

Please sign in to comment.