Skip to content
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

Bundle mocha for Nashorn #1756

Closed
wejrowski opened this issue Jun 18, 2015 · 2 comments
Closed

Bundle mocha for Nashorn #1756

wejrowski opened this issue Jun 18, 2015 · 2 comments

Comments

@wejrowski
Copy link

I need to have a single file with Mocha and all it's dependencies to use in a Nashorn environment. I can't have any requires in the final file as it stands for node, or as the browser mocha.js stands, since my environment will not allow for that. I've tried this with browserify and I'm getting a number of dependency errors. Currently I'm using Jasmine as it nicely stands as a single file, but there have been some issues with Jasmine lately so I thought I'd try Mocha.

Anyone have any pointers? Has anyone tried this? This is the gist of what I'm trying:

// gulpfile
var browserify = require('browserify');
var sourceStream = require('vinyl-source-stream');
var gulp       = require('gulp');

gulp.task('build-mocha', function () {
    browserify('mocha-browserify-me.js')
        .bundle()
        .pipe(sourceStream('mymocha-2.2.5-bundle.js'))
        .pipe(gulp.dest('./'))
});
//mocha-browserify-me.js
var Mocha = require('./lib/mocha.js');
@wejrowski
Copy link
Author

I found the culprit: lib/reporters/index.js

exports.HTMLCov = require('./html-cov');

If I comment that out it's fine. I'm going to play around with this some more. There may be a fix somewhere in there or it may be nice to exclude some of these reporters for something like this. I've gathered that the ./mocha.js assumes you're using a browser. Anyone have thoughts on modifying it so that it (1) zips everything together and (2) doesn't assume you're using a browser?

@jbnicolai
Copy link

@brent the recent #1260 should have resolved this issue. Mocha does not assume it's running in a browser environment at all.

However, feel free to comment if you feel this issue is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants