Skip to content

Commit c64b8e1

Browse files
Merge pull request revel#1162 from revel/feature/load-module-tests
Adds test path detection when loading modules
2 parents 2012aa2 + 95e9ae0 commit c64b8e1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

revel.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,13 @@ func addModule(name, importPath, modulePath string) {
367367
// Hack: There is presently no way for the testrunner module to add the
368368
// "test" subdirectory to the CodePaths. So this does it instead.
369369
if importPath == Config.StringDefault("module.testrunner", "github.com/revel/modules/testrunner") {
370+
INFO.Print("Found testrunner module, adding `tests` path ", filepath.Join(BasePath, "tests"))
370371
CodePaths = append(CodePaths, filepath.Join(BasePath, "tests"))
371372
}
373+
if testsPath := filepath.Join(modulePath, "tests"); DirExists(testsPath) {
374+
INFO.Print("Found tests path ", testsPath)
375+
CodePaths = append(CodePaths, testsPath)
376+
}
372377
}
373378

374379
// ModuleByName returns the module of the given name, if loaded.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy