karma-runner / karma-commonjs

A Karma plugin. Test CommonJS modules.
MIT License
73 stars 30 forks source link

Fixes bug with loading npm modules #35

Closed mzahor closed 9 years ago

mzahor commented 9 years ago

Fixes bug with loading npm modules if relative path is used in package.json. For example see this part of package.json: { ... "main": "./moment.js", ... }

commonjs bridge will try to match it with loaded file in the following line: if (existingfiles[paths[i]]) { and fail since paths[i] will be smth like basepath/node_modules/moment/moment/./moment.js but in existing files it will be basepath/node_modules/moment/moment/moment.js

jednano commented 9 years ago

This totally fixes my issues with loading React. Please merge this in!

pkozlowski-opensource commented 9 years ago

@mzahor thnx for the PR. I can see the bug and I do agree that it needs to be fixed. Unfortunately I can't merge your PR in the current form as it:

I would be happy to review & merge your PR as soon as the above is sorrected.

@jedmao if you want to help you are welcomed to review a PR, add missing tests etc. As noted above I can't merge this one in its current form.

jednano commented 9 years ago

Nevermind. Turns out simply adding his branch in my package.json was the true fix to my problem. Perhaps I'll open another issue about that.

pkozlowski-opensource commented 9 years ago

@mzahor are you planning to send update to this PR based on my comments? If not I'm going to fix the underlying bug over the weekend.

mzahor commented 9 years ago

Sorry for late response. I've created another pull request based on your comments.

pkozlowski-opensource commented 9 years ago

This one is suppressed by #41