Skip to content

Commit

Permalink
chore: rename to edge-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
promer94 committed Jun 30, 2022
1 parent f0a09c4 commit 9ec5f4e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/config/index.md
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/integrations/env/edge-runtime.ts
Expand Up @@ -3,7 +3,7 @@ import type { Environment } from '../../types'
import { populateGlobal } from './utils'

export default <Environment>({
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({
Expand Down
4 changes: 2 additions & 2 deletions packages/vitest/src/integrations/env/index.ts
Expand Up @@ -7,13 +7,13 @@ export const environments = {
node,
jsdom,
'happy-dom': happy,
edge,
'edge-runtime': edge,
}

export const envs = Object.keys(environments)

export const envNpm = {
'jsdom': 'jsdom',
'happy-dom': 'happy-dom',
'edge': '@edge-runtime/vm',
'edge-runtime': '@edge-runtime/vm',
}
2 changes: 1 addition & 1 deletion packages/vitest/src/types/config.ts
Expand Up @@ -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<CommonServerOptions, 'port' | 'strictPort' | 'host'>

Expand Down
2 changes: 1 addition & 1 deletion 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', () => {
Expand Down

0 comments on commit 9ec5f4e

Please sign in to comment.