mirror of
https://github.com/actions/setup-java.git
synced 2026-07-08 14:21:50 +00:00
Updated jetbrains https.request command to catch errors. This fixes leaking tests as well
This commit is contained in:
parent
b150355f04
commit
d9e99fb853
@ -87,10 +87,20 @@ describe('findPackageForDownload', () => {
|
|||||||
const url = resolvedVersion.url;
|
const url = resolvedVersion.url;
|
||||||
const options = {method: 'HEAD'};
|
const options = {method: 'HEAD'};
|
||||||
|
|
||||||
https.request(url, options, res => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
// JetBrains uses 403 for inexistent packages
|
const request = https.request(url, options, res => {
|
||||||
expect(res.statusCode).not.toBe(403);
|
try {
|
||||||
res.resume();
|
// JetBrains uses 403 for non-existent packages
|
||||||
|
expect(res.statusCode).not.toBe(403);
|
||||||
|
res.resume();
|
||||||
|
res.on('end', resolve);
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
request.on('error', reject);
|
||||||
|
request.end();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user