Code Monkey home page Code Monkey logo

mochify.js's Introduction

Mochify

TDD with Browserify, Mocha, Headless Chrome and WebDriver

Build SemVer License

Browserifies ./test/*.js, decorated with a Mocha test runner, runs it in Headless Chrome and passes the output back to your console. Cleans up your stack traces by mapping back to the original sources and removing lines from the test framework.

Features

  • Run tests in Headless Chrome
    • Supports watch-mode with pre-loaded Chrome page (with --watch)
    • Use the Chrome developer tools for debugging (docs)
    • Run builds in CI (docs)
    • Load tests in the context of a file or URL (with --url)
    • Optional built-in HTTPS server (with --https-server)
  • Run tests in real browsers
  • Code coverage options:
  • Works with most Mocha reporters (docs)
  • Exposes a Node API (docs)

Install

This will install Mochify in your current project and add it to the devDependencies:

npm install mochify --save-dev

Puppeteer will download a recent version of Chromium. If you want to skip the download and provide your own executable instead, define the PUPPETEER_SKIP_CHROMIUM_DOWNLOAD environment variable or add this to your package.json:

{
  "config": {
    "puppeteer_skip_chromium_download": true
  }
}

For proxy settings and other environment variables, see the Puppeteer documentation.

Usage

Configure "scripts" in your package.json so that your project ships with the testing infrastructure:

{
  "scripts": {
    "test": "mochify",
    "watch": "mochify --watch",
    "webdriver": "mochify --wd"
  }
}

To run from the command line, either run npm install mochify -g to have mochify available globally, or from within your project directory run:

node_modules/.bin/mochify

Debugging

Place a debugger statement in your source code and run mochify --debug. This will open a Chromium instance with developer tools opened and it will break at the debugger statement.

Command line options

  • --watch or -w use watchify to watch your files and run the tests on change.
  • --reporter or -R changes the Mocha reporter (see further down).
  • --grep sets the Mocha grep option.
  • --invert sets the Mocha grep invert flag.
  • --recursive include sub directories.
  • --ui or -U changes the Mocha UI. Defaults to 'bdd'.
  • --timeout or -t changes the Mocha timeout. Defaults to 2000.
  • --colors explicitly enables color output.
  • --no-colors explicitly disables color output.
  • --outfile or -o writes output to this file. If unspecified, mochify prints to stdout.
  • --require or -r requires the given module.
  • --debug launches a non-headless chromium instance with developer tools.
  • --chrome uses a specific Chrome executable. If not specified, the built-in chromium is used.
  • --ignore-ssl-errors tells Chrome whether or not to ignore ssl certificate issues (default is false)
  • --allow-chrome-as-root allows Chrome to run as root
  • --dumpio passed to puppeteer to dump all IO
  • --https-server launches an HTTPS server on the specified port. If no port is given a random available port will be used.
  • --viewport-width tells Chrome to use a certain width for its viewport.
  • --viewport-height tells Chrome to use a certain height for its viewport.
  • --cover checks code coverage with coverify.
  • --node creates a bare bundle and runs test cases on node.
  • --wd use min-webdriver to run the tests in multiple real browsers.
  • --url runs the tests in the context of the given URL.
  • --wd-file (only with --wd) specify the location of the .min-wd config file.
  • --consolify output.html generate a standalone HTML page with consolify.
  • --bundle specify a separate JS file export when using --consolify.
  • --transform specifies a Browserify transform to add. Can be specified multiple times. Options can be passed with subargs.
  • --global-transform specifies a Browserify transform to add globally. Can be specified multiple times. Options can be passed with subargs.
  • --plugin specifies a Browserify plugin to add. Can be specified multiple times. Options can be passed with subargs.
  • --extension search for files with the extension in "require" statements.
  • --no-browser-field turns off package.json browser field resolution.
  • --no-commondir preserve original paths.
  • --external marks given path or module as external resource and prevent from being loaded into the bundle.
  • --yields or -y changes the yield interval to allow pending I/O to happen.
  • --version or -v shows the Mochify version number.
  • --help or -h shows usage and all available options.
  • --async-polling disables async polling when set to false (for use in Appium).
  • --mocha-path specifies path to a custom Mocha module
  • --web-security allows disabling same-origin policy (when set to false, passes down --disable-web-security to Chromium)

Continuous Integration

To run builds in CI services like Travis or CircleCI, you must pass --allow-chrome-as-root.

Here is a minimal .travis.yml:

language: node_js
node_js:
  - "16"

sudo: false

script:
  - npm test -- --allow-chrome-as-root

Selenium WebDriver setup

java -jar selenium-server-standalone-2.39.0.jar

Create .min-wd in your project root:

{
  "hostname": "localhost",
  "port": 4444,
  "browsers": [{
    "name": "internet explorer",
    "version": "11"
  }, {
    "name": "chrome"
  }, {
    "name": "firefox"
  }]
}

That's it! Now mochify --wd will run your Mocha test cases in the configured browsers simultaneously. If you installed mochify without -g, you will have to run node_modules/.bin/mochify --wd.

Additional Selenium capabilities and browser-specific capabilities can be specified with the capabilities property:

{
  "hostname": "localhost",
  "port": 4444,
  "browsers": [{
    "name": "chrome",
    "capabilities": {
      "chromeOptions": {
        "args": ["--headless", "--disable-gpu"]
      }
    }
  }]
}

SauceLabs setup

Export your SauceLabs credentials:

export SAUCE_USERNAME="your-user-name"
export SAUCE_ACCESS_KEY="your-access-key"

Enable SauceLabs in your .min-wd file or in the "webdriver" property in your package.json:

{
  "sauceLabs": true
}

For more information about Selenium WebDriver and SourceLabs support can be found on the min-webdriver project page.

Appium setup

Note: This has only be tested on Mac OS X High Sierra with the iOS Simulator so far. If you have successfully tested with other configurations, please file an issue so that we can extend the docs.

Setup for iOS Simulator on Mac OS X (requires XCode):

  • npm install -g appium
  • brew install carthage
  • Configure your .min-wd file or the "webdriver" property in your package.json like this:
{
  "hostname": "localhost",
  "port": 4723,
  "browsers": [{
    "name": "Safari",
    "platformName": "iOS",
    "platformVersion": "11.2",
    "deviceName": "iPhone Simulator"
  }]
}
  • Run appium --log-level error which should start a server on port 4723
  • Run mochify --wd --async-polling false

It's important to use --async-polling false here. The default asynchronous polling does not work with this setup.

BrowserStack setup

Export your BrowserStack credentials:

export BROWSERSTACK_USERNAME="your-user-name"
export BROWSERSTACK_ACCESS_KEY="your-access-key"

Example .min-wd file:

module.exports = {
  "hostname": "hub-cloud.browserstack.com",
  "port": 80,
  "browsers": [{
    "name": "chrome",
    "capabilities": {
      "browser": "Chrome",
      "browserstack.user": process.env.BROWSERSTACK_USERNAME,
      "browserstack.key": process.env.BROWSERSTACK_ACCESS_KEY
    }
  }]
}

Reporters

Mocha reporters known to work:

  • min
  • dot
  • list
  • spec
  • tap
  • json
  • doc
  • xunit
  • markdown
  • landing
  • nyan

Note: Consuming the output of a machine readable reporter may not work as expected with --wd.

API

var mochify = require('mochify');

mochify('./test/*.js', {
  reporter: 'tap'
}).bundle();
  • mochify() uses default settings and runs tests in ./test/*.js
  • mochify(paths) specifies the paths, a space delimited list of globs
  • mochify(opts) configures options as described below
  • mochify(paths, opts) combines custom paths and options

All long form command line options can be used. E.g. --node can be configured as { node : true }, --no-browser-field as { 'browser-field': false }, --reporter tab as { reporter : 'tab' } and so on.

Additional API options:

  • output a stream that receives the test output (e.g. through2)
  • glob options to pass to glob
  • reporterOptions options to pass to mocha reporter

The mochify function returns a Browserify instance. Please refer to the Browserify API for details.

Code coverage with NYC

Install nyc, the babelify transform, @babel/core and babel-plugin-istanbul:

$ npm install nyc babelify @babel/core babel-plugin-istanbul --save-dev

Using a package.json script that can be run with npm run cover:

{
  "scripts" : {
    "cover" : "nyc --instrument false mochify --transform [ babelify --ignore [ test ] --plugins [ babel-plugin-istanbul ] ]"
  }
}

Workaround for Apple Silicon

Puppeteer fails to launch on M1. Follow these steps to work around:

  • Install Google Chrome

  • Define these environment variables:

    export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
    export PUPPETEER_EXECUTABLE_PATH=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

Compatibility

  • v8.x
    • Node Node 12.0+, Node 14.0+, Node 16.0+
    • Mocha ^8.4
    • Browserify ^16.5
    • Puppeteer ^9.1
  • v7.x
    • Node 10.0+, Node 12.0+, Node 14.0+
    • Mocha ^5.2
    • Browserify ^16.5
    • Puppeteer ^5.3
  • v6.x
    • Node 6.0+, Node 8.0+, Node 10.0+
    • Mocha ^5.2
    • Browserify ^16.2
    • Puppeteer ^1.10
  • v5.2+
    • Node 6.0+, Node 8.0+
    • Mocha ^4.1
    • Browserify ^15.2
    • Puppeteer ^1.0
  • v5.0 - v5.1
    • Node 6.0+, Node 8.0+
    • Mocha ^4.0
    • Browserify ^14.4
    • Puppeteer ^0.13
  • v4.x
    • Node 4.0+, 6.0+, Node 8.0+
    • PhantomJS 1.9, 2.0
    • Mocha ^4.0
    • Browserify ^14.4
  • v3.x
    • Node 4.0+
    • Mocha ^3.2
    • Browserify ^14.1
  • v2.15+
    • Browserify 13.x
  • v2.14
    • Mocha ^2.3
  • v2.13
    • Browserify 11.x
  • v2.10 - v2.12
    • Browserify 10.x
  • v2.5 - v2.9
    • Browserify 9.x
  • v2.4
    • Browserify 8.x
  • v2.3
    • Browserify 7.x
  • v2.0 - v2.2
    • Browserify 6.x
    • Mocha 2.x
  • v1.x
    • Browserify 5.x
    • Mocha 1.x
  • v0.x
    • Browserify 4.x

License

MIT

mochify.js's People

Contributors

albertyw avatar andreypopp avatar barneycarroll avatar bitmage avatar boneskull avatar chromakode avatar decompil3d avatar dependabot[bot] avatar dylanfm avatar fatso83 avatar fearphage avatar ferlores avatar gregm avatar hakatashi avatar jcrugzz avatar jeromegn avatar jonnyreeves avatar jprichardson avatar kolodny avatar krawaller avatar m90 avatar mantoni avatar melatonin64 avatar mroderick avatar p4ul avatar scottcorgan avatar seanchas116 avatar steffenl avatar wesleytodd avatar wired8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mochify.js's Issues

--help is broken

Right after fresh npm install mochify:

% mochify -h
wmbp % ./node_modules/.bin/mochify -h                                                                                 ~/Workspace/react-async

fs.js:427
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory '/Users/andreypopp/Workspace/react-async/node_modules/mochify/lib/help.txt'
    at Object.fs.openSync (fs.js:427:18)
    at Object.fs.readFileSync (fs.js:284:15)
    at Object.help (/Users/andreypopp/Workspace/react-async/node_modules/mochify/lib/args.js:25:29)
    at module.exports (/Users/andreypopp/Workspace/react-async/node_modules/mochify/lib/args.js:87:25)
    at Object.<anonymous> (/Users/andreypopp/Workspace/react-async/node_modules/mochify/bin/cmd.js:22:15)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Updating from 0.11.3 to >1.0.0 I get missing module errors

It works until I upgrade to 1.0.0. Its failing on the first require in the test directory. It imports stuff out of main code and libraries fine.

# phantomjs:
Error: Cannot find module './utils'
    at test/ad.js:7
    at null:null


  0 passing (1ms)

Error: Exit 1

Require mochify

I'm trying to integrate mochify into my gulp build processes, but invoking require( 'mochify' ) results in

module.js:340
    throw err;
    ^
Error: Cannot find module 'mochify'
    at Function.Module._resolveFilename (module.js:338:15)

Thought this might have been down to npm getting out of synch, but an npm install from scratch (with mochify in my devDependencies) and build effectively reproduces this.

Using chai with mocha

Not clear to me how would I use this assertion lib

Update
I should blame myself for opening this ticket
it was fairly easy to do so:

chai = require 'chai'
chai.should()

ReferenceError: Can't find variable: describe

Sometimes I get

ReferenceError: Can't find variable: describe
    at tests/checkboxgroup.js:76
    at null:null
Error: Exit 1

sometimes not. Can't easily isolate the issue.

To reproduce:

  • git clone https://github.com/prometheusresearch/react-forms
  • git co immutable
  • make integration-ci

Weird behaviour with watch and phantomjs on Linux

For some reason on Linux when running mochify --watch mochify doesn't show the test results (or error stack traces) on source changes unless you have console.log in your test code. Only single newlines is being printed instead.

Webdriver asynchronous behaviour is inconsistent using the API

Trying to use mochify from gulp I noticed that using wd: true leads to a different asynchronous behaviour than when using phantomjs or node.

Here is a sample project that show the issue: https://github.com/eskatos/gulp-mochify-attempt

gulp tasks:

  • test_node
  • test_phantomjs
  • test_wd

The test_wd task return too soon, hence getting the test report in gulp not working.
This is different from test_node and test_phantomjs that just works.

Is there a callback somewhere that could be used to work around this?

Anyway, for the sake of the least surprise principle, I think this should be fixed.
WDYT?

sourceMappingURL and consolify

Hi there,

I'm using mochify and consolify options in a gulp project. Everything works like a charme expect sourceMappingURL missing on my runner.html generated by --consolify. Currently Mochify accepts a debug option but his meaning is not the same of Browserify.

So I dug in mochify source code and to me the browserify debug options seems true as default so dunno why sourceMappingURL is missing. I would like debug my tests sometimes in a browser.

My mochify.js:

gulp.task('mochify', function () {
  mochify( config.test, {
    reporter : 'spec',
    debug: true,
    //cover    : true,
    consolify : 'runner.html'
  }).bundle();
});

Have you any workaround?
cheers Lorenzo

Browserify as a peerDependency

I noticed mochify has browserify as a devDependency so mochify uses its own version of browserify.
I'm using grunt-browserify to build my actual project which has a different version of browserify as a devDependency as well so that means my code is build differently than my tests. This seems like a very bad idea.
If mochify.js has browserify as a peerDependency i can atleast define browserify in the project so that is uses the same code as node_modules/.bin/browserify does and i can just either put in a PR with grunt-browserify or just use grunt-shell like i do to wrap mochify

How can I test sample html page?

Hi!,

How can I load and test an script that requires a DOM loaded (for example, test a click event)? Sorry for the noob question :S

You made a great tool!!

Thanks!

Enable mochify as a local install?

Given an npm project where mochify works as expected with minimal config when executed directly from the command line with $ mochify, invoking it via npm test (by specifying the package.json's test script as { "scripts" : { "test" : "mochify" } } ) fails with the following error:

/Users/barney/Documents/git/phui/node_modules/mochify/node_modules/resolve/lib/sync.js:33
    throw new Error("Cannot find module '" + x + "' from '" + y + "'");
          ^
Error: Cannot find module 'mocha/mocha' from '/Users/barney/Documents/git/phui/node_modules/mochify/node_modules/mocaccino/lib'

I assume this is down to mochify only working as a global install (possibly because of components' dependencies on binaries not installed via npm?). To be honest I've spent so long hacking at this that I've forgotten the steps it's taken me to get my environment beaten into shape, but I'd expect to reliably get test suite to work via npm install && npm test for the sake of CI…

Need to pass --web-security=[true|false] to phantomjs

Hey!
I'm building an api module that is supposed to work both in node and in privileged browser environments such as PhoneGap/Cordova. It contains integration tests making cross-origin requests to a url that is not CORS-enabled. This is fine for my use-case since the XHR in PhoneGap/Cordova is not restricted by the same-origin policy.

These integration tests work with mocha (since node too can make cross-origin requests), but fail in mochify since it's not currently possible to pass the necessary --web-security=false flag into mochify and on to phantomic and phantomjs. Do you think we could add support for it somehow? If so, I can do the implementation, but we'd of course have to agree on a sane solution.

I guess we could either make some kind of subargs thingy that lets you specify arbitrary arguments to be passed on from mochify to phantomic and then on to phantomjs, or we could add an explicit --web-security flag to mochify and phantomic. Do you prefer any of them, or do you have any other ideas?

Thanks!

Trying to use Webdriver get syntax error in lodash

I'm using saucelabs with .min-wd setup and env variables running it like

node_modules/.bin/mochify --reporter spec --port 9001

works fine but running it like

node_modules/.bin/mochify --wd

SyntaxError: Line 3841: Unexpected token ( while parsing /home/mike/code/smokejs/node_modules/lodash/dist/lodash.js

Not really sure why lodash would be erroring. If you check out the project and add the .min-wd should be able to test

Question about global variables

@mantoni This is just a question about a use case that I came across while writing my tests. Imagine you want to test this:

function myMethod(a) {
  if (a) {
    window.location.replace(a);
  }
}

How do you mock window or any other global object (console, etc) using mochify?

Thanks
F

don't process .json files in test/ dir

Somewhere between 0.4.2 and 0.9.2 it started opening up *.json files in the test/ directory. You'd think it wouldn't be a problem given that JSON is a subset of JavaScript, but the following error is produced:

ParseError: Unexpected token :

Any thoughts?

TypeError: 'undefined' is not an object (evaluating 'system.stdout.write')

Hi! Great tool, always wanted to have such CLI tool for easy tests.
I’m trying to set up tests for mucss, but constantly get a meaningless error:

$ npm test

> [email protected] test c:\Users\dmitry\Dropbox\Projects\mucss
> mochify

# phantomjs:
TypeError: 'undefined' is not an object (evaluating 'system.stdout.write')
    at test\index.js:52

AYCS, there’s nothing on the line 52 in test/index.js. I even have no clue where to start searching for an explanation. I tried to console.log in different places, and found out that it breaks after descibe but before first it() triggers.

  • I use windows 7.

How to use just coverify with mocha

Found this project from substack/coverify#12.

Seems to be a lot here. I'm just interested in coverify working with my mocha tests.

How does this solve the problem?

Fix to support PouchDB (IndexedDB)

Any tests with PouchDB fail with the following error:

= chrome * ===================================================================
POST /wd/hub/session/559c8f03-5af1-45b4-b723-d6973951b198/execute

Unexpected HTTP status: 500 Internal Server Error

date: Wed, 25 Jun 2014 04:06:23 GMT
server: Jetty/5.1.x (Mac OS X/10.9.3 x86_64 java/1.8.0_05
expires: Thu, 01 Jan 1970 00:00:00 GMT
cache-control: no-cache
content-type: application/json;charset=UTF-8
content-length: 302420

    <unknown>: Failed to execute 'open' on 'IDBFactory': access to the Indexed Database API is denied in this context.

....

It looks like it doesn't like opening up an IndexedDB in this context... not sure the context that is used. Maybe a workaround would be some way to disable chrome security? Maybe some other fix?

Edit: If needed, I could setup a project to easily demonstrate the problem. Just let me know. Thanks.

mochify does not find module test/index.js

Hey,

I would love to use mochify for component development and I definitely see the need for a browser side test runner.

Unfortunately I always get test/index.js when calling mochify --reporter spec test/index.js from my directory root.

Any idea what I am doing wrong?

Non-JS extensions support?

Thanks for nice project!

I'm trying to use mochify.js in a CoffeeScript-written project and I would like to require CoffeeScript code (or other non-JS code) without extensions by settings Browserify's "extension" option in mochify.js.
(I think it is related to this PR but it's not yet merged)

Is it possible to do this in current mochify.js?

Using Browser Launcher

Sometimes I'd like to be able to interact with a failing test. In python I'd use a debugger like pdb but in JS i typically use the browsers tools.
Have you thought about adding browser-launcher(like testling) so you can open it in a local browser?

Using Sinon

I've been able to use Sinon with browserify by simple including it as a script before by budled tests. Is there a good way to do this with mochify?

Or do you have another fakeServer solution that works?

Is it possible to include a file to be loaded in the html generated for phantom?

I'm a bit noob to all of this, but I actually have a file with all of my vendor libs which just defines things globally for me, and then the bundle I want to test only contains my app code (relying on the aforementioned globals). Is it possible to specify this file in the options somewhere so the tests will run properly?

#featureRequest browserSync integration

Would be great if it can be used with BrowserSync to serve the local folder with tests
The same way PhantomJS does it, but its chromedevtools is outdated and in my case, after each test it's crashing(see #45 )

I will see how I can do it myself as well, Will PR if I get it done
BrowserSync can fire localhost and specify the folder to serve.
It only makes sense to integrate it on watch, so people can move to sources and start debugging code there

Bug introduced in Version 0.11 and up

I'm not totally sure as to how this bug was introduced or exactly what it does but somehow upgradeing from 0.10.0 to 0.11.0 cuases a bunch of my configuration variables to get trashed.

To test this checkout
git clone [email protected]:motherjones/smokejs.git
cd smokejs
npm install
sudo npm install -g grunt-cli
npm install [email protected] (or above)

edit js/config.js and console.log(exports) at the bottom of the file.

grunt test

If you look at the console log MIRROR_DOMAIN MIRRORS_URL and MEDIA_STORE
are not set to the proper values anymore but instead are set to the path to jquery and a line number like so

{ MIRRORS_DOMAIN: '/home/mike/code/smokejs/node_modules/jquery/dist/jquery.js:2312',
  MIRRORS_URI: '/mirrors/',
  MIRRORS_URL: '/home/mike/code/smokejs/node_modules/jquery/dist/jquery.js:2312/mirrors/',
  AD_LOCATION: 'http://mj-tech.s3.amazonaws.com/ad_w_intersitial.html',
  MEDIA_STORE: '/home/mike/code/smokejs/node_modules/jquery/dist/jquery.js:1311',
  log: [Function],
  ERROR_HANDLER: [Function] }

Took me forever to figure out it was a mochify version. But if you downgrade it to
npm install mochify 0.10.0

you should get this

{ MIRRORS_DOMAIN: 'http://localhost:9001',
  MIRRORS_URI: '/mirrors/',
  MIRRORS_URL: 'http://localhost:9001/mirrors/',
  AD_LOCATION: 'http://mj-tech.s3.amazonaws.com/ad_w_intersitial.html',
  MEDIA_STORE: 'http://localhost:8000',
  log: [Function],
  ERROR_HANDLER: [Function] }

out-of-box failure

First install / use experience:

mochify
TypeError: 'undefined' is not an object (evaluating 'brout.on')
    at http://localhost:54043?brout/js/bundle:16
TypeError: 'undefined' is not an object (evaluating 'Mocha.process.stdout = process.stdout')
    at http://localhost:54043?brout/js/bundle:8130

Not sure what's going on.

Can not load files with XMLHttpRequest

If my code tries to load a file using XMLHttpRequest it will always fail. At first I suspected it was because the file couldn't be found. It's pretty unclear what is considered the root when running tests with mochify. I assumed it would be the directory of the js file passed to mochify or the CWD. But after having moved the to-be-loaded file around it kept on failing, so now I'm suspecting it's due to the web-security setting of phantomjs being true by default. I had a look at the code of mochify and phantomic, but it doesn't seem like it's possible to pass any arguments to the phantomjs instance, is it?

Using API output stream

I'm using 2.1 and trying to use the API instead of the cli. I'm using it in grunt, we have to build templates and afew other things before we can run tests.
Its working in node but i looks like i need to use the output mentioned in docs so I can get grunt to output the results. Do you have an example of using output?(i looked at the through2 docs but was a bit lost)

Support for specifying browserify transforms from a command line

My workflow has changed recently, before I was publishing code on npm with unprocessed sources (using JSX + ES6) but now I decided it is easier to publish ES5 compiled code instead so Node.js could consume it w/o troubles.

So I went and removed all browserify config from package.json. But that made testing a bit more difficult because I need to run tests against compiled code which is almost impossible to do right with --watch (I need to watch code to compile it and watch with mochify to run tests — so complex!).

Instead I want to propose adding transforms to mochify via command line -t/--transform option. What do you think?

Passing --recursive option

I can only find mention of Mocha's --recursive option in #17.
Just wondering how I can pass this option through to Mocha. Is it supported?
Thanks.

API Transforms w/ Options

How do I specify options for transforms (using more than 1) using the API syntax? Saw this thread: #39 but I can't find a way to pass options to the transform.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.