Skip to content

Commit

Permalink
chore: update integration tests to have packageManager
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-olszewski committed Apr 30, 2024
1 parent 5383781 commit 667d38b
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 72 deletions.
7 changes: 6 additions & 1 deletion turborepo-tests/helpers/setup_integration_test.sh
Expand Up @@ -3,7 +3,12 @@
set -eo pipefail

FIXTURE_NAME="${1-basic_monorepo}"
PACKAGE_MANAGER="$2"

# Default to version of npm installed with Node 18.20.2
PACKAGE_MANAGER="npm@10.5.0"
if [[ $2 != "" ]]; then
PACKAGE_MANAGER="$2"
fi

THIS_DIR=$(dirname "${BASH_SOURCE[0]}")
MONOREPO_ROOT_DIR="$THIS_DIR/../.."
Expand Down
Expand Up @@ -13,7 +13,7 @@ Setup
"rootKey": "HEY STELLLLLLLAAAAAAAAAAAAA",
"files": {
"package-lock.json": "1c117cce37347befafe3a9cba1b8a609b3600021",
"package.json": "5519edda652c463054307421a3c05ff49f080328"
"package.json": "8606ff4b95a5330740d8d9d0948faeada64f1f32"
},
"hashOfExternalDependencies": "",
"globalDotEnv": null,
Expand All @@ -33,11 +33,11 @@ Setup
{
"taskId": "build",
"task": "build",
"hash": "e46d6df5143cae99",
"hash": "bfac661137d88079",
"inputs": {
".gitignore": "03b541460c1b836f96f9c0a941ceb48e91a9fd83",
"package-lock.json": "1c117cce37347befafe3a9cba1b8a609b3600021",
"package.json": "5519edda652c463054307421a3c05ff49f080328",
"package.json": "8606ff4b95a5330740d8d9d0948faeada64f1f32",
"somefile.txt": "45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
},
"hashOfExternalDependencies": "",
Expand Down
Expand Up @@ -11,7 +11,7 @@ Setup
"rootKey": "HEY STELLLLLLLAAAAAAAAAAAAA",
"files": {
"package-lock.json": "1c117cce37347befafe3a9cba1b8a609b3600021",
"package.json": "5519edda652c463054307421a3c05ff49f080328",
"package.json": "8606ff4b95a5330740d8d9d0948faeada64f1f32",
"somefile.txt": "45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
},
"hashOfExternalDependencies": "",
Expand All @@ -32,11 +32,11 @@ Setup
{
"taskId": "build",
"task": "build",
"hash": "f09bf783beacf5c9",
"hash": "45fcb56a23295f63",
"inputs": {
".gitignore": "03b541460c1b836f96f9c0a941ceb48e91a9fd83",
"package-lock.json": "1c117cce37347befafe3a9cba1b8a609b3600021",
"package.json": "5519edda652c463054307421a3c05ff49f080328",
"package.json": "8606ff4b95a5330740d8d9d0948faeada64f1f32",
"somefile.txt": "45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
"turbo.json": "bf9ddbce36808b6ea5a0ea2b7ceb400ee6c42c4c"
},
Expand Down Expand Up @@ -89,11 +89,11 @@ Setup
{
"taskId": "test",
"task": "test",
"hash": "8bfab5dc6b4ccb3b",
"hash": "314a0e5a10072ae2",
"inputs": {
".gitignore": "03b541460c1b836f96f9c0a941ceb48e91a9fd83",
"package-lock.json": "1c117cce37347befafe3a9cba1b8a609b3600021",
"package.json": "5519edda652c463054307421a3c05ff49f080328",
"package.json": "8606ff4b95a5330740d8d9d0948faeada64f1f32",
"somefile.txt": "45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
"turbo.json": "bf9ddbce36808b6ea5a0ea2b7ceb400ee6c42c4c"
},
Expand Down
6 changes: 3 additions & 3 deletions turborepo-tests/integration/tests/dry-json/single-package.t
Expand Up @@ -11,7 +11,7 @@ Setup
"rootKey": "HEY STELLLLLLLAAAAAAAAAAAAA",
"files": {
"package-lock.json": "1c117cce37347befafe3a9cba1b8a609b3600021",
"package.json": "5519edda652c463054307421a3c05ff49f080328",
"package.json": "8606ff4b95a5330740d8d9d0948faeada64f1f32",
"somefile.txt": "45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
},
"hashOfExternalDependencies": "",
Expand All @@ -32,11 +32,11 @@ Setup
{
"taskId": "build",
"task": "build",
"hash": "f09bf783beacf5c9",
"hash": "45fcb56a23295f63",
"inputs": {
".gitignore": "03b541460c1b836f96f9c0a941ceb48e91a9fd83",
"package-lock.json": "1c117cce37347befafe3a9cba1b8a609b3600021",
"package.json": "5519edda652c463054307421a3c05ff49f080328",
"package.json": "8606ff4b95a5330740d8d9d0948faeada64f1f32",
"somefile.txt": "45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
"turbo.json": "bf9ddbce36808b6ea5a0ea2b7ceb400ee6c42c4c"
},
Expand Down
45 changes: 0 additions & 45 deletions turborepo-tests/integration/tests/package-manager.t
Expand Up @@ -39,48 +39,3 @@ Set package manager to pnpm in package.json
Run test run
$ TURBO_LOG_VERBOSITY=off ${TURBO} info --json | jq .packageManager
"pnpm"

Clear package manager field in package.json
$ jq 'del(.packageManager)' package.json > package.json.tmp && mv package.json.tmp package.json

Delete package-lock.json
$ rm package-lock.json

Use yarn 1.22.19
$ corepack prepare yarn@1.22.19 --activate
Preparing yarn@1.22.19 for immediate activation...

Create yarn.lock
$ touch yarn.lock

Run test run
$ TURBO_LOG_VERBOSITY=off ${TURBO} info --json | jq .packageManager
"yarn"

Use yarn 3.5.1
$ corepack prepare yarn@3.5.1 --activate
Preparing yarn@3.5.1 for immediate activation...

Run test run
$ TURBO_LOG_VERBOSITY=off ${TURBO} info --json | jq .packageManager
"berry"

Delete yarn.lock
$ rm yarn.lock

Create pnpm-lock.yaml
$ touch pnpm-lock.yaml

Run test run
$ TURBO_LOG_VERBOSITY=off ${TURBO} info --json | jq .packageManager
"pnpm"

Delete pnpm-lock.yaml
$ rm pnpm-lock.yaml

Create package-lock.json
$ touch package-lock.json

Run test run
$ TURBO_LOG_VERBOSITY=off ${TURBO} info --json | jq .packageManager
"npm"
Expand Up @@ -18,7 +18,7 @@ Check
Tasks to Run
build
Task = build\s* (re)
Hash = f09bf783beacf5c9\s* (re)
Hash = 45fcb56a23295f63
Cached \(Local\) = false\s* (re)
Cached \(Remote\) = false\s* (re)
Command = echo building > foo.txt\s* (re)
Expand Down
Expand Up @@ -20,7 +20,7 @@ Check
Tasks to Run
build
Task = build\s* (re)
Hash = e46d6df5143cae99\s* (re)
Hash = bfac661137d88079
Cached \(Local\) = false\s* (re)
Cached \(Remote\) = false\s* (re)
Command = echo building > foo.txt\s* (re)
Expand Down Expand Up @@ -52,7 +52,7 @@ Run real once
$ ${TURBO} run build
\xe2\x80\xa2 Running build (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
build: cache bypass, force executing e46d6df5143cae99
build: cache bypass, force executing bfac661137d88079
build:
build: > build
build: > echo building > foo.txt
Expand All @@ -66,7 +66,7 @@ Run a second time, verify no caching because there is no config
$ ${TURBO} run build
\xe2\x80\xa2 Running build (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
build: cache bypass, force executing e46d6df5143cae99
build: cache bypass, force executing bfac661137d88079
build:
build: > build
build: > echo building > foo.txt
Expand Down
4 changes: 2 additions & 2 deletions turborepo-tests/integration/tests/run/single-package/run.t
Expand Up @@ -5,7 +5,7 @@ Check
$ ${TURBO} run build
\xe2\x80\xa2 Running build (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
build: cache miss, executing f09bf783beacf5c9
build: cache miss, executing 45fcb56a23295f63
build:
build: > build
build: > echo building > foo.txt
Expand All @@ -22,7 +22,7 @@ Run a second time, verify caching works because there is a config
$ ${TURBO} run build
\xe2\x80\xa2 Running build (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
build: cache hit, replaying logs f09bf783beacf5c9
build: cache hit, replaying logs 45fcb56a23295f63
build:
build: > build
build: > echo building > foo.txt
Expand Down
Expand Up @@ -18,7 +18,7 @@ Check
Tasks to Run
build
Task = build\s* (re)
Hash = f09bf783beacf5c9\s* (re)
Hash = 45fcb56a23295f63
Cached \(Local\) = false\s* (re)
Cached \(Remote\) = false\s* (re)
Command = echo building > foo.txt\s* (re)
Expand All @@ -37,7 +37,7 @@ Check
Framework =\s* (re)
test
Task = test\s* (re)
Hash = 8bfab5dc6b4ccb3b\s* (re)
Hash = 314a0e5a10072ae2
Cached \(Local\) = false\s* (re)
Cached \(Remote\) = false\s* (re)
Command = cat foo.txt\s* (re)
Expand Down
Expand Up @@ -5,12 +5,12 @@ Check
$ ${TURBO} run test
\xe2\x80\xa2 Running test (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
build: cache miss, executing f09bf783beacf5c9
build: cache miss, executing 45fcb56a23295f63
build:
build: > build
build: > echo building > foo.txt
build:
test: cache miss, executing 8bfab5dc6b4ccb3b
test: cache miss, executing 314a0e5a10072ae2
test:
test: > test
test: > cat foo.txt
Expand All @@ -25,12 +25,12 @@ Run a second time, verify caching works because there is a config
$ ${TURBO} run test
\xe2\x80\xa2 Running test (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
build: cache hit, replaying logs f09bf783beacf5c9
build: cache hit, replaying logs 45fcb56a23295f63
build:
build: > build
build: > echo building > foo.txt
build:
test: cache hit, replaying logs 8bfab5dc6b4ccb3b
test: cache hit, replaying logs 314a0e5a10072ae2
test:
test: > test
test: > cat foo.txt
Expand All @@ -45,8 +45,8 @@ Run with --output-logs=hash-only
$ ${TURBO} run test --output-logs=hash-only
\xe2\x80\xa2 Running test (esc)
\xe2\x80\xa2 Remote caching disabled (esc)
build: cache hit, suppressing logs f09bf783beacf5c9
test: cache hit, suppressing logs 8bfab5dc6b4ccb3b
build: cache hit, suppressing logs 45fcb56a23295f63
test: cache hit, suppressing logs 314a0e5a10072ae2

Tasks: 2 successful, 2 total
Cached: 2 cached, 2 total
Expand Down
Expand Up @@ -11,7 +11,7 @@ This tests asserts that root tasks can depend on workspace#task
lib-a:build: > echo build-lib-a
lib-a:build:
lib-a:build: build-lib-a
//:mytask: cache miss, executing 3ae433af4902b1a0
//:mytask: cache miss, executing 8546b6a2ce1f1d1f
//:mytask:
//:mytask: > mytask
//:mytask: > echo root-mytask
Expand Down

0 comments on commit 667d38b

Please sign in to comment.