Skip to content

Commit

Permalink
chore(repo): upgrade vitest (attempt 2) (#6686)
Browse files Browse the repository at this point in the history
#6676 was reverted due to some unexpected build errors. This PR brings back the code with fixes to the benchmark script and to stack trace output on Windows machines.

Huge thanks to @MarkMcCulloh for the help getting this PR over the finish line.

Closes #6675

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [ ] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
Chriscbr committed Jun 14, 2024
1 parent 71ed29f commit 48abace
Show file tree
Hide file tree
Showing 48 changed files with 1,576 additions and 1,539 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ jobs:
working-directory: tools/hangar
run: |
pnpm test:generate
pnpm run test --shard=${{ matrix.shard }} --update=${{ matrix.runner == 'ubuntu' && matrix.node == '20' }}
pnpm run vitest --shard=${{ matrix.shard }} --update=${{ matrix.runner == 'ubuntu' && matrix.node == '20' }}
- name: Create mutation if needed
# we only care about the diff in our standard dev env
Expand Down
2 changes: 1 addition & 1 deletion apps/jsii-docgen/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/vscode-wing/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/wing-console/console/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-c8": "^0.33.0",
"@vitest/coverage-v8": "^1.6.0",
"@wingconsole/eslint-plugin": "workspace:^",
"@wingconsole/tsconfig": "workspace:^",
"@wingconsole/ui": "workspace:^",
Expand Down
3 changes: 1 addition & 2 deletions apps/wing-console/console/app/scripts/dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ const options = parseArgs({
requireAcceptTerms: true,
analyticsAnonymousId: undefined,
async requireSignIn() {
// Return `true` if you want to show the sign in prompt.
return false;
return options.requireSignIn ?? false;
},
});

Expand Down
4 changes: 2 additions & 2 deletions apps/wing-console/console/app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export const createConsoleApp = async (options: CreateConsoleAppOptions) => {
analyticsAnonymousId: analyticsStorage.getAnonymousId(),
analytics,
async requireSignIn() {
if (options.requireSignIn === false) {
return false;
if (options.requireSignIn !== undefined) {
return options.requireSignIn;
}

// The VSCode extension for Wing will use this to determine whether to show the sign in prompt.
Expand Down
4 changes: 2 additions & 2 deletions apps/wing-console/console/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-c8": "^0.31.4",
"@vitest/coverage-v8": "^1.6.0",
"@wingconsole/eslint-plugin": "workspace:^",
"@wingconsole/tsconfig": "workspace:^",
"bump-pack": "workspace:^",
Expand All @@ -58,7 +58,7 @@
"tsup": "^8.0.2",
"typescript": "^5.2.2",
"vite": "^4.5.2",
"vitest": "^0.34.6",
"vitest": "^1.6.0",
"webpack": "^5.88.2"
},
"volta": {
Expand Down
6 changes: 3 additions & 3 deletions apps/wing-console/console/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"ms": "^2.1.3"
},
"devDependencies": {
"@trpc/server": "^10.38.1",
"@trpc/server": "^10.45.2",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
"@types/lodash.uniqby": "^4.7.7",
"@types/ws": "^8.5.5",
"@vitest/coverage-c8": "^0.31.4",
"@vitest/coverage-v8": "^1.6.0",
"@wingconsole/error-message": "workspace:^",
"@wingconsole/eslint-plugin": "workspace:^",
"@wingconsole/tsconfig": "workspace:^",
Expand All @@ -51,7 +51,7 @@
"redis": "^4.6.8",
"tsup": "^8.0.2",
"typescript": "^5.2.2",
"vitest": "^0.34.6",
"vitest": "^1.6.0",
"ws": "^8.13.0",
"zod": "^3.22.2"
},
Expand Down
8 changes: 4 additions & 4 deletions apps/wing-console/console/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"@heroicons/react": "^2.0.18",
"@popperjs/core": "^2.11.8",
"@tanstack/react-query": "^4.33.0",
"@trpc/client": "^10.38.1",
"@trpc/react-query": "^10.38.1",
"@trpc/server": "^10.38.1",
"@trpc/client": "^10.45.2",
"@trpc/react-query": "^10.45.2",
"@trpc/server": "^10.45.2",
"@wingconsole/design-system": "workspace:^",
"classnames": "^2.5.1",
"elkjs": "^0.8.2",
Expand Down Expand Up @@ -86,7 +86,7 @@
"tsup": "^8.0.2",
"typescript": "^5.2.2",
"vite": "^4.5.2",
"vitest": "^0.34.6",
"vitest": "^1.6.0",
"webpack": "^5.88.2"
},
"volta": {
Expand Down
4 changes: 2 additions & 2 deletions apps/wing/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
"project": "./tsconfig.dev.json"
},
"extends": [
"plugin:import/typescript",
Expand All @@ -30,7 +30,7 @@
"import/resolver": {
"node": {},
"typescript": {
"project": "./tsconfig.json",
"project": "./tsconfig.dev.json",
"alwaysTryTypes": true
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/wing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^4.2.1",
"typescript": "^5.3.3",
"vitest": "^0.34.6"
"vitest": "^1.6.0"
},
"volta": {
"extends": "../../package.json"
Expand Down
6 changes: 3 additions & 3 deletions apps/wing/src/commands/test/__snapshots__/test.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ exports[`printing test reports > verbose traces are shown if debug mode is enabl
"fail ┌ hello.w » root/env0/test:test
│ Push (message=cool).
│ sleeping for 500 ms
│ Sending messages (messages=[\\"cool\\"], subscriber=sim-4).
│ Invoke (payload=\\"{\\\\\\"messages\\\\\\":[\\\\\\"cool\\\\\\"]}\\").
│ Sending messages (messages=["cool"], subscriber=sim-4).
│ Invoke (payload="{\\"messages\\":[\\"cool\\"]}").
│ Subscriber error - returning 1 messages to queue: Missing environment variable: QUEUE_HANDLE_7164aec4
│ Get (key=file.txt).
│ Invoke (payload=\\"\\").
│ Invoke (payload="").
└ Error: Object does not exist (key=file.txt)"
`;
5 changes: 5 additions & 0 deletions apps/wing/tsconfig.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*.ts"],
"exclude": []
}
4 changes: 2 additions & 2 deletions apps/wing/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"emitDecoratorMetadata": true,
"declaration": true,
"baseUrl": ".",
"esModuleInterop": true
"esModuleInterop": true,
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
"exclude": ["src/**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion apps/wing/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
// Some tests use process.chdir which is not supported in vitest's multi-thread mode
threads: false,
pool: "forks",
testTimeout: 200_000,
},
});
23 changes: 13 additions & 10 deletions examples/tests/sdk_tests/queue/retention_period.main.w
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
bring cloud;
bring util;

let var timeout = 30s;
let var retentionPeriod = 60s;
// TODO: timeout is not supported in sim - https://github.com/winglang/wing/issues/2401
if util.env("WING_TARGET") != "sim" {
let var timeout = 30s;
let var retentionPeriod = 60s;

let q = new cloud.Queue(timeout: timeout, retentionPeriod: retentionPeriod);
let q = new cloud.Queue(timeout: timeout, retentionPeriod: retentionPeriod);

new std.Test(inflight () => {
q.push("hello", "world");
new std.Test(inflight () => {
q.push("hello", "world");

util.sleep(retentionPeriod);
util.sleep(retentionPeriod);

util.waitUntil(() => {
return q.approxSize() == 0;
});
}, timeout: 2m) as "retentionPeriod";
util.waitUntil(() => {
return q.approxSize() == 0;
});
}, timeout: 2m) as "retentionPeriod";
}
2 changes: 1 addition & 1 deletion libs/@wingcloud/framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@winglang/sdk": "workspace:^",
"bump-pack": "workspace:^",
"tsup": "^8.0.2",
"vitest": "^1.3.1"
"vitest": "^1.6.0"
},
"files": [
"dist"
Expand Down
2 changes: 1 addition & 1 deletion libs/awscdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"bump-pack": "workspace:^",
"typescript": "^5.3.3",
"tsup": "^8.0.2",
"vitest": "^0.34.6"
"vitest": "^1.6.0"
},
"scripts": {
"compile": "tsc",
Expand Down
Loading

0 comments on commit 48abace

Please sign in to comment.