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

Invalid file type warning #113

Closed
niksy opened this issue Apr 1, 2019 · 8 comments · Fixed by #324
Closed

Invalid file type warning #113

niksy opened this issue Apr 1, 2019 · 8 comments · Fixed by #324

Comments

@niksy
Copy link

niksy commented Apr 1, 2019

Description

Running Karma tests with this module enabled I get the following warning:

01 04 2019 14:36:33.724:WARN [middleware:karma]: Invalid file type, defaulting to js. json

Package versions

  • karma-viewport: 1.0.4
  • karma: 4.0.1
@squidfunk
Copy link
Owner

squidfunk commented Apr 1, 2019

Confirmed. Also encountered that with a newer version of Karma recently, but after some fiddling still haven't found a fix yet. It's just a warning, so it should have no impact on functionality. Happy to merge a PR.

@niksy
Copy link
Author

niksy commented Apr 2, 2019

@squidfunk I think it’s related to

config.files!.push(
pattern(path.resolve(__dirname, "config/default.json")),
pattern(path.resolve(__dirname, "adapter/index.js"))
)

You’re pushing JSON file to files array and Karma doesn’t recognize it among file types it supports.

@squidfunk
Copy link
Owner

Thanks for investigating. Did you come across an idea how to silence the warning? Already tried adding it as a mime type but that didn’t do the trick.

@niksy
Copy link
Author

niksy commented Apr 2, 2019

Sorry, haven’t had a chance, but if adding { pattern: file, type: 'js' } doesn’t work, maybe it’s something Karma related?

@sebastiangora
Copy link

When this fix will be released?

@squidfunk
Copy link
Owner

squidfunk commented Jan 29, 2020

I'm sorry, I totally forgot about this! Just released 1.0.5 which contains the fix.

@cerealexx
Copy link

Still happens in 1.0.7

@riteshjagga
Copy link

riteshjagga commented Jan 17, 2022

This isn't related to karma-viewport but want to reply as I got solution from this conversation thread and others can benefit if they land here like me.

I have test cases in CoffeeScript files which are configured as described here.

Had the similar issue WARN [middleware:karma]: Invalid file type, defaulting to js. coffee and got it fixed by using

files: [
  'public/javascripts/lib.js',
  {pattern: 'app/*.coffee', type: 'js'}
]

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

Successfully merging a pull request may close this issue.

5 participants