PLT-5755: Infrastructure for Component Testing. (#5814)
This migrates the existing webapp tests to using Jest and Enzyme. The infrastructure is put in place for React component testing, and a few simple example component tests are implemented. This also adds snapshot testing of components, coverage checking for the webapp (although that is not yet integrated to Coveralls), and the ability to run npm run test:watch to automatically re-run affected tests when working on the webapp codebase.
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
c6ded1dbfd
Коммит
7d449e0556
@@ -10,9 +10,12 @@ import (
|
||||
"os/exec"
|
||||
|
||||
"github.com/mattermost/platform/api"
|
||||
"github.com/mattermost/platform/api4"
|
||||
"github.com/mattermost/platform/app"
|
||||
"github.com/mattermost/platform/utils"
|
||||
"github.com/spf13/cobra"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var testCmd = &cobra.Command{
|
||||
@@ -27,9 +30,16 @@ var runWebClientTestsCmd = &cobra.Command{
|
||||
RunE: webClientTestsCmdF,
|
||||
}
|
||||
|
||||
var runServerForWebClientTestsCmd = &cobra.Command{
|
||||
Use: "web_client_tests_server",
|
||||
Short: "Run the server configured for running the web client tests against it",
|
||||
RunE: serverForWebClientTestsCmdF,
|
||||
}
|
||||
|
||||
func init() {
|
||||
testCmd.AddCommand(
|
||||
runWebClientTestsCmd,
|
||||
runServerForWebClientTestsCmd,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -37,6 +47,7 @@ func webClientTestsCmdF(cmd *cobra.Command, args []string) error {
|
||||
initDBCommandContextCobra(cmd)
|
||||
utils.InitTranslations(utils.Cfg.LocalizationSettings)
|
||||
api.InitRouter()
|
||||
api4.InitApi(false)
|
||||
api.InitApi()
|
||||
setupClientTests()
|
||||
app.StartServer()
|
||||
@@ -46,6 +57,24 @@ func webClientTestsCmdF(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func serverForWebClientTestsCmdF(cmd *cobra.Command, args []string) error {
|
||||
initDBCommandContextCobra(cmd)
|
||||
utils.InitTranslations(utils.Cfg.LocalizationSettings)
|
||||
api.InitRouter()
|
||||
api4.InitApi(false)
|
||||
api.InitApi()
|
||||
setupClientTests()
|
||||
app.StartServer()
|
||||
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||
<-c
|
||||
|
||||
app.StopServer()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func setupClientTests() {
|
||||
*utils.Cfg.TeamSettings.EnableOpenServer = true
|
||||
*utils.Cfg.ServiceSettings.EnableCommands = false
|
||||
|
||||
Ссылка в новой задаче
Block a user