aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cli/internal/run/run_spec_test.go
diff options
context:
space:
mode:
author简律纯 <hsiangnianian@outlook.com>2023-04-28 01:36:55 +0800
committer简律纯 <hsiangnianian@outlook.com>2023-04-28 01:36:55 +0800
commitfc8c5fdce62fb229202659408798a7b6c98f6e8b (patch)
tree7554f80e50de4af6fd255afa7c21bcdd58a7af34 /cli/internal/run/run_spec_test.go
parentdd84b9d64fb98746a230cd24233ff50a562c39c9 (diff)
downloadHydroRoll-fc8c5fdce62fb229202659408798a7b6c98f6e8b.tar.gz
HydroRoll-fc8c5fdce62fb229202659408798a7b6c98f6e8b.zip
Diffstat (limited to 'cli/internal/run/run_spec_test.go')
-rw-r--r--cli/internal/run/run_spec_test.go107
1 files changed, 0 insertions, 107 deletions
diff --git a/cli/internal/run/run_spec_test.go b/cli/internal/run/run_spec_test.go
deleted file mode 100644
index 2bcfe2b..0000000
--- a/cli/internal/run/run_spec_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-package run
-
-import (
- "testing"
-
- "github.com/vercel/turbo/cli/internal/scope"
- "github.com/vercel/turbo/cli/internal/util"
-)
-
-func TestSynthesizeCommand(t *testing.T) {
- testCases := []struct {
- filterPatterns []string
- legacyFilter scope.LegacyFilter
- passThroughArgs []string
- parallel bool
- continueOnError bool
- dryRun bool
- dryRunJSON bool
- tasks []string
- expected string
- }{
- {
- filterPatterns: []string{"my-app"},
- tasks: []string{"build"},
- expected: "turbo run build --filter=my-app",
- },
- {
- filterPatterns: []string{"my-app"},
- tasks: []string{"build"},
- passThroughArgs: []string{"-v", "--foo=bar"},
- expected: "turbo run build --filter=my-app -- -v --foo=bar",
- },
- {
- legacyFilter: scope.LegacyFilter{
- Entrypoints: []string{"my-app"},
- SkipDependents: true,
- },
- tasks: []string{"build"},
- passThroughArgs: []string{"-v", "--foo=bar"},
- expected: "turbo run build --filter=my-app -- -v --foo=bar",
- },
- {
- legacyFilter: scope.LegacyFilter{
- Entrypoints: []string{"my-app"},
- SkipDependents: true,
- },
- filterPatterns: []string{"other-app"},
- tasks: []string{"build"},
- passThroughArgs: []string{"-v", "--foo=bar"},
- expected: "turbo run build --filter=other-app --filter=my-app -- -v --foo=bar",
- },
- {
- legacyFilter: scope.LegacyFilter{
- Entrypoints: []string{"my-app"},
- IncludeDependencies: true,
- Since: "some-ref",
- },
- filterPatterns: []string{"other-app"},
- tasks: []string{"build"},
- expected: "turbo run build --filter=other-app --filter=...my-app...[some-ref]...",
- },
- {
- filterPatterns: []string{"my-app"},
- tasks: []string{"build"},
- parallel: true,
- continueOnError: true,
- expected: "turbo run build --filter=my-app --parallel --continue",
- },
- {
- filterPatterns: []string{"my-app"},
- tasks: []string{"build"},
- dryRun: true,
- expected: "turbo run build --filter=my-app --dry",
- },
- {
- filterPatterns: []string{"my-app"},
- tasks: []string{"build"},
- dryRun: true,
- dryRunJSON: true,
- expected: "turbo run build --filter=my-app --dry=json",
- },
- }
-
- for _, testCase := range testCases {
- testCase := testCase
- t.Run(testCase.expected, func(t *testing.T) {
- o := Opts{
- scopeOpts: scope.Opts{
- FilterPatterns: testCase.filterPatterns,
- LegacyFilter: testCase.legacyFilter,
- },
- runOpts: util.RunOpts{
- PassThroughArgs: testCase.passThroughArgs,
- Parallel: testCase.parallel,
- ContinueOnError: testCase.continueOnError,
- DryRun: testCase.dryRun,
- DryRunJSON: testCase.dryRunJSON,
- },
- }
- cmd := o.SynthesizeCommand(testCase.tasks)
- if cmd != testCase.expected {
- t.Errorf("SynthesizeCommand() got %v, want %v", cmd, testCase.expected)
- }
- })
- }
-
-}