-
Notifications
You must be signed in to change notification settings - Fork 23
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
Module instance lacks "paths" property #9
Comments
Is it sufficient if the |
For what it's worth, the CommonJS spec seems to say |
@benjamn You're probably right that |
Hi. However, maybe a greater issue here is that Node.js modules are written with the expectation of running in Node.js and its CJS implementation. Mocha is not "overdependent"--nor are any modules written for Node.js--on Node.js' implementation. I have yet to see a Node.js module that specifically advertises Meteor support or runs integration tests against Meteor in its CI. Mocha is in this bucket; I was surprised to learn recently that it had any compatibility with Meteor at all. I don't know what Meteor's CJS implementation looks like--or if it has its own non-standard features--but If Meteor wishes to advertise full support for Node.js modules, its CJS implementation should be a superset of Node.js', at minimum. In this case, Mocha should be able to address this particular issue, but please understand Meteor and its users shouldn't expect this of other projects. 😄 |
Shortly after reading @boneskull answer I was not sure why he is not so positive about fixing this problem in mocha, but I think I am starting to understand it now. @benjamn The problem - as I see it - is @benjamn I am happy to provide a PR if you agree with my thinking. If not I will try to help @boneskull fixing the issue on mocha's side but to be honest I'd rather do it here. Thanks! |
Indeed, adding |
FWIW, if a project like Mocha has the necessary resources, ensuring compatibility with other CommonJS implementations could be on the table. Mocha supports Node.js 0.10.x and greater across Windows and POSIX OSes, in addition to IE7 and newer, PhantomJS 1.9.7 and newer, and all other major desktop browsers. It's also likely working in other environments that I don't know about. That's a full plate for any project. If anyone is interested in adding--and maintaining--compatibility with e.g. Meteor, I'd appreciate the help, but don't have the time nor expertise to do so otherwise. |
@benjamn Would you mind sharing your opinion with us? @boneskull As far as I know the only blocker that prevents mocha being compatible with Meteor's CommonJS environment is this issue here. |
@apendua That's my assessment as well. But it's not fixed yet, and we aren't guaranteed future compatibility without adding and maintaining Meteor in our build matrix. |
My concern is that the That leaves two options:
The second option is effectively what's happening now, so I guess I'm wondering if the first option is worthwhile? Will |
Usually, a NodeJS
module
will have apaths
property. Unfortunately, the current implementation ofModule
class does not have it, and since some npm packages may assume its existence, this results in runtime errors, e.g.https://github.com/mochajs/mocha/blob/master/lib/mocha.js#L28
In this case
import 'mocha'
results in:The text was updated successfully, but these errors were encountered: