diff --git a/lib/manager/gradle-wrapper/__snapshots__/artifacts.spec.ts.snap b/lib/manager/gradle-wrapper/__snapshots__/artifacts.spec.ts.snap index e842281010838792a4d4553373a5edb5c9b11d76..0e5de361fcc0a7eb8c7a9febc3c4c647a5fbf2cf 100644 --- a/lib/manager/gradle-wrapper/__snapshots__/artifacts.spec.ts.snap +++ b/lib/manager/gradle-wrapper/__snapshots__/artifacts.spec.ts.snap @@ -27,7 +27,7 @@ Array [ exports[`manager/gradle-wrapper/artifacts replaces existing value 1`] = ` Array [ Object { - "cmd": "<gradlew> wrapper --gradle-distribution-url https://services.gradle.org/distributions/gradle-6.3-bin.zip", + "cmd": "<gradlew> wrapper --gradle-version 6.3", "options": Object { "cwd": "/root/project/lib/manager/gradle-wrapper/__fixtures__/testFiles", "encoding": "utf-8", diff --git a/lib/manager/gradle-wrapper/artifacts-real.spec.ts b/lib/manager/gradle-wrapper/artifacts-real.spec.ts index e5ff7af1289a37f13d4aa293cc7dff737c57e1b4..96f4047e78d6c15e8c577d82bd4533fa55286a79 100644 --- a/lib/manager/gradle-wrapper/artifacts-real.spec.ts +++ b/lib/manager/gradle-wrapper/artifacts-real.spec.ts @@ -1,10 +1,11 @@ -import { readFile, readFileSync } from 'fs-extra'; +import { 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'; @@ -22,8 +23,8 @@ const config: UpdateArtifactsConfig = { newValue: '5.6.4', }; -function readString(...paths: string[]): Promise<string> { - return readFile(resolve(fixtures, ...paths), 'utf8'); +function readString(path: string): Promise<string> { + return readLocalFile(path, 'utf8'); } function readBinSync(...paths: string[]): Buffer { @@ -64,7 +65,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' }, }); @@ -122,7 +123,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, }); @@ -146,7 +147,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, }); @@ -173,7 +174,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, }); @@ -217,7 +218,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', @@ -237,10 +238,7 @@ describe('manager/gradle-wrapper/artifacts-real', () => { expect(result[0].artifactError).toBeUndefined(); expect( - await readString( - adminConfig.localDir, - `./gradle/wrapper/gradle-wrapper.properties` - ) + await readString(`gradle/wrapper/gradle-wrapper.properties`) ).toEqual(newContent); expect(httpMock.getTrace()).toEqual([ diff --git a/lib/manager/gradle-wrapper/artifacts.spec.ts b/lib/manager/gradle-wrapper/artifacts.spec.ts index 4d042f021fdfbd362ae5231dbcb8aa25283d46a9..28253c8785c34f5e0e79e29382db28dbfa246647 100644 --- a/lib/manager/gradle-wrapper/artifacts.spec.ts +++ b/lib/manager/gradle-wrapper/artifacts.spec.ts @@ -1,4 +1,4 @@ -import { readFile, stat } from 'fs-extra'; +import { 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 readFile(resolve(fixtures, ...paths), 'utf8'); + return fs.readLocalFile(resolve(fixtures, ...paths), 'utf8'); } describe('manager/gradle-wrapper/artifacts', () => {