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

Running create-turbo tests #216

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
Dec 12, 2021
Merged

Conversation

seanyusa
Copy link
Contributor

@seanyusa seanyusa commented Dec 12, 2021

Got tests running for create-turbo.


Initially running into:

$ jest
 FAIL  __tests__/cli.test.ts
  ● Test suite failed to run

    Jest encountered an unexpected token

    Details:

    /Users/sean/development/turborepo/create-turbo/node_modules/strip-ansi/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import ansiRegex from 'ansi-regex';
                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module

This was happening for both the strip-ansi and the ansi-regex libraries.

The combination of the changes in create-turbo/jest.config.js and create-turbo/tsconfig.json allows the specific modules to be correctly transformed and run by jest/ts-jest. Not 100% sure if this is the ideal answer here.
Commit: 0377412


Then fixed the "guides the user through the process" test to successfully finish by using jest.DoneCallback.
The specific test was exiting before anything was checked and notifying that "Jest did not exit one second after the test run has completed." after the tests ran and it would hang:

Test Suites: 1 passed, 1 total
Tests:       5 passed, 5 total
Snapshots:   2 passed, 2 total
Time:        4.511 s
Ran all test suites.
Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

Commit: ef9a40a

Test Plan

cd create-turbo
yarn test

Output

$ jest
 PASS  __tests__/cli.test.ts (6.007 s)
  create-turbo cli
    ✓ guides the user through the process (1453 ms)
    the --version flag
      ✓ prints the current version (392 ms)
    the -v flag
      ✓ prints the current version (385 ms)
    the --help flag
      ✓ prints help info (389 ms)
    the -h flag
      ✓ prints help info (385 ms)

Test Suites: 1 passed, 1 total
Tests:       5 passed, 5 total
Snapshots:   2 passed, 2 total
Time:        6.167 s, estimated 8 s
Ran all test suites.

Runs with turbo too! (from the root):

yarn turbo run test

Output

$ ./turbow.sh run test
• Running test in 3 packages
cli:test: cache hit, replaying output 903a6bf0f34c97a9
create-turbo:test: cache hit, replaying output bc2b8a8d956c7662
cli:test: $ go test -race ./internal/...
cli:test: ?   	turbo/internal/api	[no test files]
cli:test: ?   	turbo/internal/backends	[no test files]
cli:test: ?   	turbo/internal/backends/nodejs	[no test files]
cli:test: ?   	turbo/internal/cache	[no test files]
cli:test: ?   	turbo/internal/client	[no test files]
cli:test: ?   	turbo/internal/config	[no test files]
cli:test: ?   	turbo/internal/context	[no test files]
cli:test: ok  	turbo/internal/core	(cached)
cli:test: ok  	turbo/internal/fs	0.237s
cli:test: ?   	turbo/internal/info	[no test files]
cli:test: ?   	turbo/internal/login	[no test files]
cli:test: ok  	turbo/internal/logstreamer	0.212s
cli:test: ?   	turbo/internal/prune	[no test files]
cli:test: ok  	turbo/internal/run	0.316s
cli:test: ?   	turbo/internal/scm	[no test files]
cli:test: ?   	turbo/internal/ui	[no test files]
cli:test: ok  	turbo/internal/ui/term	0.337s
cli:test: ok  	turbo/internal/util	(cached)
cli:test: ?   	turbo/internal/xxhash	[no test files]
create-turbo:test: $ jest
create-turbo:test: PASS __tests__/cli.test.ts (7.991 s)
create-turbo:test:   create-turbo cli
create-turbo:test:     ✓ guides the user through the process (1397 ms)
create-turbo:test:     the --version flag
create-turbo:test:       ✓ prints the current version (381 ms)
create-turbo:test:     the -v flag
create-turbo:test:       ✓ prints the current version (368 ms)
create-turbo:test:     the --help flag
create-turbo:test:       ✓ prints help info (370 ms)
create-turbo:test:     the -h flag
create-turbo:test:       ✓ prints help info (366 ms)
create-turbo:test:
create-turbo:test: Test Suites: 1 passed, 1 total
create-turbo:test: Tests:       5 passed, 5 total
create-turbo:test: Snapshots:   2 passed, 2 total
create-turbo:test: Time:        8.129 s
create-turbo:test: Ran all test suites.

 Tasks:    2 successful, 2 total
Cached:    2 cached, 2 total
  Time:    89ms >>> FULL TURBO

✨  Done in 0.55s.

@vercel
Copy link

vercel bot commented Dec 12, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/vercel/turbo-site/1XNdoy6qoWKT725dVS1wUSMsthyP
✅ Preview: https://turbo-site-git-fork-seanyusa-create-turbo-tests.vercel.sh

@jaredpalmer
Copy link
Contributor

🏆 Awesome PR!

@jaredpalmer jaredpalmer merged commit b6f589c into vercel:main Dec 12, 2021
@seanyusa seanyusa deleted the create-turbo-tests branch December 12, 2021 21:52
sokra pushed a commit that referenced this pull request Oct 25, 2022
This adds test runs for integration tests in `__skipped__` directories,
ensuring that they fail, otherwise they should probably be unskipped.

Test Plan: Temporarily moved a succeeding test into a `__skipped__`
directory and ensured that cargo test began failing that test.
sokra pushed a commit that referenced this pull request Oct 25, 2022
Reverts vercel/the-three-body#213
jridgewell pushed a commit to vercel/next.js that referenced this pull request Mar 10, 2023
This adds test runs for integration tests in `__skipped__` directories,
ensuring that they fail, otherwise they should probably be unskipped.

Test Plan: Temporarily moved a succeeding test into a `__skipped__`
directory and ensured that cargo test began failing that test.
sokra pushed a commit to vercel/next.js that referenced this pull request Mar 13, 2023
This adds test runs for integration tests in `__skipped__` directories,
ensuring that they fail, otherwise they should probably be unskipped.

Test Plan: Temporarily moved a succeeding test into a `__skipped__`
directory and ensured that cargo test began failing that test.
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.

2 participants