Fix tests
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									e8186e990f
								
							
						
					
					
						commit
						995fe3c38a
					
				@ -27,7 +27,7 @@ describe('getVersion', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
describe('parseVersion', () => {
 | 
					describe('parseVersion', () => {
 | 
				
			||||||
  test.each([
 | 
					  test.each([
 | 
				
			||||||
    ['github.com/docker/buildx v0.2.2 ab5fe3dec5785b8d0a7d2cf2499c38e504d4c609', '0.2.2'],
 | 
					    ['github.com/docker/buildx 0.4.1+azure bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
 | 
				
			||||||
    ['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
 | 
					    ['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
 | 
				
			||||||
    ['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2']
 | 
					    ['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2']
 | 
				
			||||||
  ])('given %p', async (stdout, expected) => {
 | 
					  ])('given %p', async (stdout, expected) => {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							@ -1587,7 +1587,7 @@ function getVersion() {
 | 
				
			|||||||
exports.getVersion = getVersion;
 | 
					exports.getVersion = getVersion;
 | 
				
			||||||
function parseVersion(stdout) {
 | 
					function parseVersion(stdout) {
 | 
				
			||||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
					    return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
        const matches = /\sv([0-9.]+)\s/.exec(stdout);
 | 
					        const matches = /\sv?([0-9.]+)/.exec(stdout);
 | 
				
			||||||
        if (!matches) {
 | 
					        if (!matches) {
 | 
				
			||||||
            throw new Error(`Cannot parse Buildx version`);
 | 
					            throw new Error(`Cannot parse Buildx version`);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -35,7 +35,7 @@ export async function getVersion(): Promise<string> {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export async function parseVersion(stdout: string): Promise<string> {
 | 
					export async function parseVersion(stdout: string): Promise<string> {
 | 
				
			||||||
  const matches = /\sv([0-9.]+)\s/.exec(stdout);
 | 
					  const matches = /\sv?([0-9.]+)/.exec(stdout);
 | 
				
			||||||
  if (!matches) {
 | 
					  if (!matches) {
 | 
				
			||||||
    throw new Error(`Cannot parse Buildx version`);
 | 
					    throw new Error(`Cannot parse Buildx version`);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user