Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No tests found when running Jest under Windows Server 2012 environment #2807

Closed
izikorgad opened this issue Feb 5, 2017 · 18 comments
Closed
Labels

Comments

@izikorgad
Copy link

No tests found: when running Jest under Windows Server 2012 environment.
The issue is only reproducible when the project path contains space.

My jest configuration is:
node: v6.9.1
npm: 3.10.8
Jest: 18.1.0

@daSaf
Copy link

daSaf commented Feb 5, 2017

Someone here had this exact issue today!

@thymikee
Copy link
Collaborator

thymikee commented Feb 7, 2017

@mikaelbr fixed something similar recently. Could you help here?

@mikaelbr
Copy link
Contributor

mikaelbr commented Feb 8, 2017

Sure. I can take a stab at it, but I don't think it's related to the previous issue at all.

@jtrein
Copy link

jtrein commented Mar 9, 2017

Having the same issue in Windows Server 2012. Will get back if we can reproduce.

@jtrein
Copy link

jtrein commented Mar 17, 2017

After wasting a bunch of time escaping paths. I was able to get tests to run by temporarily copying the project directory to the C:\Users\[USER]\Desktop, running the tests, then removing the directory. The world is happy.

PS - I want to do a PR, but I'm stacked with work. Also, I'm not a Windows dev, and our office is using an EC2 Windows Server for an unrelated build, so we're not tied to it.

Here's some Jenkins output (commands included) if you need some slight inspiration.

C:\Program Files (x86)\Jenkins\jobs\universal-drug-codes-server-test\workspace>echo "copying src to temporary directory..." 
"copying src to temporary directory..."

C:\Program Files (x86)\Jenkins\jobs\universal-drug-codes-server-test\workspace>mkdir "C:\Users\Administrator\Desktop\universal-codes-jest-tmp" 

C:\Program Files (x86)\Jenkins\jobs\universal-drug-codes-server-test\workspace>xcopy /S /Y "C:\Program Files (x86)\Jenkins\jobs\universal-drug-codes-server-test\workspace" "C:\Users\Administrator\Desktop\universal-codes-jest-tmp"

...

C:\Program Files (x86)\Jenkins\jobs\universal-drug-codes-server-test\workspace>echo "running tests..." 
"running tests..."

C:\Program Files (x86)\Jenkins\jobs\universal-drug-codes-server-test\workspace>chdir "C:\Users\Administrator\Desktop\universal-codes-jest-tmp"   && npm test -- --verbose 

> universal-drug-codes-server@2.0.1 test C:\Users\Administrator\Desktop\universal-codes-jest-tmp
> jest "--verbose"

 PASS  __tests__\handler.spec.js
  √ "handler.items" is defined
  "FilterValidFields" call
    √ called once
    √ called with correct argument
    √ called with correct argument 2 (15ms)
  "handler.items": empty query parameters
    √ should call error response once
    √ "MockLambdaJSONResponse" should be called with error object correct
    √ "MockLambdaJSONResponse" should be called with stringified JSON
    √ should return false
    √ mysql connection not called
  "handler.items": bad query parameters
    √ if bad query parameters, should call error response once
    √ if bad query parameters, error object correct
    √ should return false
    √ mysql connection not called
  "handler.items": bad field filter values
    √ if bad query parameters, should call error response once
    √ if bad query parameters, error object correct
    √ should return false
    √ mysql connection not called
  "handler.items": mysql connection
    √ should call "MySqlCreateConnection" once
    √ "MySqlCreateConnection" should be called with correct argument
    √ "MySqlCreateConnection" should be called with correct argument 2
    √ should call "PrepareSelectStatement" once
    √ "PrepareSelectStatement" should be called with correct argument
    √ "PrepareSelectStatement" should be called with correct argument 2
  "handler.items": mysql format
    √ should be called once
    √ should be called with a string as argument
    √ should be called with an object as argument 2

 PASS  __tests__\helper.spec.js
  √ "FilterValidFields" is defined

