Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

floss

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

floss

Unit-testing for those hard to reach places

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
249
increased by1.63%
Maintainers
2
Weekly downloads
 
Created
Source

Floss

Unit-testing for those hard to reach places.

Uses Electron to provide a Mocha unit-testing environment which can be run headlessly or to debugged with DevTools. This was largely inspired by the electron-mocha and mocha-electron projects but didn't quite have the debugging features needed to develop tests.

Gulp Usage

var floss = require('floss');
gulp.task('test', function(done) {
    floss.run('test/index.js', done);    
});

Debug Mode

Open tests in an Electron window where test can can be debuged with debugger and dev tools.

gulp.task('test', function(done) {
    floss.run({
        path: 'test/index.js',
        debug: true
    }, done);
});

Additional Options

Additional properties can be passed to the test code by adding more values to the run options.

gulp.task('test', function(done) {
    floss.run({
        path: 'test/index.js',
        customUrl: 'http://localhost:8080' // <- custom
    }, done);
});

The test code and use the global options property to have access to the run options.

console.log(options.customUrl); // logs: http://localhost:8080

Command Line Usage

Installed globally via npm install -g floss.

floss --path test/index.js

Or installed locally:

node node_modules/.bin/floss --path test/index.js

Debug Mode

To enable debugging use the --debug argument:

floss --path test/index.js --debug

Travis Integration

Floss can be used with Travis CI to run Electron headlessly by utilizing Xvfb. Here's a sample of how to setup this project.

package.json

Note that scripts test must be setup in your package.json;

{
    "scripts": {
        "test": "gulp test"
    }
}

.travis.yml

language: node_js
node_js:
    - "4"

install:
    - npm install xvfb-maybe
    - npm install

before_script:
  - export DISPLAY=':99.0'
  - Xvfb :99 -screen 0 1024x768x24 -extension RANDR &

script:
    - xvfb-maybe npm test

FAQs

Package last updated on 19 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc