mirror of
				https://github.com/actions/setup-node.git
				synced 2025-10-31 23:43:33 +00:00 
			
		
		
		
	Clean tests
This commit is contained in:
		
							parent
							
								
									6b9204b3ed
								
							
						
					
					
						commit
						1bb67f3744
					
				| @ -3,8 +3,8 @@ import fs = require('fs'); | ||||
| import os = require('os'); | ||||
| import path = require('path'); | ||||
| 
 | ||||
| const toolDir = path.join(__dirname, 'runner', 'tools'); | ||||
| const tempDir = path.join(__dirname, 'runner', 'temp'); | ||||
| const toolDir = path.join(process.cwd(), 'runner', 'tools'); | ||||
| const tempDir = path.join(process.cwd(), 'runner', 'temp'); | ||||
| 
 | ||||
| process.env['RUNNER_TOOLSDIRECTORY'] = toolDir; | ||||
| process.env['RUNNER_TEMPDIRECTORY'] = tempDir; | ||||
| @ -13,11 +13,10 @@ import * as installer from '../src/installer'; | ||||
| const IS_WINDOWS = process.platform === 'win32'; | ||||
| 
 | ||||
| describe('installer tests', () => { | ||||
|   beforeAll(() => {}); | ||||
|   beforeAll(async () => { | ||||
|     await io.rmRF(toolDir); | ||||
|     await io.rmRF(tempDir); | ||||
|   }); | ||||
|   }, 100000); | ||||
| 
 | ||||
|   it('Acquires version of node if no matching version is installed', async () => { | ||||
|     await installer.getNode('10.16.0'); | ||||
| @ -81,7 +80,7 @@ describe('installer tests', () => { | ||||
|   }); | ||||
| 
 | ||||
|   it('Doesnt use version of node that was only partially installed in cache', async () => { | ||||
|     const nodeDir: string = path.join(toolDir, 'node', '250.0.0', os.arch()); | ||||
|     const nodeDir: string = path.join(toolDir, 'node', '251.0.0', os.arch()); | ||||
|     await io.mkdirP(nodeDir); | ||||
|     let thrown = false; | ||||
|     try { | ||||
| @ -95,12 +94,12 @@ describe('installer tests', () => { | ||||
|   }); | ||||
| 
 | ||||
|   it('Resolves semantic versions of node installed in cache', async () => { | ||||
|     const nodeDir: string = path.join(toolDir, 'node', '250.0.0', os.arch()); | ||||
|     const nodeDir: string = path.join(toolDir, 'node', '252.0.0', os.arch()); | ||||
|     await io.mkdirP(nodeDir); | ||||
|     fs.writeFileSync(`${nodeDir}.complete`, 'hello'); | ||||
|     // These will throw if it doesn't find it in the cache (because no such version exists)
 | ||||
|     await installer.getNode('250.0.0'); | ||||
|     await installer.getNode('250'); | ||||
|     await installer.getNode('250.0'); | ||||
|     await installer.getNode('252.0.0'); | ||||
|     await installer.getNode('252'); | ||||
|     await installer.getNode('252.0'); | ||||
|   }); | ||||
| }); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user