chore: remove vitest global options (#9620)

This commit is contained in:
zoomdong 2022-08-12 13:05:13 +08:00 committed by GitHub
parent b1bbc5bcc0
commit 1cf5c78358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
66 changed files with 64 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import { describe, expect, test } from 'vitest'
import { beforeAll, describe, expect, test } from 'vitest'
import {
browserLogs,
findAssetFile,

View File

@ -1,4 +1,4 @@
import { describe, expect, test } from 'vitest'
import { beforeAll, describe, expect, test } from 'vitest'
import {
browserLogs,
findAssetFile,

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import {
browserErrors,
browserLogs,

View File

@ -1,4 +1,4 @@
import { describe, test } from 'vitest'
import { describe, expect, test } from 'vitest'
import { page } from '~utils'
describe('syntax preserve', () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { port } from './serve'
import { page } from '~utils'

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { port } from './serve'
import { page } from '~utils'

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { findAssetFile, getColor, isBuild, readManifest } from '~utils'
test('should load both stylesheets', async () => {

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { findAssetFile, getColor, isBuild, page, readManifest } from '~utils'
test('should load all stylesheets', async () => {

View File

@ -1,4 +1,5 @@
import { URL } from 'node:url'
import { describe, expect, test } from 'vitest'
import {
extractSourcemap,
formatSourcemapForSnapshot,

View File

@ -1,4 +1,5 @@
import { readFileSync } from 'node:fs'
import { expect, test } from 'vitest'
import {
editFile,
findAssetFile,

View File

@ -1,5 +1,6 @@
import path from 'node:path'
import { createServer } from 'vite'
import { expect, test } from 'vitest'
import { getBgColor, getColor, page, ports } from '~utils'
// Regression test for https://github.com/vitejs/vite/issues/4000

View File

@ -1,5 +1,6 @@
import path from 'node:path'
import { createServer } from 'vite'
import { expect, test } from 'vitest'
import { getColor, page, ports } from '~utils'
test('postcss config', async () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { findAssetFile, isBuild, page } from '~utils'
test('plain', async () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import viteConfig from '../vite.config'
import { page } from '~utils'

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { getColor, page, serverLogs, untilUpdated } from '~utils'
test('should load literal dynamic import', async () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, page } from '~utils'
const mode = isBuild ? `production` : `development`

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, page } from '~utils'
const mode = isBuild ? `production` : `development`

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { browserLogs, page } from '~utils'
test('should have no 404s', () => {

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { isBuild, page } from '~utils'
describe.runIf(isBuild)('build', () => {

View File

@ -1,3 +1,4 @@
import { test } from 'vitest'
import {
addFile,
editFile,

View File

@ -1,3 +1,4 @@
import { beforeAll, describe, expect, test } from 'vitest'
import testJSON from '../safe.json'
import { isServe, page, viteTestUrl } from '~utils'

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import {
addFile,
editFile,

View File

@ -1,3 +1,4 @@
import { beforeAll, describe, expect, it, test } from 'vitest'
import {
browserLogs,
editFile,

View File

@ -1,4 +1,5 @@
import { URL } from 'node:url'
import { expect, test } from 'vitest'
import {
extractSourcemap,
formatSourcemapForSnapshot,

View File

@ -1,4 +1,5 @@
import { readFileSync } from 'node:fs'
import { expect, test } from 'vitest'
import testJson from '../test.json'
import hmrJson from '../hmr.json'
import { editFile, isBuild, isServe, page, untilUpdated } from '~utils'

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import {
findAssetFile,
getColor,

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { port } from './serve'
import { isBuild, page } from '~utils'

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import {
isBuild,
isServe,

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { getColor, page, untilUpdated } from '~utils'
test('should have css applied on second dynamic import', async () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { page } from '~utils'
test('handle nested package', async () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import {
browserErrors,
browserLogs,

View File

@ -1,5 +1,6 @@
import { platform } from 'node:os'
import fetch from 'node-fetch'
import { expect, test } from 'vitest'
import { port } from './serve'
import { page, untilUpdated } from '~utils'

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { browserLogs, isBuild, page, viteTestUrl } from '~utils'
test('should have no 404s', () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { browserLogs, page } from '~utils'
test('should have no 404s', () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { editFile, isServe, page, untilUpdated } from '~utils'
test('should render', async () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { editFile, page, untilUpdated } from '~utils'
test('should render', async () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, serverLogs } from '~utils'
test.runIf(isBuild)('should not output sourcemap warning', () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { editFile, isServe, page, untilUpdated } from '~utils'
test('should render', async () => {

View File

@ -1,6 +1,7 @@
import fs from 'node:fs'
import path from 'node:path'
import { execaCommandSync } from 'execa'
import { describe, expect, it } from 'vitest'
import { isBuild, testDir, viteBinPath } from '~utils'
const fromTestDir = (...p: string[]) => path.resolve(testDir, ...p)

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, isWindows, page } from '~utils'
test('bom import', async () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { port } from './serve'
import { getColor, page } from '~utils'

View File

@ -1,4 +1,5 @@
import fetch from 'node-fetch'
import { describe, expect, test } from 'vitest'
import { port } from './serve'
import { page } from '~utils'

View File

@ -1,4 +1,5 @@
import fetch from 'node-fetch'
import { describe, expect, test } from 'vitest'
import { port } from './serve'
import { page } from '~utils'

View File

@ -1,4 +1,5 @@
import fetch from 'node-fetch'
import { expect, test } from 'vitest'
import { port } from './serve'
import { browserLogs, editFile, page, untilUpdated } from '~utils'

View File

@ -1,6 +1,7 @@
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import fetch from 'node-fetch'
import { expect, test, vi } from 'vitest'
import { port } from './serve'
import {
browserLogs,

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { port } from './serve'
import { findAssetFile, isBuild, page } from '~utils'

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, serverLogs } from '~utils'
test.runIf(!isBuild)('should not output missing source file warning', () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import {
browserLogs,
editFile,

View File

@ -1,9 +1,6 @@
// test utils used in e2e tests for playgrounds.
// `import { getColor } from '~utils'`
// TODO: explicitly import APIs and remove this
/// <reference types="vitest/globals"/>
import fs from 'node:fs'
import path from 'node:path'
import colors from 'css-color-names'

View File

@ -1,3 +1,4 @@
import { afterAll } from 'vitest'
import { startDefaultServe } from '~utils'
export let serveError: Error | undefined

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { clearServeError, serveError } from './serve'
import {
browserLogs,

View File

@ -1,6 +1,7 @@
import path from 'node:path'
import fs from 'node:fs'
import { transformWithEsbuild } from 'vite'
import { describe, expect, test } from 'vitest'
import { browserLogs } from '~utils'
test('should respected each `tsconfig.json`s compilerOptions', () => {

View File

@ -13,7 +13,7 @@
"skipLibCheck": true,
"noUnusedLocals": true,
"jsx": "preserve",
"types": ["vite/client", "vitest/globals", "node"],
"types": ["vite/client", "node"],
"paths": {
"~utils": ["./test-utils.ts"]
}

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { editFile, isServe, page, untilUpdated } from '~utils'
test('should render', async () => {

View File

@ -1,5 +1,6 @@
import path from 'node:path'
import { build } from 'vite'
import { describe, expect, test } from 'vitest'
import type { OutputChunk, RollupOutput } from 'rollup'
describe('vue component library', () => {

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, page } from '~utils'
test('should render', async () => {

View File

@ -1,4 +1,5 @@
import { URL } from 'node:url'
import { describe, expect, test } from 'vitest'
import {
extractSourcemap,
formatSourcemapForSnapshot,

View File

@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import {
browserLogs,
editFile,

View File

@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, page, untilUpdated } from '~utils'
test('should work when inlined', async () => {

View File

@ -1,5 +1,6 @@
import fs from 'node:fs'
import path from 'node:path'
import { describe, expect, test } from 'vitest'
import { isBuild, page, testDir, untilUpdated } from '~utils'
test('normal', async () => {

View File

@ -1,6 +1,6 @@
import fs from 'node:fs'
import path from 'node:path'
import { test } from 'vitest'
import { describe, expect, test } from 'vitest'
import { isBuild, page, testDir, untilUpdated } from '~utils'
test('normal', async () => {

View File

@ -1,5 +1,6 @@
import fs from 'node:fs'
import path from 'node:path'
import { describe, expect, test } from 'vitest'
import { isBuild, page, testDir, untilUpdated } from '~utils'
test('normal', async () => {

View File

@ -1,5 +1,6 @@
import fs from 'node:fs'
import path from 'node:path'
import { describe, expect, test } from 'vitest'
import { isBuild, testDir } from '~utils'
describe.runIf(isBuild)('build', () => {

View File

@ -1,5 +1,6 @@
import fs from 'node:fs'
import path from 'node:path'
import { describe, expect, test } from 'vitest'
import { isBuild, testDir } from '~utils'
describe.runIf(isBuild)('build', () => {

View File

@ -1,5 +1,6 @@
import fs from 'node:fs'
import path from 'node:path'
import { describe, expect, test } from 'vitest'
import { isBuild, testDir } from '~utils'
describe.runIf(isBuild)('build', () => {

View File

@ -15,7 +15,6 @@ export default defineConfig({
globalSetup: ['./playground/vitestGlobalSetup.ts'],
testTimeout: timeout,
hookTimeout: timeout,
globals: true,
reporters: 'dot',
onConsoleLog(log) {
if (log.match(/experimental|jit engine|emitted file|tailwind/i))