You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I have a test using child_process, the test run and inside the extension explorer, but at a moment, the ui restart, and the test never stops.
Remarque: The test using child_process runs fine when I launch the debug.
Reproduction
The function to test
import{mkdir,rename,writeFile}from'node:fs/promises';import{basename,join}from'node:path';import{spawnSync}from'node:child_process';import{projectPackage}from'./helpers';/** * Build a inner project with custom package.json to test some types with tsd * @param indexFile the files that will be generated to index the project * @param relativeDir The relative path to the project * @param projectName : The name of the project */exportdefaultasyncfunctioncreateProject(indexFile: string,relativeDir: string,projectName?: string,){constdir=join(process.cwd(),relativeDir);awaitmkdir(dir);constjson=projectPackage(projectName);constpackageFile=join(dir,'package.json');awaitwriteFile(packageFile,JSON.stringify(json,null,2),{encoding: 'utf-8',});consttscFile=`./"${indexFile}"`;spawnSync('pnpm tsup',[tscFile,'--format','esm','--dts','--outDir',relativeDir,'--minify','--no-sourcemap','--target','esnext',],{env: process.env,stdio: 'inherit',shell: true,encoding: 'buffer',},);constdeclaration=basename(indexFile.replace('.ts','.d.ts'));constresolvedDeclarationFile=join(dir,declaration);constresolvedJsFile=resolvedDeclarationFile.replace('.d.ts','.js');awaitrename(resolvedDeclarationFile,join(dir,'index.d.ts'));awaitrename(resolvedJsFile,join(dir,'index.js'));awaitwriteFile(join(dir,'index.test-d.ts'),'');}
The test file :
import{rm,writeFile}from'node:fs/promises';import{join}from'node:path';importtsd,{formatter}from'tsd';importcreateProjectfrom'./createProject';constBUILD_DIR='build-test';constTEST_TIMEOUT=10_000;describe('createProject',()=>{test('#1 => Create the project',()=>createProject('src/helpers.ts',BUILD_DIR),TEST_TIMEOUT,);test('#2 => Create the test',()=>{constwrite='import { expectAssignable } from "tsd"; import { projectPackage } from "./index"; expectAssignable<string>(projectPackage().name);';returnwriteFile(join(process.cwd(),BUILD_DIR,'index.test-d.ts'),write,);},TEST_TIMEOUT,);test('#3 => Test tsd',async()=>{const_tsd=awaittsd({cwd: BUILD_DIR,});constfd=formatter(_tsd);expect(fd).toBe('');},TEST_TIMEOUT,);});beforeAll(()=>{returnrm(BUILD_DIR,{recursive: true,force: true});});afterAll(()=>{returnrm(BUILD_DIR,{recursive: true,force: true});});
Output
[INFO 14:52:34] [v0.12.0] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 14:52:34] [API] Running Vitest v1.6.0 (tsd-cli/vitest.config.ts) with Node.js: /Users/chlbri/.nvm/versions/node/v20.9.0/lib/node_modules/npm/pnpm/node
[INFO 14:52:35] [API] Vitest v1.6.0 (tsd-cli/vitest.config.ts) process 42207 created
[INFO 14:52:35] [API] Collecting tests: src/createProject.test.ts
[INFO 14:52:38] Running 1 file(s) with name pattern: ^\s?createProject
[Worker] Collecting tests due to file changes: build-test/package.json
[Worker] CLI Building entry: ./src/helpers.ts
[Worker] CLI Using tsconfig: tsconfig.json
[Worker] CLI tsup v8.1.0
[Worker] CLI Target: esnext
[Worker] ESM Build start
[Worker] ESM build-test/helpers.js 402.00 B
[Worker] ESM ⚡️ Build success in 39ms
[Worker] DTS Build start
[Worker] DTS ⚡️ Build success in 571ms
[Worker] DTS build-test/helpers.d.ts 461.00 B
[INFO 14:52:40] [API] Vitest process 42207 closed successfully
[INFO 14:52:40] [API] Running Vitest v1.6.0 (tsd-cli/vitest.config.ts) with Node.js: /Users/chlbri/.nvm/versions/node/v20.9.0/lib/node_modules/npm/pnpm/node
[INFO 14:52:40] [API] Vitest v1.6.0 (tsd-cli/vitest.config.ts) process 42301 created
[INFO 14:52:40] [API] Collecting tests: src/createProject.test.ts
MY-COMMENT - ///And it stops here
Version
v0.12.0
Validations
Check that you are using the latest version of the extension
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Describe the bug
When I have a test using child_process, the test run and inside the extension explorer, but at a moment, the ui restart, and the test never stops.
Remarque: The test using child_process runs fine when I launch the debug.
Reproduction
The function to test
The test file :
Output
Version
v0.12.0
Validations
The text was updated successfully, but these errors were encountered: