diff options
| author | 2023-04-28 01:36:44 +0800 | |
|---|---|---|
| committer | 2023-04-28 01:36:44 +0800 | |
| commit | dd84b9d64fb98746a230cd24233ff50a562c39c9 (patch) | |
| tree | b583261ef00b3afe72ec4d6dacb31e57779a6faf /cli/internal/graph/graph_test.go | |
| parent | 0b46fcd72ac34382387b2bcf9095233efbcc52f4 (diff) | |
| download | HydroRoll-dd84b9d64fb98746a230cd24233ff50a562c39c9.tar.gz HydroRoll-dd84b9d64fb98746a230cd24233ff50a562c39c9.zip | |
Diffstat (limited to 'cli/internal/graph/graph_test.go')
| -rw-r--r-- | cli/internal/graph/graph_test.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cli/internal/graph/graph_test.go b/cli/internal/graph/graph_test.go new file mode 100644 index 0000000..9323e19 --- /dev/null +++ b/cli/internal/graph/graph_test.go @@ -0,0 +1,50 @@ +package graph + +import ( + "testing" + + "gotest.tools/v3/assert" +) + +func Test_CommandsInvokingTurbo(t *testing.T) { + type testCase struct { + command string + match bool + } + testCases := []testCase{ + { + "turbo run foo", + true, + }, + { + "rm -rf ~/Library/Caches/pnpm && turbo run foo && rm -rf ~/.npm", + true, + }, + { + "FLAG=true turbo run foo", + true, + }, + { + "npx turbo run foo", + true, + }, + { + "echo starting; turbo foo; echo done", + true, + }, + // We don't catch this as if people are going to try to invoke the turbo + // binary directly, they'll always be able to work around us. + { + "./node_modules/.bin/turbo foo", + false, + }, + { + "rm -rf ~/Library/Caches/pnpm && rm -rf ~/Library/Caches/turbo && rm -rf ~/.npm && rm -rf ~/.pnpm-store && rm -rf ~/.turbo", + false, + }, + } + + for _, tc := range testCases { + assert.Equal(t, commandLooksLikeTurbo(tc.command), tc.match, tc.command) + } +} |
