Reputation: 7032
I have placed my webpack entry for tests under src/. Then inside the entry I have the following to find and run all *.spec.js files inside src directory:
var testsContext = require.context('.', true, /.+\.spec\.js?$/);
testsContext.keys().forEach(testsContext);
When I run npm test, it runs all my tests successfully, however it keeps giving me this annoying warning:
WARNING in ./src .+\.spec\.js?$
Module not found: Error: a dependency to an entry point is not allowed
@ ./src .+\.spec\.js?$
Anyone else faced the same issue?
Upvotes: 0
Views: 579
Reputation: 7032
I figured out what the warning was. The karma entry itself had spec.js suffix in it. That's why the glob function was finding the file itself, too.
Upvotes: 1