mirror of https://github.com/nodejs/corepack.git
				
				
				
			chore(tests): remove temporary directories in test teardown (#666)
This commit is contained in:
		
							parent
							
								
									b0608d1a60
								
							
						
					
					
						commit
						bb16184b7b
					
				|  | @ -5,9 +5,15 @@ import {describe, beforeEach, it, expect} from 'vitest'; | |||
| import {runCli}                           from './_runCli'; | ||||
| 
 | ||||
| beforeEach(async () => { | ||||
|   const home = await xfs.mktempPromise(); | ||||
| 
 | ||||
|   // `process.env` is reset after each tests in setupTests.js.
 | ||||
|   process.env.COREPACK_HOME = npath.fromPortablePath(await xfs.mktempPromise()); | ||||
|   process.env.COREPACK_HOME = npath.fromPortablePath(home); | ||||
|   process.env.COREPACK_DEFAULT_TO_LATEST = `0`; | ||||
| 
 | ||||
|   return async () => { | ||||
|     await xfs.removePromise(home, {recursive: true}); | ||||
|   }; | ||||
| }); | ||||
| 
 | ||||
| describe(`UpCommand`, () => { | ||||
|  |  | |||
|  | @ -5,9 +5,15 @@ import {describe, beforeEach, it, expect} from 'vitest'; | |||
| import {runCli}                           from './_runCli'; | ||||
| 
 | ||||
| beforeEach(async () => { | ||||
|   const home = await xfs.mktempPromise(); | ||||
| 
 | ||||
|   // `process.env` is reset after each tests in setupTests.js.
 | ||||
|   process.env.COREPACK_HOME = npath.fromPortablePath(await xfs.mktempPromise()); | ||||
|   process.env.COREPACK_HOME = npath.fromPortablePath(home); | ||||
|   process.env.COREPACK_DEFAULT_TO_LATEST = `0`; | ||||
| 
 | ||||
|   return async () => { | ||||
|     await xfs.removePromise(home, {recursive: true}); | ||||
|   }; | ||||
| }); | ||||
| 
 | ||||
| describe(`UseCommand`, () => { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue