mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 08:33:33 +00:00 
			
		
		
		
	amend unit tests
This commit is contained in:
		
							parent
							
								
									07e689a783
								
							
						
					
					
						commit
						bd4ffc78c2
					
				@ -920,10 +920,6 @@ describe('setup-node', () => {
 | 
				
			|||||||
        os.platform = 'darwin';
 | 
					        os.platform = 'darwin';
 | 
				
			||||||
        os.arch = 'x64';
 | 
					        os.arch = 'x64';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const expectedVersion = nodeTestDist[0];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        let expectedUrl = `https://nodejs.org/dist/${expectedVersion.version}/node-${expectedVersion.version}-${os.platform}-${os.arch}.tar.gz`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        findSpy.mockImplementation(() => '');
 | 
					        findSpy.mockImplementation(() => '');
 | 
				
			||||||
        getManifestSpy.mockImplementation(() => {
 | 
					        getManifestSpy.mockImplementation(() => {
 | 
				
			||||||
          throw new Error('Unable to download manifest');
 | 
					          throw new Error('Unable to download manifest');
 | 
				
			||||||
@ -932,21 +928,10 @@ describe('setup-node', () => {
 | 
				
			|||||||
        // Act
 | 
					        // Act
 | 
				
			||||||
        await main.run();
 | 
					        await main.run();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Assert
 | 
					        // assert
 | 
				
			||||||
        expect(logSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
          `Attempting to download ${inputVersion}...`
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        expect(logSpy).toHaveBeenCalledWith('Unable to download manifest');
 | 
					        expect(logSpy).toHaveBeenCalledWith('Unable to download manifest');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
 | 
					        expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
 | 
				
			||||||
 | 
					 | 
				
			||||||
        expect(logSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
          `Acquiring ${expectedVersion.version.substring(
 | 
					 | 
				
			||||||
            1,
 | 
					 | 
				
			||||||
            expectedVersion.version.length
 | 
					 | 
				
			||||||
          )} - ${os.arch} from ${expectedUrl}`
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										18
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										18
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -20,7 +20,7 @@
 | 
				
			|||||||
        "semver": "^6.1.1"
 | 
					        "semver": "^6.1.1"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "devDependencies": {
 | 
					      "devDependencies": {
 | 
				
			||||||
        "@types/jest": "^27.0.2",
 | 
					        "@types/jest": "^27.5.0",
 | 
				
			||||||
        "@types/node": "^16.11.25",
 | 
					        "@types/node": "^16.11.25",
 | 
				
			||||||
        "@types/semver": "^6.0.0",
 | 
					        "@types/semver": "^6.0.0",
 | 
				
			||||||
        "@zeit/ncc": "^0.21.0",
 | 
					        "@zeit/ncc": "^0.21.0",
 | 
				
			||||||
@ -1471,12 +1471,12 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@types/jest": {
 | 
					    "node_modules/@types/jest": {
 | 
				
			||||||
      "version": "27.0.2",
 | 
					      "version": "27.5.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.0.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-4dRxkS/AFX0c5XW6IPMNOydLn2tEhNhJV7DnYK+0bjoJZ+QTmfucBlihX7aoEsh/ocYtkLC73UbnBXBXIxsULA==",
 | 
					      "integrity": "sha512-9RBFx7r4k+msyj/arpfaa0WOOEcaAZNmN+j80KFbFCoSqCJGHTz7YMAMGQW9Xmqm5w6l5c25vbSjMwlikJi5+g==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "jest-diff": "^27.0.0",
 | 
					        "jest-matcher-utils": "^27.0.0",
 | 
				
			||||||
        "pretty-format": "^27.0.0"
 | 
					        "pretty-format": "^27.0.0"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@ -6283,12 +6283,12 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@types/jest": {
 | 
					    "@types/jest": {
 | 
				
			||||||
      "version": "27.0.2",
 | 
					      "version": "27.5.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.0.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-4dRxkS/AFX0c5XW6IPMNOydLn2tEhNhJV7DnYK+0bjoJZ+QTmfucBlihX7aoEsh/ocYtkLC73UbnBXBXIxsULA==",
 | 
					      "integrity": "sha512-9RBFx7r4k+msyj/arpfaa0WOOEcaAZNmN+j80KFbFCoSqCJGHTz7YMAMGQW9Xmqm5w6l5c25vbSjMwlikJi5+g==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "jest-diff": "^27.0.0",
 | 
					        "jest-matcher-utils": "^27.0.0",
 | 
				
			||||||
        "pretty-format": "^27.0.0"
 | 
					        "pretty-format": "^27.0.0"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
				
			|||||||
@ -34,7 +34,7 @@
 | 
				
			|||||||
    "semver": "^6.1.1"
 | 
					    "semver": "^6.1.1"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@types/jest": "^27.0.2",
 | 
					    "@types/jest": "^27.5.0",
 | 
				
			||||||
    "@types/node": "^16.11.25",
 | 
					    "@types/node": "^16.11.25",
 | 
				
			||||||
    "@types/semver": "^6.0.0",
 | 
					    "@types/semver": "^6.0.0",
 | 
				
			||||||
    "@zeit/ncc": "^0.21.0",
 | 
					    "@zeit/ncc": "^0.21.0",
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,6 @@ import * as tc from '@actions/tool-cache';
 | 
				
			|||||||
import * as path from 'path';
 | 
					import * as path from 'path';
 | 
				
			||||||
import * as semver from 'semver';
 | 
					import * as semver from 'semver';
 | 
				
			||||||
import fs = require('fs');
 | 
					import fs = require('fs');
 | 
				
			||||||
import * as installer from './installer';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Node versions interface
 | 
					// Node versions interface
 | 
				
			||||||
@ -372,7 +371,7 @@ async function queryDistForMatch(
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let versions: string[] = [];
 | 
					  let versions: string[] = [];
 | 
				
			||||||
  let nodeVersions = await installer.getVersionsFromDist();
 | 
					  let nodeVersions = await getVersionsFromDist();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (
 | 
					  if (
 | 
				
			||||||
    versionSpec === 'current' ||
 | 
					    versionSpec === 'current' ||
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user