Skip to content

Commit 6ae93bb

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

52 files changed

Lines changed: 11961 additions & 10099 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"

packages/fdc3-agent-proxy/package.json

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,50 +11,46 @@
1111
"tag": "latest"
1212
},
1313
"license": "Apache-2.0",
14+
"type": "module",
1415
"main": "dist/src/index.js",
1516
"types": "dist/src/index.d.ts",
1617
"files": [
1718
"dist"
1819
],
1920
"scripts": {
2021
"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",
22+
"test": "tsc && vitest run",
23+
"test:watch": "vitest",
24+
"test:coverage": "vitest run --coverage",
25+
"clean": "rimraf dist coverage node_modules",
2326
"lint": "eslint src/"
2427
},
2528
"dependencies": {
2629
"@finos/fdc3-standard": "2.2.0"
2730
},
2831
"devDependencies": {
2932
"@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",
3333
"@eslint/js": "^9.19.0",
3434
"@finos/testing": "2.2.0",
35-
"@types/expect": "24.3.0",
36-
"@types/lodash": "4.14.167",
3735
"@types/node": "^20.16.11",
3836
"@types/uuid": "^10.0.0",
3937
"@typescript-eslint/eslint-plugin": "^8.18.2",
4038
"@typescript-eslint/parser": "^8.18.2",
41-
"cucumber-console-formatter": "1.0.0",
39+
"@vitest/coverage-v8": "^2.0.0",
4240
"eslint": "^9.32.0",
4341
"eslint-config-prettier": "^9.1.0",
4442
"eslint-plugin-import": "^2.31.0",
4543
"eslint-plugin-prettier": "3.3.1",
46-
"expect": "^29.7.0",
4744
"globals": "^15.14.0",
4845
"is-ci": "2.0.0",
4946
"jsonpath-plus": "^10.1.0",
50-
"nyc": "17.1.0",
5147
"prettier": "3.4.1",
48+
"quickpickle": "^1.0.0",
5249
"rimraf": "^6.0.1",
53-
"ts-node": "^10.9.2",
5450
"tsx": "^4.19.1",
5551
"typescript": "^5.6.3",
5652
"typescript-eslint": "^8.17.0",
57-
"uuid": "^9.0.1"
58-
},
59-
"type": "module"
53+
"uuid": "^9.0.1",
54+
"vitest": "^2.0.0"
55+
}
6056
}
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)