这是indexloc提供的服务,不要输入任何密码
Skip to content

create-turbo: improve test cases and make them pass #1655

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

Merged
merged 2 commits into from
Aug 15, 2022

Conversation

mehulkar
Copy link
Contributor

@mehulkar mehulkar commented Aug 8, 2022

  • Make existing tests pass

  • Add GH action to run tests in CI

    Set up a new Github Action that builds the turbo CLI (since that is
    required for the create-turbo tests) and runs the JS tests for that
    package.

    Notable things:

    • Installs yarn and disables corepack as part of the test suite. This
      is the pristine state we want for the tests that exist today. For
      future tests cases that have a different setup, we may need to
      modify this more.

    • Disables Windows tests. This yarn setup on Windows does not seem to
      work, but this gets us one step forward.

@vercel
Copy link

vercel bot commented Aug 8, 2022

@mehulkar is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@mehulkar mehulkar force-pushed the mk/add-to-ci branch 2 times, most recently from d7addd8 to fc0b6b8 Compare August 8, 2022 22:23
@mehulkar mehulkar mentioned this pull request Aug 8, 2022
@mehulkar mehulkar added the pr: on hold Pull requests that are "on hold" and should not be merged label Aug 8, 2022
Copy link
Contributor

@nathanhammond nathanhammond left a comment

Choose a reason for hiding this comment

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

@mehulkar mehulkar force-pushed the mk/add-to-ci branch 4 times, most recently from 600dc50 to 6331015 Compare August 9, 2022 22:43
@mehulkar mehulkar requested a review from nathanhammond August 9, 2022 22:52
os: [
ubuntu-latest,
macos-latest,
# windows-latest,
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'd like to come back to this

Copy link
Member

Choose a reason for hiding this comment

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

A comment detailing what issues were encountered would be helpful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It didn't seem to pass in CI and I wanted to isolate the issue and fix. I'm not even sure at this point it's a real problem

@mehulkar mehulkar force-pushed the mk/add-to-ci branch 3 times, most recently from 8881c8a to 370d010 Compare August 10, 2022 15:59
@vercel
Copy link

vercel bot commented Aug 10, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
turbo-site ✅ Ready (Inspect) Visit Preview Aug 15, 2022 at 3:25PM (UTC)

@@ -0,0 +1,78 @@
name: CI JS
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this 100% a copy of ci-go with the npm section and the create-turbo tests added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pretty much, but excludes the examples action (terminology?) and excludes the Go tests

os: [
ubuntu-latest,
macos-latest,
# windows-latest,
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to track down previous runs, got a link? (Don't mind tabling, but I do want to see it.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/vercel/turborepo/runs/7777949925?check_suite_focus=true

I tthink the issue is that yarn -v is erroring or the npm i -g yarn isn't working. Something for a followup PR

@@ -23,6 +23,8 @@ const DEFAULT_JEST_TIMEOUT = 10000;

describe("create-turbo cli", () => {
beforeAll(() => {
execSync("corepack disable", { stdio: "ignore" });
Copy link
Contributor

Choose a reason for hiding this comment

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

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 think so. We could also just not install corepack in ci-js.yml, but I did it anyway so CI matches what we'll have on dev machines.

Although if/when that issue is resolved, we might still want this so we can represent a real npx usecase where a packageManager (or its shim) isn't available and we really do want to show the "not available" case. I don't have a foolproof way forward to address both cases

Copy link
Contributor

Choose a reason for hiding this comment

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

(That link was mostly to get a pointer to this discussion upstream.)

Comment on lines +55 to +56
- name: Setup Yarn
run: npm i -g yarn
Copy link
Contributor

Choose a reason for hiding this comment

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

@mehulkar mehulkar requested a review from nathanhammond August 11, 2022 00:32
@mehulkar mehulkar changed the title Add a new action to run create-turbo package tests in CI create-turbo: improve test cases and make them pass Aug 11, 2022
@mehulkar mehulkar removed the pr: on hold Pull requests that are "on hold" and should not be merged label Aug 11, 2022
Copy link
Member

@tknickman tknickman left a comment

Choose a reason for hiding this comment

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

One comment about an extra test case, but otherwise looks good

);

expect(messages[2]).toMatch(
/^>>> Creating a new turborepo with the following:/
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a check for:

>>> Success! Created a new Turborepo at "${DEFAULT_APP_NAME}".

as well? This would catch that pnpm error we had a few weeks ago (the install actually worked, pnpm was just non-zero exiting because it was upset about peers. (which caused us to not show this message and show install has failed

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 can add that, but I wasn't able to reproduce that failure, for what it's worth :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

after this PR when tests are running in CI, we can have a bit more confidence about adding new tests if we have regressions again.

@mehulkar mehulkar requested a review from tknickman August 11, 2022 20:53
Copy link
Contributor

@gsoltis gsoltis left a comment

Choose a reason for hiding this comment

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

I'll defer to @nathanhammond for final LGTM since I think I'm a little out of the loop on the context here.

In general, this looks fine to me. Just getting these running seems like a step in the right direction. Some things we might want to consider adding, now or in the future

  1. displaying the versions of the package managers used, if possible. if an upgrade breaks something, that will help us know
  2. are we going to test old and new yarn ("berry")?

@mehulkar
Copy link
Contributor Author

Some things we might want to consider adding, now or in the future

Good ideas. I think it makes sense to get these running first and add more as needed

are we going to test old and new yarn ("berry")?

I'd have to think about how to make this possible, since the CI setup (rather than the test case itself) is installing and activating the yarn/npm/etc.

@gsoltis
Copy link
Contributor

gsoltis commented Aug 12, 2022

Test failure? Or is it flaky?

@mehulkar
Copy link
Contributor Author

Test failure? Or is it flaky?

I think they are flaky. Looks like it's the Go e2e ones, which shouldn't be affected by this PR.

cli:test: > make test-go
[26](https://github.com/vercel/turborepo/runs/7840795316?check_suite_focus=true#step:10:27)
cli:test: 
[27](https://github.com/vercel/turborepo/runs/7840795316?check_suite_focus=true#step:10:28)
cli:test: go test -race ./...

...[snipped]...

cli:test: Started
[56](https://github.com/vercel/turborepo/runs/7840795316?check_suite_focus=true#step:10:57)
cli:test: --- FAIL: TestStart (0.20s)
[57](https://github.com/vercel/turborepo/runs/7840795316?check_suite_focus=true#step:10:58)
cli:test:     child_test.go:159: process should have exited

@gsoltis
Copy link
Contributor

gsoltis commented Aug 15, 2022

@mehulkar I think one of the js tests is also failing

- Make existing tests pass
- Add GH action to run tests in CI

  Set up a new Github Action that builds the turbo CLI (since that is
  required for the create-turbo tests) and runs the JS tests for that
  package.

  Notable things:

  - Installs yarn and disables corepack as part of the test suite. This
    is the pristine state we want for the tests that exist today. For
    future tests cases that have a different setup, we may need to
    modify this more.

  - Disables Windows tests. This yarn setup on Windows does not seem to
    work, but this gets us one step forward.
@mehulkar
Copy link
Contributor Author

@mehulkar I think one of the js tests is also failing

npm install, et al are timing out, even at 50s timeout. Removed them from this PR, and will submit separately to isolate and add logging etc.

@kodiakhq kodiakhq bot merged commit 8c98361 into vercel:main Aug 15, 2022
@mehulkar mehulkar deleted the mk/add-to-ci branch August 15, 2022 17:54
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.

5 participants