From be8d479bf55488051d496fe5249fc73e4a164eb2 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Fri, 6 Dec 2024 09:30:04 +0100 Subject: [PATCH] feat: expose versions from `vitest/node` entry point and statically on Vitest (#7029) --- packages/vitest/src/node/core.ts | 3 ++- packages/vitest/src/public/node.ts | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/vitest/src/node/core.ts b/packages/vitest/src/node/core.ts index c7b84a1e3ce2..737db1bf172e 100644 --- a/packages/vitest/src/node/core.ts +++ b/packages/vitest/src/node/core.ts @@ -48,7 +48,8 @@ export interface VitestOptions { } export class Vitest { - version = version + public readonly version = version + static readonly version = version config: ResolvedConfig = undefined! configOverride: Partial = {} diff --git a/packages/vitest/src/public/node.ts b/packages/vitest/src/public/node.ts index 9f8c5992fc2d..edb086a81e57 100644 --- a/packages/vitest/src/public/node.ts +++ b/packages/vitest/src/public/node.ts @@ -1,7 +1,10 @@ import type { ModuleDiagnostic as _FileDiagnostic } from '../node/reporters/reported-tasks' import { createServer as _createServer } from 'vite' +import { Vitest } from '../node/core' import { TestModule as _TestFile } from '../node/reporters/reported-tasks' +export const version = Vitest.version + export { parseCLI } from '../node/cli/cac' export { startVitest } from '../node/cli/cli-api' export { resolveApiServerConfig, resolveConfig } from '../node/config/resolveConfig' @@ -135,9 +138,12 @@ export type { export { createDebugger } from '../utils/debugger' export { + esbuildVersion, isFileServingAllowed, parseAst, parseAstAsync, + rollupVersion, + version as viteVersion, } from 'vite' export type * as Vite from 'vite'