karma-runner / grunt-karma

Grunt plugin for Karma.
MIT License
468 stars 116 forks source link

arguments to path.resolve must be strings #142

Closed niemyjski closed 9 years ago

niemyjski commented 9 years ago

I just tried upgrading our project ( https://github.com/exceptionless/Exceptionless.UI ) from 0.9 to the latest version and I started getting errors:

    Running "karma:all_tests" (karma) task
    Warning: Arguments to path.resolve must be strings Use --force to continue.
    TypeError: Arguments to path.resolve must be strings
        at Object.exports.resolve (path.js:116:15)
        at basePathResolve (C:\Code\Exceptionless.UI\src\node_modules\karma\lib\config.js:86:17)
        at C:\Code\Exceptionless.UI\src\node_modules\karma\lib\config.js:91:31
        at Array.map (native)
        at normalizeConfig (C:\Code\Exceptionless.UI\src\node_modules\karma\lib\config.js:107:56)
        at Object.parseConfig (C:\Code\Exceptionless.UI\src\node_modules\karma\lib\config.js:293:10)
        at Object.exports.start (C:\Code\Exceptionless.UI\src\node_modules\karma\lib\server.js:286:20)
        at Object.<anonymous> (C:\Code\Exceptionless.UI\src\node_modules\grunt-karma\tasks\grunt-karma.js:125:14)
        at Object.<anonymous> (C:\Code\Exceptionless.UI\src\node_modules\grunt\lib\grunt\task.js:264:15)
        at Object.thisTask.fn (C:\Code\Exceptionless.UI\src\node_modules\grunt\lib\grunt\task.js:82:16)

    Aborted due to warnings.

I tried 10.1 and nothing but it definitely happened after .9

dignifiedquire commented 9 years ago

I'm not entirely clear, did this happen on 0.10.1? Because if it only happened on 0.10.0 that's fine because that release is broken.

niemyjski commented 9 years ago

I checked 10.0 and 10.1 and both broke it for me. The only one that works for me is 0.9. To reproduce you can pull down that repro and do npm install and then grunt test.

enigmak commented 9 years ago

I had a similar issue due to the data.files not flattening properly. I changed the grunt-karma.js file by adding data.files =_.flatten(data.files); to line 85. And it works for me now. The _.flatten used to be there in the 0.9 version and the [].concat is not flattening like it should on my machine.

To test it pass files: [['a.js','b.js','c.js'],'d.js','e.js'] under karma -> options -> files in the config and it will break then add the line of code and it will work.

The code now looks like.

    if (data.files || options.files) {
      data.files = [].concat.apply(options.files || [], this.files.map(function(file) {
        return file.src.map(function(src) {
          var obj = {
            pattern: src
          };

          ['watched', 'served', 'included'].forEach(function(opt) {
            if (opt in file) {
              obj[opt] = file[opt];
            }
          });
          return obj;
        });
      }));
      data.files =_.flatten(data.files);
    }
niemyjski commented 9 years ago

Nice find!, Is there any chance we could add this to the latest release?

robdmoore commented 9 years ago

I have this problem with 0.10.1 too. 0.9.0 works.

niemyjski commented 9 years ago

@Dignifiedquire I just upgraded to 0.11.1 and I'm still getting the same error.

niemyjski commented 9 years ago

If you want you can pull down my repo https://github.com/exceptionless/Exceptionless.UI (run npm install and bower install) and then do grunt test, watch it pass all the tests and then upgrade this package and then run it again to watch it fail.

ollwenjones commented 9 years ago

Same problem here. Was trying to go from 0.8 to 0.11. A lot going on in the 'files' to get all the angular templates compiled, etc.

dignifiedquire commented 9 years ago

Fixed in 0.11.2.

niemyjski commented 9 years ago

Thanks! I'll try and check this out soon!