Skip to content

Commit

Permalink
chore: remove vitest global options (#9620)
Browse files Browse the repository at this point in the history
  • Loading branch information
fireairforce committed Aug 12, 2022
1 parent b1bbc5b commit 1cf5c78
Show file tree
Hide file tree
Showing 66 changed files with 64 additions and 9 deletions.
@@ -1,4 +1,4 @@
import { describe, expect, test } from 'vitest'
import { beforeAll, describe, expect, test } from 'vitest'
import {
browserLogs,
findAssetFile,
Expand Down
@@ -1,4 +1,4 @@
import { describe, expect, test } from 'vitest'
import { beforeAll, describe, expect, test } from 'vitest'
import {
browserLogs,
findAssetFile,
Expand Down
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import {
browserErrors,
browserLogs,
Expand Down
2 changes: 1 addition & 1 deletion playground/build-old/__tests__/build-old.spec.ts
@@ -1,4 +1,4 @@
import { describe, test } from 'vitest'
import { describe, expect, test } from 'vitest'
import { page } from '~utils'

describe('syntax preserve', () => {
Expand Down
1 change: 1 addition & 0 deletions playground/cli-module/__tests__/cli-module.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { port } from './serve'
import { page } from '~utils'

Expand Down
1 change: 1 addition & 0 deletions playground/cli/__tests__/cli.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { port } from './serve'
import { page } from '~utils'

Expand Down
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { findAssetFile, getColor, isBuild, readManifest } from '~utils'

test('should load both stylesheets', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/css-codesplit/__tests__/css-codesplit.spec.ts
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { findAssetFile, getColor, isBuild, page, readManifest } from '~utils'

test('should load all stylesheets', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/css-sourcemap/__tests__/css-sourcemap.spec.ts
@@ -1,4 +1,5 @@
import { URL } from 'node:url'
import { describe, expect, test } from 'vitest'
import {
extractSourcemap,
formatSourcemapForSnapshot,
Expand Down
1 change: 1 addition & 0 deletions playground/css/__tests__/css.spec.ts
@@ -1,4 +1,5 @@
import { readFileSync } from 'node:fs'
import { expect, test } from 'vitest'
import {
editFile,
findAssetFile,
Expand Down
@@ -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
Expand Down
1 change: 1 addition & 0 deletions playground/css/postcss-caching/css.spec.ts
@@ -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 () => {
Expand Down
1 change: 1 addition & 0 deletions playground/data-uri/__tests__/data-uri.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { findAssetFile, isBuild, page } from '~utils'

test('plain', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/define/__tests__/define.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import viteConfig from '../vite.config'
import { page } from '~utils'

Expand Down
1 change: 1 addition & 0 deletions playground/dynamic-import/__tests__/dynamic-import.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { getColor, page, serverLogs, untilUpdated } from '~utils'

test('should load literal dynamic import', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/env-nested/__tests__/env-nested.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, page } from '~utils'

const mode = isBuild ? `production` : `development`
Expand Down
1 change: 1 addition & 0 deletions playground/env/__tests__/env.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, page } from '~utils'

const mode = isBuild ? `production` : `development`
Expand Down
1 change: 1 addition & 0 deletions playground/extensions/__tests__/extensions.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { browserLogs, page } from '~utils'

test('should have no 404s', () => {
Expand Down
1 change: 1 addition & 0 deletions playground/external/__tests__/external.spec.ts
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { isBuild, page } from '~utils'

describe.runIf(isBuild)('build', () => {
Expand Down
@@ -1,3 +1,4 @@
import { test } from 'vitest'
import {
addFile,
editFile,
Expand Down
1 change: 1 addition & 0 deletions playground/fs-serve/__tests__/fs-serve.spec.ts
@@ -1,3 +1,4 @@
import { beforeAll, describe, expect, test } from 'vitest'
import testJSON from '../safe.json'
import { isServe, page, viteTestUrl } from '~utils'

Expand Down
1 change: 1 addition & 0 deletions playground/glob-import/__tests__/glob-import.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import {
addFile,
editFile,
Expand Down
1 change: 1 addition & 0 deletions playground/hmr/__tests__/hmr.spec.ts
@@ -1,3 +1,4 @@
import { beforeAll, describe, expect, it, test } from 'vitest'
import {
browserLogs,
editFile,
Expand Down
1 change: 1 addition & 0 deletions playground/js-sourcemap/__tests__/js-sourcemap.spec.ts
@@ -1,4 +1,5 @@
import { URL } from 'node:url'
import { expect, test } from 'vitest'
import {
extractSourcemap,
formatSourcemapForSnapshot,
Expand Down
1 change: 1 addition & 0 deletions playground/json/__tests__/json.spec.ts
@@ -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'
Expand Down
1 change: 1 addition & 0 deletions playground/legacy/__tests__/legacy.spec.ts
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import {
findAssetFile,
getColor,
Expand Down
1 change: 1 addition & 0 deletions playground/legacy/__tests__/ssr/legacy-ssr.spec.ts
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { port } from './serve'
import { isBuild, page } from '~utils'

Expand Down
1 change: 1 addition & 0 deletions playground/lib/__tests__/lib.spec.ts
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import {
isBuild,
isServe,
Expand Down
@@ -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 () => {
Expand Down
1 change: 1 addition & 0 deletions playground/nested-deps/__tests__/nested-deps.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { page } from '~utils'

test('handle nested package', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/optimize-deps/__tests__/optimize-deps.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import {
browserErrors,
browserLogs,
Expand Down
@@ -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'

Expand Down
1 change: 1 addition & 0 deletions playground/preload/__tests__/preload.spec.ts
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { browserLogs, isBuild, page, viteTestUrl } from '~utils'

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

test('should have no 404s', () => {
Expand Down
1 change: 1 addition & 0 deletions playground/react-classic/__tests__/react.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { editFile, isServe, page, untilUpdated } from '~utils'

test('should render', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/react-emotion/__tests__/react.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { editFile, page, untilUpdated } from '~utils'

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

test.runIf(isBuild)('should not output sourcemap warning', () => {
Expand Down
1 change: 1 addition & 0 deletions playground/react/__tests__/react.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { editFile, isServe, page, untilUpdated } from '~utils'

test('should render', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/resolve-config/__tests__/resolve-config.spec.ts
@@ -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)
Expand Down
1 change: 1 addition & 0 deletions playground/resolve/__tests__/resolve.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, isWindows, page } from '~utils'

test('bom import', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/ssr-deps/__tests__/ssr-deps.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { port } from './serve'
import { getColor, page } from '~utils'

Expand Down
1 change: 1 addition & 0 deletions playground/ssr-html/__tests__/ssr-html.spec.ts
@@ -1,4 +1,5 @@
import fetch from 'node-fetch'
import { describe, expect, test } from 'vitest'
import { port } from './serve'
import { page } from '~utils'

Expand Down
1 change: 1 addition & 0 deletions playground/ssr-pug/__tests__/ssr-pug.spec.ts
@@ -1,4 +1,5 @@
import fetch from 'node-fetch'
import { describe, expect, test } from 'vitest'
import { port } from './serve'
import { page } from '~utils'

Expand Down
1 change: 1 addition & 0 deletions playground/ssr-react/__tests__/ssr-react.spec.ts
@@ -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'

Expand Down
1 change: 1 addition & 0 deletions playground/ssr-vue/__tests__/ssr-vue.spec.ts
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions playground/ssr-webworker/__tests__/ssr-webworker.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { port } from './serve'
import { findAssetFile, isBuild, page } from '~utils'

Expand Down
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, serverLogs } from '~utils'

test.runIf(!isBuild)('should not output missing source file warning', () => {
Expand Down
1 change: 1 addition & 0 deletions playground/tailwind/__test__/tailwind.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import {
browserLogs,
editFile,
Expand Down
3 changes: 0 additions & 3 deletions playground/test-utils.ts
@@ -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'
Expand Down
1 change: 1 addition & 0 deletions playground/tsconfig-json-load-error/__tests__/serve.ts
@@ -1,3 +1,4 @@
import { afterAll } from 'vitest'
import { startDefaultServe } from '~utils'

export let serveError: Error | undefined
Expand Down
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { clearServeError, serveError } from './serve'
import {
browserLogs,
Expand Down
1 change: 1 addition & 0 deletions playground/tsconfig-json/__tests__/tsconfig-json.spec.ts
@@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion playground/tsconfig.json
Expand Up @@ -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"]
}
Expand Down
1 change: 1 addition & 0 deletions playground/vue-jsx/__tests__/vue-jsx.spec.ts
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import { editFile, isServe, page, untilUpdated } from '~utils'

test('should render', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/vue-lib/__tests__/vue-lib.spec.ts
@@ -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', () => {
Expand Down
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, page } from '~utils'

test('should render', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/vue-sourcemap/__tests__/vue-sourcemap.spec.ts
@@ -1,4 +1,5 @@
import { URL } from 'node:url'
import { describe, expect, test } from 'vitest'
import {
extractSourcemap,
formatSourcemapForSnapshot,
Expand Down
1 change: 1 addition & 0 deletions playground/vue/__tests__/vue.spec.ts
@@ -1,3 +1,4 @@
import { describe, expect, test } from 'vitest'
import {
browserLogs,
editFile,
Expand Down
1 change: 1 addition & 0 deletions playground/wasm/__tests__/wasm.spec.ts
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest'
import { isBuild, page, untilUpdated } from '~utils'

test('should work when inlined', async () => {
Expand Down
1 change: 1 addition & 0 deletions playground/worker/__tests__/es/es-worker.spec.ts
@@ -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 () => {
Expand Down
2 changes: 1 addition & 1 deletion playground/worker/__tests__/iife/iife-worker.spec.ts
@@ -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 () => {
Expand Down
@@ -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 () => {
Expand Down
@@ -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', () => {
Expand Down
@@ -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', () => {
Expand Down
@@ -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', () => {
Expand Down
1 change: 0 additions & 1 deletion vitest.config.e2e.ts
Expand Up @@ -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))
Expand Down

0 comments on commit 1cf5c78

Please sign in to comment.