Skip to content

Commit b5ef1ab

Browse files
Thomaashvis-bot
andauthored
fix(deps): update (#1556)
* fix(deps): update * style: reformat * fix(deps): add missing postcss dev dep Co-authored-by: Vis Bot <visjsbot@gmail.com>
1 parent 47134b0 commit b5ef1ab

31 files changed

+11958
-8717
lines changed

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

cypress.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
2+
"env": {
3+
"SNAPSHOT_BASE_DIRECTORY": "./cypress/snapshots/base",
4+
"SNAPSHOT_DIFF_DIRECTORY": "./cypress/snapshots/diff"
5+
},
6+
"screenshotsFolder": "./cypress/snapshots/actual",
7+
"trashAssetsBeforeRuns": true,
28
"viewportHeight": 1600,
39
"viewportWidth": 1200
410
}

cypress/integration/functional/directed-hierarchical-layout.spec.ts

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,23 @@ describe("Directed hierarchical layout", (): void => {
167167
const configs = [
168168
{ nodes: [], swallowsEdges: 0 },
169169
...(clusterConfigs || []),
170-
].map(({ nodes }, i, arr): {
171-
expectedVisibleEdges: number;
172-
nodesToCluster: Set<IdType>;
173-
} => ({
174-
expectedVisibleEdges:
175-
data.edges.length -
170+
].map(
171+
(
172+
{ nodes },
173+
i,
176174
arr
177-
.slice(0, i + 1)
178-
.reduce((acc, { swallowsEdges }): number => acc + swallowsEdges, 0),
179-
nodesToCluster: new Set(nodes),
180-
}));
175+
): {
176+
expectedVisibleEdges: number;
177+
nodesToCluster: Set<IdType>;
178+
} => ({
179+
expectedVisibleEdges:
180+
data.edges.length -
181+
arr
182+
.slice(0, i + 1)
183+
.reduce((acc, { swallowsEdges }): number => acc + swallowsEdges, 0),
184+
nodesToCluster: new Set(nodes),
185+
})
186+
);
181187

182188
describe(name, (): void => {
183189
it("Preparation", (): void => {
@@ -244,28 +250,40 @@ describe("Directed hierarchical layout", (): void => {
244250
* No matter how much ESLint think they're unnecessary, these two
245251
* assertions are indeed necessary.
246252
*/
247-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
248-
const visibleEdges = (Object.values(
249-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
250-
(network as any).body.edges
251-
) as any[]).filter(
253+
const visibleEdges = Object.values(
254+
(
255+
network as unknown as {
256+
body: {
257+
edges: {
258+
fromId: string;
259+
toId: string;
260+
}[];
261+
};
262+
}
263+
).body.edges
264+
).filter(
252265
(edge): boolean =>
253266
visibleNodeIds.has(edge.fromId) &&
254267
visibleNodeIds.has(edge.toId)
255268
);
256269

257270
const invalidEdges = visibleEdges
258-
.map(({ fromId, toId }): {
259-
fromId: IdType;
260-
fromPosition: Point;
261-
toId: IdType;
262-
toPosition: Point;
263-
} => ({
264-
fromId,
265-
fromPosition: network.getPositions([fromId])[fromId],
266-
toId,
267-
toPosition: network.getPositions([toId])[toId],
268-
}))
271+
.map(
272+
({
273+
fromId,
274+
toId,
275+
}): {
276+
fromId: IdType;
277+
fromPosition: Point;
278+
toId: IdType;
279+
toPosition: Point;
280+
} => ({
281+
fromId,
282+
fromPosition: network.getPositions([fromId])[fromId],
283+
toId,
284+
toPosition: network.getPositions([toId])[toId],
285+
})
286+
)
269287
.filter(({ fromPosition, toPosition }): boolean => {
270288
return !(fromPosition.y < toPosition.y);
271289
});

cypress/integration/functional/drags.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ function drag(
1818
): { name: string; event: VisEvent }[] {
1919
const events: { name: string; event: VisEvent }[] = [];
2020

21-
const eventListener = (name: string) => (event: VisEvent): void => {
22-
events.push({ name, event });
23-
};
21+
const eventListener =
22+
(name: string) =>
23+
(event: VisEvent): void => {
24+
events.push({ name, event });
25+
};
2426

2527
cy.visRunWithWindow(({ network }): void => {
2628
network.on("dragStart", eventListener("dragStart"));

cypress/integration/helpers/common.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,14 @@ export function createGridPoints(
2929
const offset = (size * ((perRowOrCol - 1) / perRowOrCol)) / 2;
3030

3131
return Object.freeze<Point[]>(
32-
new Array(amount).fill(null).map(
33-
(_, i): Point => {
34-
const col = Math.floor(i / perRowOrCol);
35-
const row = i - col * perRowOrCol;
32+
new Array(amount).fill(null).map((_, i): Point => {
33+
const col = Math.floor(i / perRowOrCol);
34+
const row = i - col * perRowOrCol;
3635

37-
return Object.freeze<Point>({
38-
x: (row / perRowOrCol) * size - offset,
39-
y: (col / perRowOrCol) * size - offset,
40-
});
41-
}
42-
)
36+
return Object.freeze<Point>({
37+
x: (row / perRowOrCol) * size - offset,
38+
y: (col / perRowOrCol) * size - offset,
39+
});
40+
})
4341
);
4442
}

cypress/pages/standard-cytest-script.ts

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,15 @@ type VisUtil = typeof visUtil;
205205
updateSelectionJSON();
206206

207207
// Selection events:
208-
([
209-
"deselectEdge",
210-
"deselectNode",
211-
"select",
212-
"selectEdge",
213-
"selectNode",
214-
] as const).forEach((eventName): void => {
208+
(
209+
[
210+
"deselectEdge",
211+
"deselectNode",
212+
"select",
213+
"selectEdge",
214+
"selectNode",
215+
] as const
216+
).forEach((eventName): void => {
215217
network.on(eventName, updateSelectionJSON);
216218

217219
network.on(eventName, (): void => {
@@ -239,40 +241,42 @@ type VisUtil = typeof visUtil;
239241

240242
// Event queue:
241243
const eventQueue: VisWindow["visEventQueue"] = {} as any;
242-
([
243-
"afterDrawing",
244-
"animationFinished",
245-
"beforeDrawing",
246-
"blurEdge",
247-
"blurNode",
248-
"click",
249-
"configChange",
250-
"controlNodeDragEnd",
251-
"controlNodeDragging",
252-
"deselectEdge",
253-
"deselectNode",
254-
"doubleClick",
255-
"dragEnd",
256-
"dragStart",
257-
"dragging",
258-
"hidePopup",
259-
"hold",
260-
"hoverEdge",
261-
"hoverNode",
262-
"initRedraw",
263-
"oncontext",
264-
"release",
265-
"resize",
266-
"select",
267-
"selectEdge",
268-
"selectNode",
269-
"showPopup",
270-
"stabilizationIterationsDone",
271-
"stabilizationProgress",
272-
"stabilized",
273-
"startStabilizing",
274-
"zoom",
275-
] as const).forEach((eventName): void => {
244+
(
245+
[
246+
"afterDrawing",
247+
"animationFinished",
248+
"beforeDrawing",
249+
"blurEdge",
250+
"blurNode",
251+
"click",
252+
"configChange",
253+
"controlNodeDragEnd",
254+
"controlNodeDragging",
255+
"deselectEdge",
256+
"deselectNode",
257+
"doubleClick",
258+
"dragEnd",
259+
"dragStart",
260+
"dragging",
261+
"hidePopup",
262+
"hold",
263+
"hoverEdge",
264+
"hoverNode",
265+
"initRedraw",
266+
"oncontext",
267+
"release",
268+
"resize",
269+
"select",
270+
"selectEdge",
271+
"selectNode",
272+
"showPopup",
273+
"stabilizationIterationsDone",
274+
"stabilizationProgress",
275+
"stabilized",
276+
"startStabilizing",
277+
"zoom",
278+
] as const
279+
).forEach((eventName): void => {
276280
eventQueue[eventName] = [];
277281
network.on(eventName, (params: any): void => {
278282
eventQueue[eventName].push({ params });

cypress/plugins/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = (on, config) => {
3434
config.screenshotsFolder = "./cypress/snapshots/actual";
3535
}
3636

37-
getCompareSnapshotsPlugin(on);
37+
getCompareSnapshotsPlugin(on, config);
3838
}
3939

4040
if (all || config.env.FUNCTIONAL) {

cypress/support/commands/vis-assert-event.ts

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ declare global {
3232
}
3333

3434
export function visShiftAndAssertEventFired(name: NetworkEvents): void {
35-
cy.visRun(
36-
async ({ eventQueue }): Promise<void> => {
37-
expect(eventQueue[name], `${name} event queue`).to.not.be.empty;
38-
eventQueue[name].shift();
39-
}
40-
);
35+
cy.visRun(async ({ eventQueue }): Promise<void> => {
36+
expect(eventQueue[name], `${name} event queue`).to.not.be.empty;
37+
eventQueue[name].shift();
38+
});
4139
}
4240
Cypress.Commands.add(
4341
"visShiftAndAssertEventFired",
@@ -48,15 +46,13 @@ export function visShiftAndAssertEventFiredWithParams(
4846
name: NetworkEvents,
4947
params: any
5048
): void {
51-
cy.visRun(
52-
async ({ eventQueue }): Promise<void> => {
53-
expect(eventQueue[name], `${name} event queue`).to.not.be.empty;
54-
const event = eventQueue[name].shift();
55-
expect(event, `${name} event`)
56-
.to.have.ownProperty("params")
57-
.that.deep.equals(params);
58-
}
59-
);
49+
cy.visRun(async ({ eventQueue }): Promise<void> => {
50+
expect(eventQueue[name], `${name} event queue`).to.not.be.empty;
51+
const event = eventQueue[name].shift();
52+
expect(event, `${name} event`)
53+
.to.have.ownProperty("params")
54+
.that.deep.equals(params);
55+
});
6056
}
6157
Cypress.Commands.add(
6258
"visShiftAndAssertEventFiredWithParams",
@@ -66,12 +62,10 @@ Cypress.Commands.add(
6662
export function visShiftAndAssertEventNone(
6763
...names: readonly NetworkEvents[]
6864
): void {
69-
cy.visRun(
70-
async ({ eventQueue }): Promise<void> => {
71-
for (const name of names) {
72-
expect(eventQueue[name], `${name} event queue`).to.be.empty;
73-
}
65+
cy.visRun(async ({ eventQueue }): Promise<void> => {
66+
for (const name of names) {
67+
expect(eventQueue[name], `${name} event queue`).to.be.empty;
7468
}
75-
);
69+
});
7670
}
7771
Cypress.Commands.add("visShiftAndAssertEventNone", visShiftAndAssertEventNone);

cypress/support/commands/vis-assert-selection.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ declare global {
1616
}
1717
}
1818

19-
function sortSelection(selection: {
20-
nodes: IdType[];
21-
edges: IdType[];
22-
}): {
19+
function sortSelection(selection: { nodes: IdType[]; edges: IdType[] }): {
2320
nodes: IdType[];
2421
edges: IdType[];
2522
} {

cypress/support/commands/vis-run.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,20 @@ export function visRun(
3030
callback: (props: VisGlobals) => void | Promise<void>,
3131
{ timeout = VIS_DEFAULT_RUN_TIMEOUT }: VisRunOptions = {}
3232
): void {
33-
cy.window().then(
34-
{ timeout },
35-
async (win: any): Promise<void> => {
36-
const {
37-
visEdges: edges,
38-
visEventQueue: eventQueue,
39-
visLastEvents: lastEvents,
40-
visNetwork: network,
41-
visNodes: nodes,
42-
}: VisWindow = win;
33+
cy.window().then({ timeout }, async (win: any): Promise<void> => {
34+
const {
35+
visEdges: edges,
36+
visEventQueue: eventQueue,
37+
visLastEvents: lastEvents,
38+
visNetwork: network,
39+
visNodes: nodes,
40+
}: VisWindow = win;
4341

44-
if (edges && lastEvents && network && nodes) {
45-
await callback({ edges, eventQueue, lastEvents, network, nodes });
46-
} else {
47-
throw new Error("No page globals were found.");
48-
}
42+
if (edges && lastEvents && network && nodes) {
43+
await callback({ edges, eventQueue, lastEvents, network, nodes });
44+
} else {
45+
throw new Error("No page globals were found.");
4946
}
50-
);
47+
});
5148
}
5249
Cypress.Commands.add("visRun", visRun);

0 commit comments

Comments
 (0)