diff --git a/.vscode/launch.json b/.vscode/launch.json index dc423605..e6b8ebf4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -35,6 +35,16 @@ ], "outFiles": ["${workspaceFolder}/dist/**/*.js"] }, + { + "name": "Run Extension Imba Sample", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}", + "${workspaceFolder}/samples/imba" + ], + "outFiles": ["${workspaceFolder}/dist/**/*.js"] + }, { "name": "Run Extension No Config Sample", "type": "extensionHost", diff --git a/.vscode/settings.json b/.vscode/settings.json index 856e8978..b3ba467d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,7 +15,6 @@ "source.organizeImports": "never" }, - "vitest.workspaceConfig": "./vitest.workspace.vscode.ts", "testing.openTesting": "neverOpen", // Enable eslint for all supported languages diff --git a/README.md b/README.md index 50dbf1ef..c1f94309 100644 --- a/README.md +++ b/README.md @@ -73,11 +73,11 @@ These options are resolved relative to the [workspace file](https://code.visuals - `vitest.rootConfig`: The path to your root config file. If you have several Vitest configs, consider using a [Vitest workspace](https://vitest.dev/guide/workspace). - `vitest.workspaceConfig`: The path to the [Vitest workspace](https://vitest.dev/guide/workspace) config file. You can only have a single workspace config per VSCode workspace. - `vitest.configSearchPatternExclude`: [Glob pattern](https://code.visualstudio.com/docs/editor/glob-patterns) that should be ignored when this extension looks for config files. Note that this is applied to _config_ files, not test files inside configs. Default: `{**/node_modules/**,**/.*/**,*.d.ts}`. If the extension cannot find Vitest, please open an issue. -- `vitest.shellType`: The method the extension uses to spawn a long-running Vitest process. This is particularly useful if you are using a custom shell script to set up the environment. When using the `terminal` shell type, the websocket connection will be established. Can either be `terminal` or `child_process`. Default: `child process`. -- `vitest.nodeExecutable`: The path to the Node.js executable. If not assigned, tries to find Node.js path via a PATH variable or a `which` command. This is applied only when `vitest.shellType` is `child_process` (the default). -- `vitest.nodeExecArgs`: The arguments to pass to the Node.js executable. This is applied only when `vitest.shellType` is `child_process` (the default). -- `vitest.terminalShellPath`: The path to the shell executable. This is applied only when `vitest.shellType` is `terminal`. -- `vitest.terminalShellArgs`: The arguments to pass to the shell executable. This is applied only when `vitest.shellType` is `terminal`. +- `vitest.shellType`: The method the extension uses to spawn a long-running Vitest process. This is particularly useful if you are using a custom shell script to set up the environment. When using the `terminal` shell type, the websocket connection will be established. Can either be `terminal` or `child_process`. Default: `terminal`. +- `vitest.nodeExecutable`: The path to the Node.js executable. If not assigned, tries to find Node.js path via a PATH variable or a `which` command. This is applied only when `vitest.shellType` is `child_process`. +- `vitest.nodeExecArgs`: The arguments to pass to the Node.js executable. This is applied only when `vitest.shellType` is `child_process`. +- `vitest.terminalShellPath`: The path to the shell executable. This is applied only when `vitest.shellType` is `terminal` (the default). +- `vitest.terminalShellArgs`: The arguments to pass to the shell executable. This is applied only when `vitest.shellType` is `terminal` (the default). - `vitest.debuggerPort`: Port that the debugger will be attached to. By default uses 9229 or tries to find a free port if it's not available. - `vitest.debuggerAddress`: TCP/IP address of process to be debugged. Default: localhost - `vitest.cliArguments`: Additional arguments to pass to the Vitest CLI. Note that some arguments will be ignored: `watch`, `reporter`, `api`, and `ui`. Example: `--mode=staging` diff --git a/package.json b/package.json index 99ff4db2..9639b44f 100644 --- a/package.json +++ b/package.json @@ -211,7 +211,7 @@ "terminal", "child_process" ], - "default": "child_process", + "default": "terminal", "scope": "resource" }, "vitest.terminalShellPath": { diff --git a/samples/vite-6/.skip/vitest.config.ts b/samples/vite-6/.skip/vitest.config.ts deleted file mode 100644 index 91480683..00000000 --- a/samples/vite-6/.skip/vitest.config.ts +++ /dev/null @@ -1 +0,0 @@ -throw new Error('do not import') \ No newline at end of file diff --git a/samples/vite-6/.vscode/settings.json b/samples/vite-6/.vscode/settings.json deleted file mode 100644 index 0842d6a8..00000000 --- a/samples/vite-6/.vscode/settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "vitest.nodeEnv": { - "TEST_CUSTOM_ENV": "hello" - }, - "vitest.experimentalStaticAstCollect": true, - "[typescript]": { - "editor.defaultFormatter": "dbaeumer.vscode-eslint" - } -} diff --git a/samples/vite-6/package.json b/samples/vite-6/package.json deleted file mode 100644 index 95819dd3..00000000 --- a/samples/vite-6/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "vite-6", - "version": "1.0.0", - "description": "", - "author": "", - "license": "ISC", - "main": "index.js", - "scripts": { - "test": "vitest run" - }, - "devDependencies": { - "vite": "catalog:", - "vitest": "catalog:" - } -} diff --git a/samples/vite-6/test/fail.test.ts b/samples/vite-6/test/fail.test.ts deleted file mode 100644 index 353ad6ff..00000000 --- a/samples/vite-6/test/fail.test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { expect, it } from 'vitest' - -it('all-fail', () => { - expect(0).toBe(1) -}) diff --git a/samples/vite-6/test/mix.test.ts b/samples/vite-6/test/mix.test.ts deleted file mode 100644 index 32c11c8a..00000000 --- a/samples/vite-6/test/mix.test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { expect, it } from 'vitest' - -it('mix-pass', () => { - expect(0).toBe(0) -}) - -it('mix-fail', () => { - expect(0).toBe(1) -}) diff --git a/samples/vite-6/test/pass.test.ts b/samples/vite-6/test/pass.test.ts deleted file mode 100644 index 44efd036..00000000 --- a/samples/vite-6/test/pass.test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { expect, it } from 'vitest' - -it('all-pass', () => { - expect(0).toBe(0) -}) diff --git a/samples/vite-6/vite.config.ts b/samples/vite-6/vite.config.ts deleted file mode 100644 index c55daa96..00000000 --- a/samples/vite-6/vite.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default function () { - throw new Error('This file should not be executed') -} \ No newline at end of file diff --git a/samples/vite-6/vitest.config.d.ts b/samples/vite-6/vitest.config.d.ts deleted file mode 100644 index 5576c97e..00000000 --- a/samples/vite-6/vitest.config.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare const ts: true - -// @ts-expect-error this is just a test -throw new Error('This file should not be included by default.') diff --git a/samples/vite-6/vitest.config.ts b/samples/vite-6/vitest.config.ts deleted file mode 100644 index eeae7f53..00000000 --- a/samples/vite-6/vitest.config.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -// Configure Vitest (https://vitest.dev/config) - -import { defineConfig } from 'vite' - -export default defineConfig({ - esbuild: { - target: 'es2022', - }, - test: { - include: ['src/should_included_test.ts', 'test/**/*.test.ts'], - exclude: ['test/ignored.test.ts'], - }, -}) diff --git a/src/config.ts b/src/config.ts index dac2cd75..7ce92f23 100644 --- a/src/config.ts +++ b/src/config.ts @@ -56,7 +56,7 @@ export function getConfig(workspaceFolder?: WorkspaceFolder) { const terminalShellArgs = get('terminalShellArgs') const terminalShellPath = get('terminalShellPath') - const shellType = get<'child_process' | 'terminal'>('shellType', 'child_process')! + const shellType = get<'child_process' | 'terminal'>('shellType', 'terminal')! const nodeExecArgs = get('nodeExecArgs') const experimentalStaticAstCollect = get('experimentalStaticAstCollect', false)! diff --git a/test/e2e/basic.test.ts b/test/e2e/basic.test.ts index af2c21de..5591fa69 100644 --- a/test/e2e/basic.test.ts +++ b/test/e2e/basic.test.ts @@ -67,52 +67,6 @@ test('basic', async ({ launch }) => { }) }) -test('vite-6', async ({ launch }) => { - const { page, tester } = await launch({ - workspacePath: './samples/vite-6', - }) - - await expect(page.getByText('No test results yet.')).toBeVisible() - - await tester.tree.expand('test') - await tester.tree.expand('test/pass.test.ts') - await tester.tree.expand('test/fail.test.ts') - await tester.tree.expand('test/mix.test.ts') - - const allPassTests = tester.tree.getFileItem('pass.test.ts') - await expect(allPassTests).toHaveTests({ - 'all-pass': 'waiting', - }) - - const allFailTests = tester.tree.getFileItem('fail.test.ts') - await expect(allFailTests).toHaveTests({ - 'all-fail': 'waiting', - }) - - const mixedTests = tester.tree.getFileItem('mix.test.ts') - await expect(mixedTests).toHaveTests({ - 'mix-pass': 'waiting', - 'mix-fail': 'waiting', - }) - - await tester.runAllTests() - - await expect(tester.tree.getResultsLocator()).toHaveText('2/4') - await expect(allPassTests).toHaveState('passed') - await expect(allPassTests).toHaveTests({ - 'all-pass': 'passed', - }) - await expect(allFailTests).toHaveState('failed') - await expect(allFailTests).toHaveTests({ - 'all-fail': 'failed', - }) - await expect(mixedTests).toHaveState('failed') - await expect(mixedTests).toHaveTests({ - 'mix-pass': 'passed', - 'mix-fail': 'failed', - }) -}) - test('workspaces', async ({ launch }) => { const { tester } = await launch({ workspacePath: './samples/monorepo-vitest-workspace',