没有testing发现运行与咕噜玩笑

我试图用一个咕task任务来运行我的笑话,但这样做,我得到没有testing发现消息在控制台。 PFB的设置相同:

gruntfile.js片段:

exec: { jest: 'node node_modules/jest/bin/jest -u --config="test/unit/jest/jest.conf.json"' } 

jest.conf.json:

 { "testEnvironment": "jsdom", "setupTestFrameworkScriptFile": "./enzyme.setup.js", "testResultsProcessor": "jest-teamcity-reporter" } 

酶.setup.js:

 import { configure } from 'enzyme'; import Adapter from 'enzyme-adapter-react-15.4'; configure({ adapter: new Adapter() }); 

运行grunt exec任务的控制台显示如下:

 No tests found In C:\Vishal\UI\Jest-Grunt\proj\test\unit\jest 3 files checked. testMatch: .js?(x),**/?(*.)(spec|test).js?(x) - 0 matches testPathIgnorePatterns: \\node_modules\\ - 3 matches Pattern: - 0 matches Done, without errors. 

然而令人震惊的是,如果我不在grunt exec任务中的cli中传递jestconfiguration文件path,而是在package.json文件中指定jestconfiguration,那么它就起作用了。

不知道为什么这是这样的行为。 希望有人能帮助! TIA。

啊,我的头撞过来后。 我注意到这个错误是可怜的直截了当的:

在C:\ My-User \ UI \ Jest-Grunt \ proj \ test \ unit \ jest中

这清楚地解释了JEST试图在上面指定的文件夹内执行testing用例。 但是理想情况下,JEST会查看__tests__ 。 因此我必须自己指定根文件夹。 与包json这不会发生。 奇怪,但!

这里是我的更新jestconfiguration:

 { "testEnvironment": "jsdom", "setupTestFrameworkScriptFile": "./enzyme.setup.js", "testResultsProcessor": "jest-teamcity-reporter", "coverageReporters": [ "teamcity", "lcov" ], "roots": [ "../../../__tests__" ] }