-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Browserify cannot find runnable module when using require('mocha') #1316
Comments
@taylor-smith How are you |
same problem when using browserify |
Same problem with browserify. Am just using |
I think the issue is that mocha has it's own internal require system. which is relative to lib, not the root dir. |
I think the issue is that Browserify uses its own require system. The only thing "weird" Mocha does is use relative paths, which is not weird at all. In a NodeJS context, In a Browserify context, I'm a little confused why you're bundling Mocha with your app, but I don't have much experience with Browserify. |
Yeah, browserify isn't smart about it - if you ask it to |
@nevir Hoping to resolve that issue soon. I'd like to get Mocha built w/ Browserify instead of the current homebrew solution. |
I wouldn't hold your breath. I get the sense that it's a lot of work on
|
@nevir Not sure why I'd hold my breath or not; I'll implement it instead. |
Ah, gotcha
|
Is there a solution to this issue yet? I still get Is there a workaround? I’m trying to concat: |
Same problem. Trying to run mocha as a stand alone in a nashorn environment. |
Still getting this issue, both on browserify and webpack.
|
@taylor-smith Hello! I wonder why this issue is closed, the problem is still actual. Are there no plans on making mocha browserifyable? |
@dfcreative if you look through the conversation, @taylor-smith wasn't the one who closed the issue. @boneskull did. |
@dfcreative @taylor-smith @strugee Mocha bundles itself with browserify. You need to include |
( |
@boneskull yes, I know, it is difficult to understand why mocha uses browserify to build it’s own browser So I just gave up and wrote tst, a minimalistic and fast mocha-compatible replacement for node and browser. |
@dfcreative If it's possible to provide a Seems fairly straightforward, unless I'm missing something. I also don't quite understand the use case for browserifying Mocha itself. Can someone explain this? |
I see this (from wejrowski)
But it's not clear what this means. |
@boneskull browserifying mocha would be useful with browserify servers for dev, like beefy or budo. |
@dfcreative Aren't these tools usually used for running your app, not your tests (is that their intent)? |
@boneskull no, they are only for development tasks afaik |
Well, yes, they are not intended for production use. I meant they are for running your app in "development" mode. I can infer from beefy's docs that it's meant to serve a directory, ostensibly with I'd recommend using something like karma-mocha and karma-browserify to run tests. You can use the following bit of configuration to get the HTML reporter to display in the browser (using // karma config object
{
frameworks: ['browserify', 'mocha'],
files: ['src/**/*.js', 'test/**/*.js'],
preprocessors: {
'**/*.js': ['browserify']
},
browserify: {
debug: true
// plus whatever else; package.json settings will be read as well
},
reporters: ['progress'], // or whatever console reporter you wish (or none?)
client: {
mocha: {
reporter: 'html'
}
},
autoWatch: true, // reruns on file change
singleRun: false, // "karma start" will run tests + stay open
browsers: ['Chrome']
} To use this, create your That being said, I'll try to see if the |
@boneskull yes, exactly, thanks for understanding. That would be nice mocha to be as easy as |
yes, making test files "node-able" is going to be the most basic usage of mocha at some point here |
I am a bot that watches issues for inactivity. |
This issue has been open and accepted for well over 5 years and hasn't seen a PR. Also:
Browserify is, at this point, relatively legacy software. It's not something we're going to put a lot of effort into supporting. Closing this issue as wontfix / aged away. Someone please yell at me if I'm wrong here. ...and if you do, please post a recent isolated reproduction for how to demonstrate this issue. None of us on the team use Browserify regularly that I know of. 😄 |
When compiling test scripts into a single monolith using Browserify, I hit the error:
Line 846 of mocha.js requires runnable as such:
Does this need to be amended as such?
If this is true, it seems there are several file paths that need to be renamed. Is there a workaround?
The text was updated successfully, but these errors were encountered: