mirror of
https://github.com/gradle/wrapper-validation-action
synced 2024-11-27 10:42:03 +00:00
Refine min-wrapper-count error message
Signed-off-by: Paul Merlin <paul@gradle.com>
This commit is contained in:
parent
9393a6ed98
commit
7c1b6a0c36
3 changed files with 7 additions and 12 deletions
|
@ -18,10 +18,9 @@ test('validates wrapper jars', async () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
test('fails if not enough wrapper jars are found', async () => {
|
test('fails if not enough wrapper jars are found', async () => {
|
||||||
await expect(validate.findInvalidWrapperJars(
|
await expect(
|
||||||
path.resolve('.'),
|
validate.findInvalidWrapperJars(path.resolve('.'), 3, false, [])
|
||||||
3,
|
).rejects.toThrowError(
|
||||||
false,
|
'Expected to find at least 3 Gradle Wrapper JARs but got only 2'
|
||||||
[]
|
)
|
||||||
)).rejects.toThrowError('Expected at least 3 but got only 2')
|
|
||||||
})
|
})
|
||||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
|
@ -949,7 +949,7 @@ function findInvalidWrapperJars(gitRepoRoot, minWrapperCount, allowSnapshots, al
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const wrapperJars = yield find.findWrapperJars(gitRepoRoot);
|
const wrapperJars = yield find.findWrapperJars(gitRepoRoot);
|
||||||
if (wrapperJars.length < minWrapperCount) {
|
if (wrapperJars.length < minWrapperCount) {
|
||||||
throw new Error(`Expected at least ${minWrapperCount} but got only ${wrapperJars.length}`);
|
throw new Error(`Expected to find at least ${minWrapperCount} Gradle Wrapper JARs but got only ${wrapperJars.length}`);
|
||||||
}
|
}
|
||||||
if (wrapperJars.length > 0) {
|
if (wrapperJars.length > 0) {
|
||||||
const validChecksums = yield checksums.fetchValidChecksums(allowSnapshots);
|
const validChecksums = yield checksums.fetchValidChecksums(allowSnapshots);
|
||||||
|
|
|
@ -9,13 +9,9 @@ export async function findInvalidWrapperJars(
|
||||||
allowChecksums: string[]
|
allowChecksums: string[]
|
||||||
): Promise<InvalidWrapperJar[]> {
|
): Promise<InvalidWrapperJar[]> {
|
||||||
const wrapperJars = await find.findWrapperJars(gitRepoRoot)
|
const wrapperJars = await find.findWrapperJars(gitRepoRoot)
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(
|
|
||||||
`Expected at least ${minWrapperCount} but got only ${wrapperJars.length}`
|
|
||||||
)
|
|
||||||
if (wrapperJars.length < minWrapperCount) {
|
if (wrapperJars.length < minWrapperCount) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Expected at least ${minWrapperCount} but got only ${wrapperJars.length}`
|
`Expected to find at least ${minWrapperCount} Gradle Wrapper JARs but got only ${wrapperJars.length}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (wrapperJars.length > 0) {
|
if (wrapperJars.length > 0) {
|
||||||
|
|
Loading…
Reference in a new issue