Test Suites: 2 passed, 2 total
Tests:       27 passed, 27 total
Snapshots:   0 total
Time:        1.124s, estimated 2s
Ran all test suites.
[workspace] $ cmd /c call C:\Users\ADMINI~1\AppData\Local\Temp\hudson8667930859440503455.bat

C:\Program Files (x86)\Jenkins\jobs\universal-drug-codes-server-test\workspace>echo "removing temporary directory..." 
"removing temporary directory..."

C:\Program Files (x86)\Jenkins\jobs\universal-drug-codes-server-test\workspace>rmdir "C:\Users\Administrator\Desktop\universal-codes-jest-tmp" /s /q 
C:\Program Files (x86)\Jenkins\jobs\universal-drug-codes-server-test\workspace>exit 0 
Finished: SUCCESS

@josalmi
Copy link

josalmi commented May 17, 2017

I can confirm that the issue is still present with Jest v20.0.1.

17:02:41     > project@0.0.1 test C:\Program Files (x86)\Jenkins\workspace\Project (BUILD)\ui
17:02:41     > jest
17:02:41     
17:02:42     No tests found
17:02:42     In C:\Program Files (x86)\Jenkins\workspace\Project (BUILD)\ui
17:02:42       113 files checked.
17:02:42       testMatch: �[1m/__tests__/**/.js?(x),**/?(�[22m.)(spec|test).js?(x) - 6 matches
17:02:42       testPathIgnorePatterns: \\node_modules\\ - 113 matches
17:02:42     Pattern: "" - 0 matches
17:02:42     ----------|----------|----------|----------|----------|----------------|
17:02:42     File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
17:02:42     ----------|----------|----------|----------|----------|----------------|
17:02:42     All files |  Unknown |  Unknown |  Unknown |  Unknown |                |
17:02:42     ----------|----------|----------|----------|----------|----------------|

@thymikee
Copy link
Collaborator

@josalmi does it work with testRegex? It may be an issue with testMatch on Windows

@lippea
Copy link

lippea commented Jun 14, 2017

Same problem here. I can run test with "Jest" or "Jest test", but no test match if run with "Jest test/components" Is there any workaround for this? We need to have different setupFiles/testEnvionment for different subfolder. Not sure how to achieve this with this bug.

@mikehdt
Copy link

mikehdt commented Jun 14, 2017

As @lippea mentioned, we encountered this problem. It doesn't seem to be limited to Windows Server 2012; more Windows machines in general. Mac machines are okay. We worked around this for the time-being by using a separate json file, which uses an array of globs (instead of regex, at least as I understand it).

@justinireland
Copy link

I was having the same problem on Windows 7 enterprise. I can confirm that the problem was related to having either a space or bracket in the path. Once I removed those the tests would run.

@jtrein
Copy link

jtrein commented Jul 4, 2017

@mikehdt can you provide your example? I'd prefer your solution over my current one.

@c-vetter
Copy link

@mikehdt How do you use that json file? Please share your work-around :)

@jatd
Copy link

jatd commented Aug 22, 2017

I'm still dealing with the same issue as @josalmi .

@cpojer
Copy link
Member

cpojer commented Aug 24, 2017

If you are all running into this issue, please send a PR to fix it for everyone. We don't have Windows 7 machines, so unless you guys send a PR, this won't get fixed :) Thank you.

@isthisstackoverflow
Copy link

Confirming problem, not clever enough to solve it. @mikehdt More on that json workaround would be appreciated.

@kevinleedrum
Copy link

A workaround for anyone having this problem with jenkins is to set a custom workspace directory for your project under the project's advanced settings. Just set it to a path without spaces (e.g. c:\workspace\my-project).

@thymikee
Copy link
Collaborator

I think this is the same problem as #2381. Closing in favor of the other issue. Still looking for help on this one!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests