Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create enonic project test #530 #531

Merged
merged 3 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/dev.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,26 @@ Options:

NOTE: Sandbox is not required when running with `--force` flag. In that case system wide java version will be used.

=== Test

Alias for the `gradlew test` command

$ enonic project test

Options:

[cols="1,3",options="header"]
|===
|Option
|Description

|`-f, --force`
|accept default answers to all prompts and run non-interactively
|===

NOTE: Sandbox is not required when running with `--force` flag.
In that case system wide java version will be used.

=== Deploy

As developers, we continuously need to deploy and test our code. Following command will build current project and deploy it to associated <<project-sandbox, sandbox>>:
Expand Down
1 change: 1 addition & 0 deletions internal/app/commands/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func All() []cli.Command {
Shell,
Gradle,
Dev,
Test,
}

switch util.GetCurrentOs() {
Expand Down
27 changes: 27 additions & 0 deletions internal/app/commands/project/test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package project

import (
"cli-enonic/internal/app/commands/common"
"cli-enonic/internal/app/commands/sandbox"
"fmt"
"github.com/urfave/cli"
)

var Test = cli.Command{
Name: "test",
Usage: "Run tests in the current project",
Flags: []cli.Flag{common.FORCE_FLAG},
Action: func(c *cli.Context) error {
if projectData := ensureProjectDataExists(c, ".", "", "A sandbox is required to test the project, do you want to create one"); projectData != nil {
var cleanMessage string
if sandbox.Exists(projectData.Sandbox) {
cleanMessage = fmt.Sprintf("Testing in sandbox '%s'...", projectData.Sandbox)
} else {
cleanMessage = "No sandbox found, testing without a sandbox..."
}
runGradleTask(projectData, cleanMessage, "test")
}

return nil
},
}
Loading