Nutritious Pancake Mountain

    run-jasmine-browser

    0.1.0 • Public • Published

    run-jasmine-browser

    A tool that makes it really easy to run your Jasmine tests in a browser.

    It doesn't require any extra setup on your part, and you are not required to be using Gulp or Webpack or even Babel in your project.

    Prerequisites

    You should have node and either yarn or npm installed, and you should have some tests written with Jasmine.

    Usage

    First, install it:

    yarn add -D run-jasmine-browser
    # or 
    npm i run-jasmine-browser --save-dev

    Then, import it and start up the test server with one function call!

    For example, in run-tests.js:

    const runTests = require('run-jasmine-browser');
     
    // with default options:
    runTests();
     
    // or, with options:
    runTests({ testFiles: 'tests/**/*.test.js' });

    Then, you would run node run-tests.js to start up the Jasmine server.

    Better yet, put it in an NPM script in your package.json:

      "scripts"{
        "test": "node run-tests.js
      }

    Then, it would just be yarn test or npm test to start up the test server.

    Options

    As shown above, you can pass an options object to configure the way the tests are run. Here are the options:

    testFiles

    Pattern to use to find test files that Jasmine will run.

    default: spec/**/*_spec.js

    babelOptions

    Options to pass directly to Babel, which will transpile your code before running the tests.

    default: Transpiles using babel-preset-env and babel-preset-react. If you're writing ES6 and/or React code with JSX, there's a good chance you won't need to specify anything here.

    Install

    npm i run-jasmine-browser

    DownloadsWeekly Downloads

    2

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    164 kB

    Total Files

    6

    Last publish

    Collaborators

    • reid47