@@ -36,7 +36,7 @@ jest.unstable_mockModule("@actions/core", () => ({
3636
3737const { CacheLocalSource, loadInputs } = await import ( "../../src/utils/inputs" ) ;
3838
39- function createTempProject ( files : Record < string , string > ) : string {
39+ function createTempProject ( files : Record < string , string > = { } ) : string {
4040 const dir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , "setup-uv-inputs-test-" ) ) ;
4141 tempDirs . push ( dir ) ;
4242
@@ -60,11 +60,8 @@ function resetEnvironment(): void {
6060}
6161
6262function restoreEnvironment ( ) : void {
63- while ( tempDirs . length > 0 ) {
64- const dir = tempDirs . pop ( ) ;
65- if ( dir !== undefined ) {
66- fs . rmSync ( dir , { force : true , recursive : true } ) ;
67- }
63+ for ( const dir of tempDirs . splice ( 0 ) ) {
64+ fs . rmSync ( dir , { force : true , recursive : true } ) ;
6865 }
6966
7067 process . env . HOME = ORIGINAL_HOME ;
@@ -74,13 +71,8 @@ function restoreEnvironment(): void {
7471 process . env . UV_PYTHON_INSTALL_DIR = ORIGINAL_UV_PYTHON_INSTALL_DIR ;
7572}
7673
77- beforeEach ( ( ) => {
78- resetEnvironment ( ) ;
79- } ) ;
80-
81- afterEach ( ( ) => {
82- restoreEnvironment ( ) ;
83- } ) ;
74+ beforeEach ( resetEnvironment ) ;
75+ afterEach ( restoreEnvironment ) ;
8476
8577describe ( "loadInputs" , ( ) => {
8678 it ( "loads defaults for a github-hosted runner" , ( ) => {
@@ -125,7 +117,7 @@ cache-dir = "/tmp/pyproject-toml-defined-cache-path"
125117 } ) ;
126118
127119 it ( "uses UV_CACHE_DIR from the environment" , ( ) => {
128- mockInputs [ "working-directory" ] = createTempProject ( { } ) ;
120+ mockInputs [ "working-directory" ] = createTempProject ( ) ;
129121 process . env . UV_CACHE_DIR = "/env/cache-dir" ;
130122
131123 const inputs = loadInputs ( ) ;
0 commit comments