rerun

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2019 License: GPL-3.0, GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetLastFailedState = func() ([]string, error) {
	meta := readLastFailedState()
	util.SetWorkingDir(config.ProjectRoot)
	if len(meta.FailedItems) == 0 {
		return nil, errors.New("No failed tests found.")
	}
	return meta.args(), nil
}
View Source
var ReadPrevArgs = func() []string {
	contents, err := common.ReadFileContents(filepath.Join(config.ProjectRoot, common.DotGauge, lastRunCmdFileName))
	if err != nil {
		logger.Fatalf(true, "Failed to read previous command information. Reason: %s", err.Error())
		return nil
	}
	var args []string
	if err = json.Unmarshal([]byte(contents), &args); err != nil {
		logger.Fatalf(true, "Invalid previous command information. Reason: %s", err.Error())
		return nil
	}
	return args
}
View Source
var WritePrevArgs = func(cmdArgs []string) {
	b, err := json.MarshalIndent(cmdArgs, "", "\t")
	if err != nil {
		logger.Fatalf(true, "Unable to parse last run command. Error : %v", err.Error())
	}
	prevCmdFile := filepath.Join(config.ProjectRoot, common.DotGauge, lastRunCmdFileName)
	dotGaugeDir := filepath.Join(config.ProjectRoot, common.DotGauge)
	if err = os.MkdirAll(dotGaugeDir, common.NewDirectoryPermissions); err != nil {
		logger.Fatalf(true, "Failed to create directory in %s. Reason: %s", dotGaugeDir, err.Error())
	}
	err = ioutil.WriteFile(prevCmdFile, b, common.NewFilePermissions)
	if err != nil {
		logger.Fatalf(true, "Failed to write to %s. Reason: %s", prevCmdFile, err.Error())
	}
}

Functions

func ListenFailedScenarios

func ListenFailedScenarios(wg *sync.WaitGroup, specDirs []string)

ListenFailedScenarios listens to execution events and writes the failed scenarios to JSON file

func SaveState added in v0.9.0

func SaveState(args []string, specs []string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL