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

Karma 'mtime' Error -- Issue 1494 not fixed #2158

Open
msgesq opened this issue May 31, 2016 · 9 comments
Open

Karma 'mtime' Error -- Issue 1494 not fixed #2158

msgesq opened this issue May 31, 2016 · 9 comments

Comments

@msgesq
Copy link

msgesq commented May 31, 2016

This issue seems to be a duplicate of Issue 1494 which was deemed resolved (I have commented in that Issue and will edit to reference this issue number).

While attempting to run Karma (v. 0.13.3) via Gulp (v. 1.2.1) using Node (v. 6.0.0) on OS X, there is a reported warning followed by a crash. The warning states "Cannot read property 'mtime' of undefined Use" as shown in the screenshot below.

image

Please let me know if any further information would be helpful toward resolution of this issue.

@dignifiedquire
Copy link
Member

Version 0.13.3 is quite old could you update the latest version please (0.13.22)

@msgesq
Copy link
Author

msgesq commented May 31, 2016

Thank you for your response @dignifiedquire .

I have updated to the latest version of Karma (0.13.22), however I am still receiving the same error when running unit tests.

I forgot to mention that I am working on angular-fullstack generated from yeoman.

@djdawson3
Copy link

I'm having the same issue as well with Karma 0.13.22 and gulp 1.2.1.

@tjama
Copy link

tjama commented Jun 15, 2016

I got the same issue with karma 0.13.22, node 6.2.1 and grunt-karma 2.0 on Win7. Here is stack trace:

node_modules\karma\lib\file-list.js:176
      var mtime = mg.statCache[path].mtime
                                    ^

TypeError: Cannot read property 'mtime' of undefined
    at node_modules\karma\lib\file-list.js:176:37
    at Array.map (native)
    at node_modules\karma\lib\file-list.js:170:30
    at Array.map (native)
    at List._refresh (node_modules\karma\lib\file-list.js:153:37)
    at List.refresh (node_modules\karma\lib\file-list.js:252:27)
    at Server._start (node_modules\karma\lib\server.js:178:12)

@Macrofig
Copy link

Just in case it is helpful to others, I was running into the same error. The problem was in my the file pattern I was using to target my test files. Seems like something changed in https://www.npmjs.com/package/glob. Maybe take a second look at your pattern to verify Glob returns something?

@sjerman
Copy link

sjerman commented Jun 16, 2016

OK... so I have the same issue:

Adding some traces, this glob was causing the problem for me
'main/webapp/scripts/components/*/.{js,html}',

Looking further, the glob found a series of files... and the first(?) html file provoked the error. Removing the 'html' from the glob and it works... seems like it is an issue with glob

@Macrofig
Copy link

Welp. Thought it was a pattern issue. Wasn't correct... wasn't wrong either, I suppose. We recently updated Glob from 5.x to 7.x and are facing this issue. Also updating Karma from 0.12.31 to latest which also happened to make a big jump in Glob version (version 3.x to 7.x).

I think I've narrowed down the change to this issue: isaacs/node-glob#158 and the matching PR: isaacs/node-glob#159

A possible solution in Karma would be to check if the statCache for the specific path exists here. If not, then populate the stat manually. :(

I have a test repo that I used to open an issue with Glob, if anyone has input, I'd appreciate it.

@fbengrid
Copy link

hiya,

not sure if you did see my comments back then like this one: #1494 (comment) but changing the pattern did solve the issue.

This involves replacing the accolades with parenthesis and the comma with |
In your example this would translate into changing :
main/webapp/scripts/components/**/*.{js,html}
to
main/webapp/scripts/components/**/*+.(js|html)

@dignifiedquire
Copy link
Member

@Macrofig thanks for filing the issue with glob, the fix should ultimately happen in there. In the meantime I agree we should check if it exists and stat manually if it does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants