Skip to content

Commit

Permalink
fix: add info message when using global turbo in repo (vercel#3169)
Browse files Browse the repository at this point in the history
Adds an info message if the turbo shim detects it's being run in a
Turborepo project, but there's no local turbo binary to invoke e.g. the
Turborepo project itself
  • Loading branch information
chris-olszewski authored Jan 4, 2023
1 parent 8d16580 commit 094f89d
Show file tree
Hide file tree
Showing 19 changed files with 110 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cli/integration_tests/basic_monorepo/profile.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ Setup
Run build and record a trace
Ignore output since we want to focus on testing the generated profile
$ ${TURBO} build --profile=build.trace > turbo.log
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
Make sure the resulting trace is valid JSON
$ node -e "require('./build.trace')"
10 changes: 10 additions & 0 deletions cli/integration_tests/basic_monorepo/verbosity.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Setup

Verbosity level 1
$ ${TURBO} build -v --filter=util --force
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re)
\xe2\x80\xa2 Packages in scope: util (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
Expand All @@ -20,6 +22,8 @@ Verbosity level 1
Time:\s*[\.0-9]+m?s (re)

$ ${TURBO} build --verbosity=1 --filter=util --force
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re)
\xe2\x80\xa2 Packages in scope: util (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
Expand All @@ -38,6 +42,8 @@ Verbosity level 1

Verbosity level 2
$ ${TURBO} build -vv --filter=util --force
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re)
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash env vars: vars=\["VERCEL_ANALYTICS_ID"] (re)
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash: value=c1fb8f74a026cdb8 (re)
Expand All @@ -62,6 +68,8 @@ Verbosity level 2
Time:\s*[\.0-9]+m?s (re)

$ ${TURBO} build --verbosity=2 --filter=util --force
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re)
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash env vars: vars=\["VERCEL_ANALYTICS_ID"] (re)
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash: value=c1fb8f74a026cdb8 (re)
Expand Down Expand Up @@ -90,6 +98,8 @@ Verbosity level 2

Make sure users can only use one verbosity flag
$ ${TURBO} build -v --verbosity=1
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
error: The argument '-v...' cannot be used with '--verbosity <COUNT>'

Usage: turbo [OPTIONS] [COMMAND]
Expand Down
2 changes: 2 additions & 0 deletions cli/integration_tests/find_correct_turbo.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

Make sure exit code is 2 when no args are passed
$ CURR=$(${TURBO} --cwd ${TESTDIR}/../.. bin)
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
$ diff <(readlink -f ${TURBO}) <(readlink -f ${CURR})
12 changes: 12 additions & 0 deletions cli/integration_tests/lockfile_aware_caching/berry.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Setup

Populate cache
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -15,6 +17,8 @@ Populate cache
Time:\s*[\.0-9]+m?s (re)

$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -31,6 +35,8 @@ Only b should have a cache miss
$ patch yarn.lock yarn-lock.patch
patching file yarn.lock
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -43,6 +49,8 @@ Only b should have a cache miss


$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -58,6 +66,8 @@ Bump of root workspace invalidates all packages
$ patch yarn.lock turbo-bump.patch
patching file yarn.lock
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -69,6 +79,8 @@ Bump of root workspace invalidates all packages
Time:\s*[\.0-9]+m?s (re)

$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand Down
12 changes: 12 additions & 0 deletions cli/integration_tests/lockfile_aware_caching/npm.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Setup

Populate cache
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -19,6 +21,8 @@ Populate cache
Time:\s*[\.0-9]+m?s (re)

$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -39,6 +43,8 @@ Only b should have a cache miss
$ patch package-lock.json package-lock.patch
patching file package-lock.json
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -55,6 +61,8 @@ Only b should have a cache miss


$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -74,6 +82,8 @@ Bump of root workspace invalidates all packages
$ patch package-lock.json turbo-bump.patch
patching file package-lock.json
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -89,6 +99,8 @@ Bump of root workspace invalidates all packages
Time:\s*[\.0-9]+m?s (re)

$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand Down
12 changes: 12 additions & 0 deletions cli/integration_tests/lockfile_aware_caching/pnpm.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Setup

Populate cache
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -19,6 +21,8 @@ Populate cache
Time:\s*[\.0-9]+m?s (re)

$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -39,6 +43,8 @@ Only b should have a cache miss
$ patch pnpm-lock.yaml pnpm-lock.patch
patching file pnpm-lock.yaml
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -55,6 +61,8 @@ Only b should have a cache miss


$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -74,6 +82,8 @@ Bump of root workspace invalidates all packages
$ patch pnpm-lock.yaml turbo-bump.patch
patching file pnpm-lock.yaml
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -89,6 +99,8 @@ Bump of root workspace invalidates all packages
Time:\s*[\.0-9]+m?s (re)

$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand Down
12 changes: 12 additions & 0 deletions cli/integration_tests/lockfile_aware_caching/yarn.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Setup

Populate cache
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -19,6 +21,8 @@ Populate cache
Time:\s*[\.0-9]+m?s (re)

$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -39,6 +43,8 @@ Only b should have a cache miss
$ patch yarn.lock yarn-lock.patch
patching file yarn.lock
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -55,6 +61,8 @@ Only b should have a cache miss


$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -74,6 +82,8 @@ Bump of root workspace invalidates all packages
$ patch yarn.lock turbo-bump.patch
patching file yarn.lock
$ ${TURBO} build --filter=a
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: a (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand All @@ -89,6 +99,8 @@ Bump of root workspace invalidates all packages
Time:\s*[\.0-9]+m?s (re)

$ ${TURBO} build --filter=b
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: b (esc)
\xe2\x80\xa2 Running build in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand Down
6 changes: 6 additions & 0 deletions cli/integration_tests/monorepo_one_script_error/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Setup
Check error is properly reported
Note that npm reports any failed script as exit code 1, even though we "exit 2"
$ ${TURBO} error
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: my-app (esc)
\xe2\x80\xa2 Running error in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand Down Expand Up @@ -36,6 +38,8 @@ Note that npm reports any failed script as exit code 1, even though we "exit 2"

Make sure error isn't cached
$ ${TURBO} error
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: my-app (esc)
\xe2\x80\xa2 Running error in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand Down Expand Up @@ -67,6 +71,8 @@ Make sure error isn't cached

Running with --output-mode=errors-only gives error output only
$ ${TURBO} --output-logs=errors-only error
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Packages in scope: my-app (esc)
\xe2\x80\xa2 Running error in 1 packages (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
Expand Down
4 changes: 4 additions & 0 deletions cli/integration_tests/single_package/dry-run.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Setup

Check
$ ${TURBO} run build --dry --single-package
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo

Tasks to Run
build
Expand All @@ -18,6 +20,8 @@ Check
Dependendents =

$ ${TURBO} run build --dry=json --single-package
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
{
"tasks": [
{
Expand Down
2 changes: 2 additions & 0 deletions cli/integration_tests/single_package/graph.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Setup

Graph
$ ${TURBO} run build --single-package --graph
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo

digraph {
\tcompound = "true" (esc)
Expand Down
4 changes: 4 additions & 0 deletions cli/integration_tests/single_package/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Setup

Check
$ ${TURBO} run build --single-package
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Running build (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
build: cache miss, executing 7bf32e1dedb04a5d
Expand All @@ -18,6 +20,8 @@ Check

Run a second time, verify caching works because there is a config
$ ${TURBO} run build --single-package
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
\xe2\x80\xa2 Running build (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
build: cache hit, replaying output 7bf32e1dedb04a5d
Expand Down
4 changes: 4 additions & 0 deletions cli/integration_tests/single_package_deps/dry-run.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Setup

Check
$ ${TURBO} run test --dry --single-package
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo

Tasks to Run
build
Expand All @@ -28,6 +30,8 @@ Check
Dependendents =

$ ${TURBO} run test --dry=json --single-package
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo
{
"tasks": [
{
Expand Down
2 changes: 2 additions & 0 deletions cli/integration_tests/single_package_deps/graph.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Setup

Graph
$ ${TURBO} run test --single-package --graph
No local turbo binary found at: .+node_modules/\.bin/turbo (re)
Running command as global turbo

digraph {
\tcompound = "true" (esc)
Expand Down
Loading

0 comments on commit 094f89d

Please sign in to comment.