2019-10-30 03:54:47 +07:00
|
|
|
package main
|
|
|
|
|
2019-11-02 21:32:58 +07:00
|
|
|
import (
|
2020-04-05 19:37:21 +07:00
|
|
|
"os"
|
|
|
|
|
2019-11-02 21:32:58 +07:00
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"github.com/spf13/cobra"
|
2020-04-05 19:37:21 +07:00
|
|
|
|
|
|
|
"github.com/authelia/authelia/internal/utils"
|
2019-11-02 21:32:58 +07:00
|
|
|
)
|
2019-10-30 03:54:47 +07:00
|
|
|
|
2020-05-02 12:06:39 +07:00
|
|
|
// RunUnitTest run the unit tests.
|
2019-10-30 03:54:47 +07:00
|
|
|
func RunUnitTest(cobraCmd *cobra.Command, args []string) {
|
2019-11-17 02:50:58 +07:00
|
|
|
log.SetLevel(log.TraceLevel)
|
2020-05-06 02:35:32 +07:00
|
|
|
|
2020-06-05 07:43:19 +07:00
|
|
|
if err := utils.Shell("go test -coverprofile=coverage.txt -covermode=atomic $(go list ./... | grep -v suites)").Run(); err != nil {
|
2019-11-25 02:01:58 +07:00
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2019-12-27 18:07:53 +07:00
|
|
|
cmd := utils.Shell("yarn test")
|
2020-05-02 23:20:40 +07:00
|
|
|
cmd.Dir = webDirectory
|
2020-05-06 02:35:32 +07:00
|
|
|
|
2019-11-25 02:01:58 +07:00
|
|
|
cmd.Env = append(os.Environ(), "CI=true")
|
2020-05-06 02:35:32 +07:00
|
|
|
|
2019-11-25 02:01:58 +07:00
|
|
|
if err := cmd.Run(); err != nil {
|
2019-11-02 21:32:58 +07:00
|
|
|
log.Fatal(err)
|
2019-10-30 03:54:47 +07:00
|
|
|
}
|
|
|
|
}
|