Skip to content

Commit e9f62f0

Browse files
committed
migrate all tests to vitest
1 parent e1fafda commit e9f62f0

52 files changed

Lines changed: 12007 additions & 10145 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 7979 additions & 6849 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@
6161
"istanbul-merge": "^2.0.0",
6262
"lint-staged": "^15.2.10",
6363
"nyc": "17.1.0",
64+
"tsx": "^4.20.5",
65+
"pixelmatch": "^5.3.0",
6466
"prettier": "3.4.1",
65-
"tsx": "^4.20.5"
67+
"vitest-mock-extended": "^2.0.0"
6668
},
6769
"lint-staged": {
6870
"**/*": "prettier --write --ignore-unknown"
Lines changed: 55 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,56 @@
11
{
2-
"name": "@finos/fdc3-agent-proxy",
3-
"version": "2.2.0",
4-
"author": "Fintech Open Source Foundation (FINOS)",
5-
"homepage": "https://fdc3.finos.org",
6-
"repository": {
7-
"type": "git",
8-
"url": "git+https://github.com/finos/FDC3.git"
9-
},
10-
"publishConfig": {
11-
"tag": "latest"
12-
},
13-
"license": "Apache-2.0",
14-
"main": "dist/src/index.js",
15-
"types": "dist/src/index.d.ts",
16-
"files": [
17-
"dist"
18-
],
19-
"scripts": {
20-
"build": "tsc",
21-
"test": "tsc && nyc --reporter=lcov --reporter=text --reporter json cucumber-js",
22-
"clean": "rimraf dist cucumber-report.html coverage .nyc_output node_modules test-results.xml",
23-
"lint": "eslint src/"
24-
},
25-
"dependencies": {
26-
"@finos/fdc3-standard": "2.2.0"
27-
},
28-
"devDependencies": {
29-
"@cucumber/cucumber": "10.3.1",
30-
"@cucumber/html-formatter": "11.0.4",
31-
"@cucumber/messages": "^28.1.0",
32-
"@cucumber/pretty-formatter": "1.0.1",
33-
"@eslint/js": "^9.19.0",
34-
"@finos/testing": "2.2.0",
35-
"@types/expect": "24.3.0",
36-
"@types/lodash": "4.14.167",
37-
"@types/node": "^20.16.11",
38-
"@types/uuid": "^10.0.0",
39-
"@typescript-eslint/eslint-plugin": "^8.18.2",
40-
"@typescript-eslint/parser": "^8.18.2",
41-
"cucumber-console-formatter": "1.0.0",
42-
"eslint": "^9.32.0",
43-
"eslint-config-prettier": "^9.1.0",
44-
"eslint-plugin-import": "^2.31.0",
45-
"eslint-plugin-prettier": "3.3.1",
46-
"expect": "^29.7.0",
47-
"globals": "^15.14.0",
48-
"is-ci": "2.0.0",
49-
"jsonpath-plus": "^10.1.0",
50-
"nyc": "17.1.0",
51-
"prettier": "3.4.1",
52-
"rimraf": "^6.0.1",
53-
"ts-node": "^10.9.2",
54-
"tsx": "^4.19.1",
55-
"typescript": "^5.6.3",
56-
"typescript-eslint": "^8.17.0",
57-
"uuid": "^9.0.1"
58-
},
59-
"type": "module"
60-
}
2+
"name": "@finos/fdc3-agent-proxy",
3+
"version": "2.2.0",
4+
"author": "Fintech Open Source Foundation (FINOS)",
5+
"homepage": "https://fdc3.finos.org",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/finos/FDC3.git"
9+
},
10+
"publishConfig": {
11+
"tag": "latest"
12+
},
13+
"license": "Apache-2.0",
14+
"type": "module",
15+
"main": "dist/src/index.js",
16+
"types": "dist/src/index.d.ts",
17+
"files": [
18+
"dist"
19+
],
20+
"scripts": {
21+
"build": "tsc",
22+
"test": "vitest run",
23+
"test:watch": "vitest",
24+
"test:coverage": "vitest run --coverage",
25+
"clean": "rimraf dist coverage node_modules",
26+
"lint": "eslint src/"
27+
},
28+
"dependencies": {
29+
"@finos/fdc3-standard": "2.2.0"
30+
},
31+
"devDependencies": {
32+
"@cucumber/cucumber": "10.3.1",
33+
"@eslint/js": "^9.19.0",
34+
"@finos/testing": "2.2.0",
35+
"@types/node": "^20.16.11",
36+
"@types/uuid": "^10.0.0",
37+
"@typescript-eslint/eslint-plugin": "^8.18.2",
38+
"@typescript-eslint/parser": "^8.18.2",
39+
"@vitest/coverage-v8": "^2.0.0",
40+
"eslint": "^9.32.0",
41+
"eslint-config-prettier": "^9.1.0",
42+
"eslint-plugin-import": "^2.31.0",
43+
"eslint-plugin-prettier": "3.3.1",
44+
"globals": "^15.14.0",
45+
"is-ci": "2.0.0",
46+
"jsonpath-plus": "^10.1.0",
47+
"prettier": "3.4.1",
48+
"quickpickle": "^1.0.0",
49+
"rimraf": "^6.0.1",
50+
"tsx": "^4.19.1",
51+
"typescript": "^5.6.3",
52+
"typescript-eslint": "^8.17.0",
53+
"uuid": "^9.0.1",
54+
"vitest": "^2.0.0"
55+
}
56+
}
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Given, When } from '@cucumber/cucumber';
1+
import { Given, When } from 'quickpickle';
22
import { SimpleIntentResolver } from '@finos/testing';
33
import { CustomWorld } from '../world/index.js';
44
import { CHANNEL_STATE } from '@finos/testing';
@@ -18,24 +18,24 @@ const logLevel = LogLevel.WARN;
1818

