You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the Ginkgo test framework for unit tests in one of my projects. I want to allow importing of github.com/onsi/ginkgo in all _test.go files, but disallow it in non-test files, so that a build of my production code doesn't pull in a test framework.
I can't figure out how to configure depguard to perform that check. Is it possible?
The text was updated successfully, but these errors were encountered:
You will need to setup a whitelist and only put th ginkgo package in the InTest configuration portion of the tool. Unfortunatly the configuration doesn't allow for split list types. So you will need to whitelist all non test packages too.
I believe that if inTests is empty, then whatever is in packages also applies to tests. So, listing anything in inTests makes it work. Something like this. It's ugly, but seems to work.
{
"type": "blacklist",
"packages": [
"github.com/onsi/ginkgo"
],
"inTests": [
"this isn't even a proper package name"
],
"includeGoStdLib": true
}
I'm using the Ginkgo test framework for unit tests in one of my projects. I want to allow importing of
github.com/onsi/ginkgo
in all_test.go
files, but disallow it in non-test files, so that a build of my production code doesn't pull in a test framework.I can't figure out how to configure depguard to perform that check. Is it possible?
The text was updated successfully, but these errors were encountered: