• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / cli / 22164831089

19 Feb 2026 01:28AM UTC coverage: 61.651% (-0.1%) from 61.773%
22164831089

Pull #4871

github

web-flow
Merge 217ff8192 into 54c41b847
Pull Request #4871: feat(db): add --use-shadow-db flag to test db command

5 of 32 new or added lines in 3 files covered. (15.63%)

6 existing lines in 2 files now uncovered.

7707 of 12501 relevant lines covered (61.65%)

7.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/test.go
1
package cmd
2

3
import (
4
        "github.com/spf13/afero"
5
        "github.com/spf13/cobra"
6
        "github.com/supabase/cli/internal/test/new"
7
        "github.com/supabase/cli/internal/utils"
8
)
9

10
var (
11
        testCmd = &cobra.Command{
12
                GroupID: groupLocalDev,
13
                Use:     "test",
14
                Short:   "Run tests on local Supabase containers",
15
        }
16

17
        testDbCmd = &cobra.Command{
18
                Use:   "db [path] ...",
19
                Short: dbTestCmd.Short,
20
                RunE:  dbTestCmd.RunE,
21
        }
22

23
        template = utils.EnumFlag{
24
                Allowed: []string{new.TemplatePgTAP},
25
                Value:   new.TemplatePgTAP,
26
        }
27

28
        testNewCmd = &cobra.Command{
29
                Use:   "new <name>",
30
                Short: "Create a new test file",
31
                Args:  cobra.ExactArgs(1),
32
                RunE: func(cmd *cobra.Command, args []string) error {
×
33
                        return new.Run(cmd.Context(), args[0], template.Value, afero.NewOsFs())
×
34
                },
×
35
        }
36
)
37

38
func init() {
×
39
        // Build db command
×
40
        dbFlags := testDbCmd.Flags()
×
41
        dbFlags.String("db-url", "", "Tests the database specified by the connection string (must be percent-encoded).")
×
42
        dbFlags.Bool("linked", false, "Runs pgTAP tests on the linked project.")
×
43
        dbFlags.Bool("local", true, "Runs pgTAP tests on the local database.")
×
NEW
44
        dbFlags.Bool("use-shadow-db", false, "Creates a temporary database from migrations for running tests in isolation.")
×
45
        testDbCmd.MarkFlagsMutuallyExclusive("db-url", "linked", "local")
×
46
        testCmd.AddCommand(testDbCmd)
×
47
        // Build new command
×
48
        newFlags := testNewCmd.Flags()
×
49
        newFlags.VarP(&template, "template", "t", "Template framework to generate.")
×
50
        testCmd.AddCommand(testNewCmd)
×
51
        // Build test command
×
52
        rootCmd.AddCommand(testCmd)
×
53
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc