Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Convert ATs to Vitest #1181

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

chore: Convert ATs to Vitest #1181

wants to merge 23 commits into from

Conversation

joe-yeager
Copy link
Contributor

@joe-yeager joe-yeager commented Sep 23, 2024

Description and Context

  • Updates the Acceptance tests to use vitest
  • Refactors the acceptance tests to be self contained so they can be safely ran in parallel
  • Updates the test suites to run in parallel
  • Updates the acceptance tests to no longer open a browser when open is called

TODO

Who to Notify

@kemmerle @camden11 @brandenrodgers

Comment on lines +9 to +10
testTimeout: 30000,
hookTimeout: 20000,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt the tests should take this long, I just went a little high to prevent false positives

@joe-yeager joe-yeager marked this pull request as ready for review September 25, 2024 19:23
opts.env = { BROWSER: 'none' };
}
// Prevent the browser from opening when `open` is called
opts.env = { BROWSER: 'none' };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the check for the headless config value, because I can't think of why we would want to open browser windows. We don't plan on interacting with them from the tests and all it does is make your system borderline unusable for the duration of the tests.

@@ -66,7 +51,7 @@ const getTestConfig = () => {
}

if (!config.cliPath && !config.cliVersion) {
const defaultPath = path.join(process.cwd(), DEFAULT_CLI_PATH);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEFAULT_CLI_PATH was only used in one place and it's relative to the cwd, so it seem to make more sense to just inline it.

"js-yaml": "^4.0.0",
"rimraf": "^3.0.2",
"uuid": "^10.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the uuid lib to help with file name randomization

import rimraf from 'rimraf';
import { v4 as uuidv4 } from 'uuid';

export class TestState {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a helper class to manage all of the state needed to be able to run the tests. It helps to segment the tests so they all have their own copy of the test state and can run in isolation from one another. It handles the generation of a config file with a semi-randomized name so file system collisions should not happen between tests.

.gitignore Outdated Show resolved Hide resolved

# Acceptance Tests
acceptance-tests/my-project
acceptance-tests/*.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call 👍

Copy link
Contributor

@camden11 camden11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This seems like such a huge upgrade. Everything here looks good to me aside from a few tiny things.

I'm having trouble getting these to run locally. Is there anything special you need to do? Ran yarn and yarn test but getting errors

Error: Invalid process path hs

acceptance-tests/lib/env.ts Outdated Show resolved Hide resolved
acceptance-tests/tests/list.spec.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@brandenrodgers brandenrodgers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lgtm! We chatted about this already, but just a reminder that this will cause our "latest publish" tests to fail because it makes them run correctly and there's a bug in hs project create

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants