@bigbinary/neeto-playwright-commons 4.8.1 → 4.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +4 -4
- package/index.js +31 -19
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -10085,8 +10085,8 @@ declare const currencyUtils: {
|
|
|
10085
10085
|
* test("should fail because of a bug in the product", async () => {
|
|
10086
10086
|
* test.fail(
|
|
10087
10087
|
* await isGithubIssueOpen([
|
|
10088
|
-
* "github.com/bigbinary/neeto-app-web/1234",
|
|
10089
|
-
* "github.com/bigbinary/neeto-app-web/1235",
|
|
10088
|
+
* "https://github.com/bigbinary/neeto-app-web/issues/1234",
|
|
10089
|
+
* "https://github.com/bigbinary/neeto-app-web/issues/1235",
|
|
10090
10090
|
* ]),
|
|
10091
10091
|
* "This test will fail until these bugs are fixed."
|
|
10092
10092
|
* );
|
|
@@ -10097,8 +10097,8 @@ declare const currencyUtils: {
|
|
|
10097
10097
|
* test("should fail because of a bug in the product", async () => {
|
|
10098
10098
|
* test.fixme(
|
|
10099
10099
|
* await isGithubIssueOpen([
|
|
10100
|
-
* "github.com/bigbinary/neeto-app-web/1234",
|
|
10101
|
-
* "github.com/bigbinary/neeto-app-web/1235",
|
|
10100
|
+
* "https://github.com/bigbinary/neeto-app-web/issues/1234",
|
|
10101
|
+
* "https://github.com/bigbinary/neeto-app-web/issues/1235",
|
|
10102
10102
|
* ]),
|
|
10103
10103
|
* "This test should be fixed until these bugs are fixed."
|
|
10104
10104
|
* );
|
package/index.js
CHANGED
|
@@ -119020,26 +119020,38 @@ class Octokit {
|
|
|
119020
119020
|
auth;
|
|
119021
119021
|
}
|
|
119022
119022
|
|
|
119023
|
-
const
|
|
119024
|
-
|
|
119025
|
-
|
|
119023
|
+
const issueStatusCache = new Map();
|
|
119024
|
+
let octokit;
|
|
119025
|
+
const getOctokit = () => (octokit ??= new Octokit({ auth: process.env.GITHUB_TOKEN }));
|
|
119026
|
+
const fetchIsIssueOpen = async (owner, repo, issueNumber) => {
|
|
119027
|
+
const { data } = await getOctokit().request("GET /repos/{owner}/{repo}/issues/{issue_number}", {
|
|
119028
|
+
owner,
|
|
119029
|
+
repo,
|
|
119030
|
+
issue_number: issueNumber,
|
|
119031
|
+
headers: { "X-GitHub-Api-Version": "2022-11-28" },
|
|
119026
119032
|
});
|
|
119027
|
-
|
|
119028
|
-
|
|
119029
|
-
|
|
119030
|
-
|
|
119031
|
-
|
|
119032
|
-
|
|
119033
|
-
|
|
119034
|
-
|
|
119035
|
-
|
|
119036
|
-
|
|
119037
|
-
|
|
119038
|
-
|
|
119039
|
-
|
|
119040
|
-
|
|
119041
|
-
|
|
119042
|
-
|
|
119033
|
+
return data.state === "open";
|
|
119034
|
+
};
|
|
119035
|
+
const isIssueOpen = (issueLink) => {
|
|
119036
|
+
const [owner, repo, ...rest] = (issueLink.split(/[?#]/)[0].split("github.com/").at(-1) ?? "")
|
|
119037
|
+
.split("/")
|
|
119038
|
+
.filter(Boolean);
|
|
119039
|
+
const issueNumber = Number(rest.at(-1));
|
|
119040
|
+
if (!owner || !repo || !Number.isInteger(issueNumber)) {
|
|
119041
|
+
throw new Error(`[isGithubIssueOpen] Invalid GitHub issue link: ${issueLink}`);
|
|
119042
|
+
}
|
|
119043
|
+
const cacheKey = `${owner}/${repo}#${issueNumber}`;
|
|
119044
|
+
const cachedStatus = issueStatusCache.get(cacheKey);
|
|
119045
|
+
if (cachedStatus)
|
|
119046
|
+
return cachedStatus;
|
|
119047
|
+
const status = fetchIsIssueOpen(owner, repo, issueNumber);
|
|
119048
|
+
issueStatusCache.set(cacheKey, status);
|
|
119049
|
+
status.catch(() => issueStatusCache.delete(cacheKey));
|
|
119050
|
+
return status;
|
|
119051
|
+
};
|
|
119052
|
+
const isGithubIssueOpen = async (issueLinks) => {
|
|
119053
|
+
const issueStatuses = await Promise.all(issueLinks.map(isIssueOpen));
|
|
119054
|
+
return issueStatuses.some(Boolean);
|
|
119043
119055
|
};
|
|
119044
119056
|
|
|
119045
119057
|
class HelpAndProfilePage {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-playwright-commons",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.2",
|
|
4
4
|
"description": "A package encapsulating common playwright code across neeto projects.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-playwright-commons.git",
|
|
6
6
|
"license": "apache-2.0",
|