squidfunk / karma-viewport

A Karma plugin for testing responsive features and layout

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid file type warning

niksy opened this issue · comments

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

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.

@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.

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.

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

When this fix will be released?

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

commented

Still happens in 1.0.7

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'}
]
ezoic increase your site revenue