1919
Given(
2020
'A Channel Selector in {string} and a Desktop Agent in {string}',
21-
async function (this: CustomWorld, selectorField: string, daField: string) {
22-
if (!this.messaging) {
23-
this.messaging = new TestMessaging(this.props[CHANNEL_STATE]);
21+
async (world: CustomWorld, selectorField: string, daField: string) => {
22+
if (!world.messaging) {
23+
world.messaging = new TestMessaging(world.props[CHANNEL_STATE]);
2424
}
2525

2626
const ts = new TestChannelSelector();
27-
this.props[selectorField] = ts;
27+
world.props[selectorField] = ts;
2828

29-
const cs = new DefaultChannelSupport(this.messaging, ts, 10000);
30-
const hs = new DefaultHeartbeatSupport(this.messaging);
31-
const is = new DefaultIntentSupport(this.messaging, new SimpleIntentResolver(this), 10000, 100000);
32-
const as = new DefaultAppSupport(this.messaging, 10000, 100000);
29+
const cs = new DefaultChannelSupport(world.messaging, ts, 10000);
30+
const hs = new DefaultHeartbeatSupport(world.messaging);
31+
const is = new DefaultIntentSupport(world.messaging, new SimpleIntentResolver(world), 10000, 100000);
32+
const as = new DefaultAppSupport(world.messaging, 10000, 100000);
3333

3434
const da = new DesktopAgentProxy(hs, cs, is, as, [hs], logLevel);
3535
await da.connect();
3636

37-
this.props[daField] = da;
38-
this.props['result'] = null;
37+
world.props[daField] = da;
38+
world.props['result'] = null;
3939

4040
//populate the channel selector
4141
const channel = await cs.getUserChannel();
@@ -46,24 +46,24 @@ Given(
4646

4747
When(
4848
'The first channel is selected via the channel selector in {string}',
49-
async function (this: CustomWorld, selectorField: string) {
50-
const selector = this.props[selectorField] as TestChannelSelector;
49+
async (world: CustomWorld, selectorField: string) => {
50+
const selector = world.props[selectorField] as TestChannelSelector;
5151
selector.selectFirstChannel();
5252
}
5353
);
5454

5555
When(
5656
'The second channel is selected via the channel selector in {string}',
57-
async function (this: CustomWorld, selectorField: string) {
58-
const selector = this.props[selectorField] as TestChannelSelector;
57+
async (world: CustomWorld, selectorField: string) => {
58+
const selector = world.props[selectorField] as TestChannelSelector;
5959
selector.selectSecondChannel();
6060
}
6161
);
6262

6363
When(
6464
'The channel is deselected via the channel selector in {string}',
65-
async function (this: CustomWorld, selectorField: string) {
66-
const selector = this.props[selectorField] as TestChannelSelector;
65+
async (world: CustomWorld, selectorField: string) => {
66+
const selector = world.props[selectorField] as TestChannelSelector;
6767
selector.deselectChannel();
6868
}
6969
);

0 commit comments

Comments
 (0)