From 9ec5f4e9815255b0abce1ecd1012d96438847198 Mon Sep 17 00:00:00 2001 From: Yixuan Xu Date: Thu, 30 Jun 2022 21:48:24 +0800 Subject: [PATCH] chore: rename to edge-runtime --- docs/config/index.md | 4 ++-- packages/vitest/src/integrations/env/edge-runtime.ts | 2 +- packages/vitest/src/integrations/env/index.ts | 4 ++-- packages/vitest/src/types/config.ts | 2 +- test/vite-edge/test/edge.test.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/config/index.md b/docs/config/index.md index f0bf05973d39..381d570f495a 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -153,14 +153,14 @@ export default defineConfig({ ### environment -- **Type:** `'node' | 'jsdom' | 'happy-dom' | 'edge'` +- **Type:** `'node' | 'jsdom' | 'happy-dom' | 'edge-runtime'` - **Default:** `'node'` The environment that will be used for testing. The default environment in Vitest is a Node.js environment. If you are building a web application, you can use browser-like environment through either [`jsdom`](https://github.com/jsdom/jsdom) or [`happy-dom`](https://github.com/capricorn86/happy-dom) instead. -If you are building edge functions, you can use [`edge`](https://edge-runtime.vercel.app/packages/vm) environment +If you are building edge functions, you can use [`edge-runtime`](https://edge-runtime.vercel.app/packages/vm) environment By adding a `@vitest-environment` docblock or comment at the top of the file, you can specify another environment to be used for all tests in that file: diff --git a/packages/vitest/src/integrations/env/edge-runtime.ts b/packages/vitest/src/integrations/env/edge-runtime.ts index 23ea33cb2304..e65db7fbf3ca 100644 --- a/packages/vitest/src/integrations/env/edge-runtime.ts +++ b/packages/vitest/src/integrations/env/edge-runtime.ts @@ -3,7 +3,7 @@ import type { Environment } from '../../types' import { populateGlobal } from './utils' export default ({ - name: 'edge', + name: 'edge-runtime', async setup(global) { const { EdgeVM } = await importModule('@edge-runtime/vm') as typeof import('@edge-runtime/vm') const vm = new EdgeVM({ diff --git a/packages/vitest/src/integrations/env/index.ts b/packages/vitest/src/integrations/env/index.ts index 7f35d7337cfd..2c4c693b9533 100644 --- a/packages/vitest/src/integrations/env/index.ts +++ b/packages/vitest/src/integrations/env/index.ts @@ -7,7 +7,7 @@ export const environments = { node, jsdom, 'happy-dom': happy, - edge, + 'edge-runtime': edge, } export const envs = Object.keys(environments) @@ -15,5 +15,5 @@ export const envs = Object.keys(environments) export const envNpm = { 'jsdom': 'jsdom', 'happy-dom': 'happy-dom', - 'edge': '@edge-runtime/vm', + 'edge-runtime': '@edge-runtime/vm', } diff --git a/packages/vitest/src/types/config.ts b/packages/vitest/src/types/config.ts index 816270263b83..983aa944d113 100644 --- a/packages/vitest/src/types/config.ts +++ b/packages/vitest/src/types/config.ts @@ -8,7 +8,7 @@ import type { Reporter } from './reporter' import type { SnapshotStateOptions } from './snapshot' import type { Arrayable } from './general' -export type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge' +export type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime' export type ApiConfig = Pick diff --git a/test/vite-edge/test/edge.test.ts b/test/vite-edge/test/edge.test.ts index d6c52c9422d8..3d20a70d50f0 100644 --- a/test/vite-edge/test/edge.test.ts +++ b/test/vite-edge/test/edge.test.ts @@ -1,5 +1,5 @@ /** - * @vitest-environment edge + * @vitest-environment edge-runtime */ import { describe, expect, it } from 'vitest' describe('edge runtime api', () => {