Skip to content
Snippets Groups Projects
Unverified Commit ab3dc4e6 authored by Oleg Krivtsov's avatar Oleg Krivtsov Committed by GitHub
Browse files

test(manager/gradle-wrapper): fix snapshot regression in gradle-wrapper (#13144)

parent 395cab23
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@ Array [
exports[`manager/gradle-wrapper/artifacts replaces existing value 1`] = `
Array [
Object {
"cmd": "<gradlew> wrapper --gradle-version 6.3",
"cmd": "<gradlew> wrapper --gradle-distribution-url https://services.gradle.org/distributions/gradle-6.3-bin.zip",
"options": Object {
"cwd": "/root/project/lib/manager/gradle-wrapper/__fixtures__/testFiles",
"encoding": "utf-8",
......
import { readFileSync } from 'fs-extra';
import { readFile, readFileSync } from 'fs-extra';
import Git from 'simple-git';
import { resolve } from 'upath';
import * as httpMock from '../../../test/http-mock';
import { git, partial } from '../../../test/util';
import { GlobalConfig } from '../../config/global';
import type { RepoGlobalConfig } from '../../config/types';
import { readLocalFile } from '../../util/fs';
import type { StatusResult } from '../../util/git/types';
import { ifSystemSupportsGradle } from '../gradle/deep/__testutil__/gradle';
import type { UpdateArtifactsConfig } from '../types';
......@@ -23,8 +22,8 @@ const config: UpdateArtifactsConfig = {
newValue: '5.6.4',
};
function readString(path: string): Promise<string> {
return readLocalFile(path, 'utf8');
function readString(...paths: string[]): Promise<string> {
return readFile(resolve(fixtures, ...paths), 'utf8');
}
function readBinSync(...paths: string[]): Buffer {
......@@ -65,7 +64,7 @@ describe('manager/gradle-wrapper/artifacts-real', () => {
packageFileName: 'gradle/wrapper/gradle-wrapper.properties',
updatedDeps: [],
newPackageFileContent: await readString(
`../expectedFiles/gradle/wrapper/gradle-wrapper.properties`
`./expectedFiles/gradle/wrapper/gradle-wrapper.properties`
),
config: { ...config, newValue: '6.3' },
});
......@@ -123,7 +122,7 @@ describe('manager/gradle-wrapper/artifacts-real', () => {
packageFileName: 'gradle/wrapper/gradle-wrapper.properties',
updatedDeps: [],
newPackageFileContent: await readString(
`../testFiles/gradle/wrapper/gradle-wrapper.properties`
`./testFiles/gradle/wrapper/gradle-wrapper.properties`
),
config,
});
......@@ -147,7 +146,7 @@ describe('manager/gradle-wrapper/artifacts-real', () => {
packageFileName: 'gradle/wrapper/gradle-wrapper.properties',
updatedDeps: [],
newPackageFileContent: await readString(
`../testFiles/gradle/wrapper/gradle-wrapper.properties`
`./testFiles/gradle/wrapper/gradle-wrapper.properties`
),
config,
});
......@@ -174,7 +173,7 @@ describe('manager/gradle-wrapper/artifacts-real', () => {
packageFileName: 'gradle/wrapper/gradle-wrapper.properties',
updatedDeps: [],
newPackageFileContent: await readString(
`../testFiles/gradle/wrapper/gradle-wrapper.properties`
`./testFiles/gradle/wrapper/gradle-wrapper.properties`
),
config,
});
......@@ -218,7 +217,7 @@ describe('manager/gradle-wrapper/artifacts-real', () => {
})
);
const newContent = await readString(`../gradle-wrapper-sum.properties`);
const newContent = await readString(`./gradle-wrapper-sum.properties`);
const result = await gradleWrapper.updateArtifacts({
packageFileName: 'gradle/wrapper/gradle-wrapper.properties',
......@@ -238,7 +237,10 @@ describe('manager/gradle-wrapper/artifacts-real', () => {
expect(result[0].artifactError).toBeUndefined();
expect(
await readString(`gradle/wrapper/gradle-wrapper.properties`)
await readString(
adminConfig.localDir,
`gradle/wrapper/gradle-wrapper.properties`
)
).toEqual(newContent);
expect(httpMock.getTrace()).toEqual([
......
import { stat } from 'fs-extra';
import { readFile, stat } from 'fs-extra';
import { resolve } from 'upath';
import { envMock, exec, mockExecAll } from '../../../test/exec-util';
import * as httpMock from '../../../test/http-mock';
......@@ -37,7 +37,7 @@ addReplacingSerializer('gradlew.bat', '<gradlew>');
addReplacingSerializer('./gradlew', '<gradlew>');
function readString(...paths: string[]): Promise<string> {
return fs.readLocalFile(resolve(fixtures, ...paths), 'utf8');
return readFile(resolve(fixtures, ...paths), 'utf8');
}
describe('manager/gradle-wrapper/artifacts', () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment