Skip to content

Commit

Permalink
chore: global turbo tests (#3011)
Browse files Browse the repository at this point in the history
Some quick integration tests to check on the shim logic
  • Loading branch information
chris-olszewski committed Dec 14, 2022
1 parent f3876c4 commit 0816a51
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cli/integration_tests/global_turbo/mock_turbo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo $@
3 changes: 3 additions & 0 deletions cli/integration_tests/global_turbo/package_template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "turbo"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "test-turbo-project",
"version" "0.0.1"
}
Empty file.
8 changes: 8 additions & 0 deletions cli/integration_tests/global_turbo/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]})
VERSION=$1
mkdir -p node_modules/turbo node_modules/.bin
cp -a ${SCRIPT_DIR}/repo_with_local/. $(pwd)/
cat ${SCRIPT_DIR}/package_template.json | jq --argjson ver \"${VERSION}\" '{ name: .name, version: $ver}' > node_modules/turbo/package.json
cp ${SCRIPT_DIR}/mock_turbo.sh node_modules/.bin/turbo
37 changes: 37 additions & 0 deletions cli/integration_tests/global_turbo/uses_local.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Setup
$ . ${TESTDIR}/../setup.sh

Make sure we use local and don't pass --skip-infer to old binary
$ . ${TESTDIR}/setup.sh 1.2.3
$ ${TURBO} build --filter foo
Running local turbo binary in .*node_modules/.bin/turbo (re)
build --filter foo --single-package --
Make sure we use local and pass --skip-infer to newer binary
$ . ${TESTDIR}/setup.sh 1.8.9
$ ${TURBO} build --filter foo
Running local turbo binary in .*node_modules/.bin/turbo (re)
--skip-infer build --filter foo --single-package --
It finds repo root and uses correct version
$ cd subdir
$ ${TURBO} build --filter foo
Running local turbo binary in .*node_modules/.bin/turbo (re)
--skip-infer build --filter foo --single-package --
$ cd ..
It respects cwd
$ ROOT=$(pwd); cd ..
$ ${TURBO} build --filter foo --cwd ${ROOT}
Running local turbo binary in .*node_modules/.bin/turbo (re)
--skip-infer build --filter foo --single-package --
It respects cwd and finds repo root
$ ${TURBO} build --filter foo --cwd ${ROOT}/subdir
Running local turbo binary in .*node_modules/.bin/turbo (re)
--skip-infer build --filter foo --single-package --

0 comments on commit 0816a51

Please sign in to comment.