mirror of
https://github.com/vitejs/vite.git
synced 2024-11-22 07:09:05 +00:00
fix(tests): fix tests run fail in the Chinese directory (#3586)
This commit is contained in:
parent
4afb743547
commit
3cab2c2202
@ -48,7 +48,6 @@
|
||||
"rimraf": "^3.0.2",
|
||||
"semver": "^7.3.4",
|
||||
"sirv": "^1.0.10",
|
||||
"slash": "^3.0.0",
|
||||
"ts-jest": "^27.0.1",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.1.2",
|
||||
|
@ -4,10 +4,13 @@
|
||||
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import slash from 'slash'
|
||||
import colors from 'css-color-names'
|
||||
import { ElementHandle } from 'playwright-chromium'
|
||||
|
||||
export function slash(p: string): string {
|
||||
return p.replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
export const isBuild = !!process.env.VITE_TEST_BUILD
|
||||
|
||||
const testPath = expect.getState().testPath
|
||||
|
@ -2,10 +2,8 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
const slash = require('slash')
|
||||
const { parse } = require('@babel/parser')
|
||||
const MagicString = require('magic-string').default
|
||||
|
||||
const tempDir = path.resolve(__dirname, '../temp/node')
|
||||
const typesDir = path.resolve(__dirname, '../types')
|
||||
|
||||
@ -15,6 +13,10 @@ const typesDir = path.resolve(__dirname, '../types')
|
||||
walkDir(tempDir)
|
||||
console.log(chalk.green.bold(`patched types/* imports`))
|
||||
|
||||
function slash(p) {
|
||||
return p.replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} dir
|
||||
*/
|
||||
|
@ -1,13 +1,16 @@
|
||||
import fs from 'fs-extra'
|
||||
import * as http from 'http'
|
||||
import { resolve, dirname } from 'path'
|
||||
import slash from 'slash'
|
||||
import sirv from 'sirv'
|
||||
import { createServer, build, ViteDevServer, UserConfig } from 'vite'
|
||||
import { Page } from 'playwright-chromium'
|
||||
|
||||
const isBuildTest = !!process.env.VITE_TEST_BUILD
|
||||
|
||||
export function slash(p: string): string {
|
||||
return p.replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
// injected by the test env
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
|
Loading…
Reference in New Issue
Block a user