GithubHelp home page GithubHelp logo

andreaspizsa / setup-browser-env Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 2.67 MB

✅ Simplified browser testing in node.

License: MIT License

JavaScript 100.00%
nodejs node-js browser-tests browser-testing ava mocha mocha-tests mochajs ava-tests

setup-browser-env's Introduction

setup-browser-env

postinstaller build coverage license version downloads

Simplifies simulating a global browser environment using browser-env.

Motivation

setup-browser-env simplifies simulating a global browser environment using browser-env with zero configuration, keeping your project structure lean, clean & organized.

Features

  • Compatible. Works with ava, mocha and everything else.
  • Zero Configuration for ava. npm add, done.
  • Configurable. via package.json or browser-env.{js, json, yaml}
  • Reliable. 100% Code Coverage.
  • Free. MIT License.

Usage

Install

npm add -D setup-browser-env

ava

Automatic configuration

If you’re using ava as a devDependency, installing setup-browser-env will configure ava automatically (using postinstaller).

Manual configuration
// package.json
{
  "ava": {
    "require": [
      "setup-browser-env"
    ]
  }
}

mocha

Manual configuration
# mocha.opts
--require setup-browser-env

Advanced Configuration

setup-browser-env runs out of the box without further configuration. You can still set options if needed in your package.json or a browser-env.{js,json,yaml} config file.

To learn about all configuration options, please see browser-env and jsdom.

package.json

{
  "browser-env": {
    "globals": ["window", "document"],
    "jsdom": {
      "userAgent": "My User Agent"
    }
  }
}

Shortcuts

Pass only the of name global properties without setting jsdom options:

{
  "browser-env": "window document"
}
{
  "browser-env": ["window", "document"]
}

Pass only jsdom options without setting the of name global properties:

{
  "browser-env": {
    "userAgent": "My User Agent"
  }
}

Copyright © 2018 Andreas Pizsa. Licensed under the MIT license.

setup-browser-env's People

Contributors

andreaspizsa avatar greenkeeper[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.