Skip to content

Commit

Permalink
Add an example to run vitest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturT committed Dec 11, 2024
1 parent 52eeab1 commit 259136a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ npm install
```
npm run test:core:coverage
npm run test:jest
npm run test:vitest
npm run test:cypress
npm run test:cra
```
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
"lint": "npm run lint --workspaces --if-present",
"test:core:coverage": "npm run test:coverage -w packages/core",
"test:jest": "npm run build && npm run test:ks -w packages/jest-example-test-suite",
"test:vitest": "npm run build && npm run test:ks -w packages/vitest-example-test-suite",
"test:cypress": "npm run build && npm run test:ks -w packages/cypress-example-test-suite",
"test:cra": "cd packages/create-react-app-example && npm install && npm run test:ks",
"test:examples": "npm run test:jest && npm run test:cypress && npm run test:cra"
"test:examples": "npm run test:jest && npm run test:vitest && npm run test:cypress && npm run test:cra"
}
}
19 changes: 19 additions & 0 deletions packages/vitest-example-test-suite/bin/knapsack_pro_vitest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

CI_BUILD_ID=$(openssl rand -base64 32)

ENDPOINT=https://api-staging.knapsackpro.com
# ENDPOINT=http://api.knapsackpro.test:3000

LOG_LEVEL=info
# LOG_LEVEL=debug

# TODO remove KNAPSACK_PRO_TEST_SUITE_TOKEN once we start using KNAPSACK_PRO_TEST_SUITE_TOKEN_VITEST
KNAPSACK_PRO_ENDPOINT=$ENDPOINT \
KNAPSACK_PRO_TEST_SUITE_TOKEN=d264b4b40f900d79178ca63e7ffc971f \
KNAPSACK_PRO_TEST_SUITE_TOKEN_VITEST=d264b4b40f900d79178ca63e7ffc971f \
KNAPSACK_PRO_LOG_LEVEL=$LOG_LEVEL \
KNAPSACK_PRO_CI_NODE_BUILD_ID=$CI_BUILD_ID \
KNAPSACK_PRO_CI_NODE_TOTAL=${2:-2} \
KNAPSACK_PRO_CI_NODE_INDEX=${1:-0} \
npx @knapsack-pro/vitest --verbose
3 changes: 2 additions & 1 deletion packages/vitest-example-test-suite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"vitest": "^2.1.6"
},
"scripts": {
"test": "vitest"
"test": "vitest",
"test:ks": "bin/knapsack_pro_vitest"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 259136a

Please sign in to comment.