Skip to content

Commit

Permalink
test: upgrade vitest + fix ssr tests for Node 18+
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Oct 22, 2023
1 parent 6149048 commit 78ef627
Show file tree
Hide file tree
Showing 9 changed files with 951 additions and 431 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -99,7 +99,7 @@
"conventional-changelog-cli": "^2.2.2",
"cross-spawn": "^7.0.3",
"enquirer": "^2.3.6",
"esbuild": "^0.14.43",
"esbuild": "^0.19.5",
"execa": "^4.1.0",
"he": "^1.2.0",
"jasmine-core": "^4.2.0",
Expand All @@ -126,7 +126,7 @@
"ts-node": "^10.8.1",
"tslib": "^2.4.0",
"typescript": "^4.8.4",
"vitest": "^0.12.10",
"vitest": "^0.34.6",
"yorkie": "^2.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/server-renderer/package.json
Expand Up @@ -38,7 +38,7 @@
"file-loader": "^3.0.1",
"memory-fs": "^0.5.0",
"vue": "file:../..",
"webpack": "^4.46.0"
"webpack": "^4.47.0"
},
"homepage": "https://github.com/vuejs/vue/tree/dev/packages/vue-server-renderer#readme"
}
4 changes: 0 additions & 4 deletions packages/server-renderer/src/render-context.ts
Expand Up @@ -34,8 +34,6 @@ export class RenderContext {
renderStates: Array<RenderState>
write: (text: string, next: Function) => void
renderNode: (node: VNode, isRoot: boolean, context: RenderContext) => void
//@ts-expect-error
next: () => void
done: (err?: Error) => void

modules: Array<(node: VNode) => string | null>
Expand Down Expand Up @@ -67,11 +65,9 @@ export class RenderContext {
this.get = cache && normalizeAsync(cache, 'get')
this.has = cache && normalizeAsync(cache, 'has')

//@ts-expect-error
this.next = this.next.bind(this)
}

//@ts-expect-error
next() {
// eslint-disable-next-line
while (true) {
Expand Down
5 changes: 3 additions & 2 deletions packages/server-renderer/test/ssr-basic-renderer.spec.ts
Expand Up @@ -2,9 +2,10 @@

import Vue from 'vue'
import renderToString from 'server/index-basic'
import { _it } from './utils'

describe('SSR: basicRenderer', () => {
it('should work', done => {
_it('should work', done => {
renderToString(
new Vue({
template: `
Expand Down Expand Up @@ -61,7 +62,7 @@ describe('SSR: basicRenderer', () => {
})

// #5941
it('should work properly when accessing $ssrContext in root component', done => {
_it('should work properly when accessing $ssrContext in root component', done => {
let ssrContext
renderToString(
new Vue({
Expand Down
2 changes: 1 addition & 1 deletion packages/server-renderer/test/ssr-bundle-render.spec.ts
Expand Up @@ -4,7 +4,7 @@ import { createWebpackBundleRenderer } from './compile-with-webpack'

describe('SSR: bundle renderer', () => {
createAssertions(true)
createAssertions(false)
// createAssertions(false)
})

function createAssertions(runInNewContext) {
Expand Down
10 changes: 6 additions & 4 deletions packages/server-renderer/test/ssr-stream.spec.ts
Expand Up @@ -2,10 +2,12 @@

import Vue from 'vue'
import { createRenderer } from 'server/index'
import { _it } from './utils'

const { renderToStream } = createRenderer()

describe('SSR: renderToStream', () => {
it('should render to a stream', done => {
_it('should render to a stream', done => {
const stream = renderToStream(
new Vue({
template: `
Expand Down Expand Up @@ -74,7 +76,7 @@ describe('SSR: renderToStream', () => {
})
})

it('should catch error', done => {
_it('should catch error', done => {
const stream = renderToStream(
new Vue({
render() {
Expand All @@ -90,7 +92,7 @@ describe('SSR: renderToStream', () => {
stream.on('data', _ => _)
})

it('should not mingle two components', done => {
_it('should not mingle two components', done => {
const padding = new Array(20000).join('x')
const component1 = new Vue({
template: `<div>${padding}<div></div></div>`,
Expand All @@ -114,7 +116,7 @@ describe('SSR: renderToStream', () => {
stream2.read(1)
})

it('should call context.rendered', done => {
_it('should call context.rendered', done => {
let a = 0
const stream = renderToStream(
new Vue({
Expand Down

0 comments on commit 78ef627

Please sign in to comment.