Skip to content

Commit 259136a

Browse files
committed
Add an example to run vitest tests
1 parent 52eeab1 commit 259136a

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ npm install
6666
```
6767
npm run test:core:coverage
6868
npm run test:jest
69+
npm run test:vitest
6970
npm run test:cypress
7071
npm run test:cra
7172
```

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
"lint": "npm run lint --workspaces --if-present",
1616
"test:core:coverage": "npm run test:coverage -w packages/core",
1717
"test:jest": "npm run build && npm run test:ks -w packages/jest-example-test-suite",
18+
"test:vitest": "npm run build && npm run test:ks -w packages/vitest-example-test-suite",
1819
"test:cypress": "npm run build && npm run test:ks -w packages/cypress-example-test-suite",
1920
"test:cra": "cd packages/create-react-app-example && npm install && npm run test:ks",
20-
"test:examples": "npm run test:jest && npm run test:cypress && npm run test:cra"
21+
"test:examples": "npm run test:jest && npm run test:vitest && npm run test:cypress && npm run test:cra"
2122
}
2223
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
CI_BUILD_ID=$(openssl rand -base64 32)
4+
5+
ENDPOINT=https://api-staging.knapsackpro.com
6+
# ENDPOINT=http://api.knapsackpro.test:3000
7+
8+
LOG_LEVEL=info
9+
# LOG_LEVEL=debug
10+
11+
# TODO remove KNAPSACK_PRO_TEST_SUITE_TOKEN once we start using KNAPSACK_PRO_TEST_SUITE_TOKEN_VITEST
12+
KNAPSACK_PRO_ENDPOINT=$ENDPOINT \
13+
KNAPSACK_PRO_TEST_SUITE_TOKEN=d264b4b40f900d79178ca63e7ffc971f \
14+
KNAPSACK_PRO_TEST_SUITE_TOKEN_VITEST=d264b4b40f900d79178ca63e7ffc971f \
15+
KNAPSACK_PRO_LOG_LEVEL=$LOG_LEVEL \
16+
KNAPSACK_PRO_CI_NODE_BUILD_ID=$CI_BUILD_ID \
17+
KNAPSACK_PRO_CI_NODE_TOTAL=${2:-2} \
18+
KNAPSACK_PRO_CI_NODE_INDEX=${1:-0} \
19+
npx @knapsack-pro/vitest --verbose

packages/vitest-example-test-suite/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"vitest": "^2.1.6"
1010
},
1111
"scripts": {
12-
"test": "vitest"
12+
"test": "vitest",
13+
"test:ks": "bin/knapsack_pro_vitest"
1314
},
1415
"repository": {
1516
"type": "git",

0 commit comments

Comments
 (0)