From 24823ad035b4a8b0df95b7b22a0cc22d6f8e027c Mon Sep 17 00:00:00 2001 From: aaron <462826@qq.com> Date: Mon, 22 May 2023 14:43:33 +0800 Subject: [PATCH] ignore node_modules dir --- internal/pkg/consts/consts.go | 10 +++++++--- pkg/lib/common/utils.go | 6 ++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/internal/pkg/consts/consts.go b/internal/pkg/consts/consts.go index 47ccca61..62ced700 100644 --- a/internal/pkg/consts/consts.go +++ b/internal/pkg/consts/consts.go @@ -11,9 +11,8 @@ const ( Ip = "127.0.0.1" Port = 8085 - LevelToScanScriptFile = 8 - JobTimeoutTime = 60 * 30 - JobRetryTime = 3 + JobTimeoutTime = 60 * 30 + JobRetryTime = 3 ConfigVersion = "3.0" ConfigDir = "conf" @@ -32,6 +31,8 @@ const ( ExpectResultPass = "pass" + LevelToScanScriptFile = 8 + PathInfo = "PATH_INFO" Get = "GET" PthSep = string(os.PathSeparator) @@ -50,4 +51,7 @@ var ( JUnit.String(), TestNG.String(), PHPUnit.String(), PyTest.String(), Jest.String(), CppUnit.String(), GTest.String(), QTest.String(), RobotFramework.String(), Cypress.String(), Playwright.String(), Puppeteer.String(), K6.String(), Zap.String(), } + + DirToIgnore = []string{"node_modules", + "bin", "logs", "xdoc", "log", "log-bak", "conf"} ) diff --git a/pkg/lib/common/utils.go b/pkg/lib/common/utils.go index e89fb296..beeedd12 100644 --- a/pkg/lib/common/utils.go +++ b/pkg/lib/common/utils.go @@ -117,12 +117,10 @@ func IsDisable(enable string) bool { func IgnoreZtfFile(path string) bool { path = filepath.Base(path) - arr := []string{"bin", "logs", "xdoc", - "log", "log-bak", "conf"} - if strings.Index(path, ".") == 0 || - stringUtils.FindInArr(path, arr) || + if strings.Index(path, ".") == 0 || stringUtils.FindInArr(path, commConsts.DirToIgnore) || (len(path) >= 4 && path[len(path)-4:] == ".exp") { return true + } else { return false } -- GitLab