mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 13:29:12 +08:00 
			
		
		
		
	Fix test volta priority (#577)
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							9f3a02bbd1
						
					
				
				
					commit
					969bd26639
				
			
							
								
								
									
										8
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							@@ -95,6 +95,9 @@ jobs:
 | 
			
		||||
        node-version-file: [.nvmrc, .tool-versions, package.json]
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - name: Remove volta from package.json
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: cat <<< "$(jq 'del(.volta)' ./__tests__/data/package.json)" > ./__tests__/data/package.json
 | 
			
		||||
      - name: Setup node from node version file
 | 
			
		||||
        uses: ./
 | 
			
		||||
        with:
 | 
			
		||||
@@ -110,15 +113,12 @@ jobs:
 | 
			
		||||
        os: [ ubuntu-latest, windows-latest, macos-latest ]
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - name: Remove engines from package.json
 | 
			
		||||
        shell: bash
 | 
			
		||||
        run: cat <<< "$(jq 'del(.engines)' ./__tests__/data/package.json)" > ./__tests__/data/package.json
 | 
			
		||||
      - name: Setup node from node version file
 | 
			
		||||
        uses: ./
 | 
			
		||||
        with:
 | 
			
		||||
          node-version-file: '__tests__/data/package.json'
 | 
			
		||||
      - name: Verify node
 | 
			
		||||
        run: __tests__/verify-node.sh 14
 | 
			
		||||
        run: __tests__/verify-node.sh 16
 | 
			
		||||
 | 
			
		||||
  node-dist:
 | 
			
		||||
    runs-on: ${{ matrix.os }}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,6 @@
 | 
			
		||||
    "node": "^14.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "volta": {
 | 
			
		||||
    "node": "14.0.0"
 | 
			
		||||
    "node": "16.0.0"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							@@ -73539,7 +73539,7 @@ function parseNodeVersionFile(contents) {
 | 
			
		||||
            nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
 | 
			
		||||
    }
 | 
			
		||||
    catch (_d) {
 | 
			
		||||
        core.warning('Node version file is not JSON file');
 | 
			
		||||
        core.info('Node version file is not JSON file');
 | 
			
		||||
    }
 | 
			
		||||
    if (!nodeVersion) {
 | 
			
		||||
        const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
 | 
			
		||||
 
 | 
			
		||||
@@ -502,7 +502,7 @@ export function parseNodeVersionFile(contents: string): string {
 | 
			
		||||
    nodeVersion = JSON.parse(contents).volta?.node;
 | 
			
		||||
    if (!nodeVersion) nodeVersion = JSON.parse(contents).engines?.node;
 | 
			
		||||
  } catch {
 | 
			
		||||
    core.warning('Node version file is not JSON file');
 | 
			
		||||
    core.info('Node version file is not JSON file');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (!nodeVersion) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user