Skip to content

Instantly share code, notes, and snippets.

@pedzed
Forked from mauvm/Jasmine-and-Babel6.md
Last active August 25, 2016 16:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedzed/e69dad09f3a2e39951bd98cfe2d04a7a to your computer and use it in GitHub Desktop.
Save pedzed/e69dad09f3a2e39951bd98cfe2d04a7a to your computer and use it in GitHub Desktop.
Jasmine ES6 run script for use with Babel 6
npm i -D jasmine babel-cli babel-preset-es2015 babel-watch

.babelrc:

{
  "presets": [
    "es2015"
  ]
}

package.json:


"scripts": {
  "test": "babel-node spec/run.js",
  "test-watch": "babel-watch spec/run.js"
},

spec/run.js:

import Jasmine from 'jasmine';

const jasmine = new Jasmine();
jasmine.loadConfigFile('spec/support/jasmine.json');
jasmine.execute();

Initialize Jasmine:

jasmine init

Add your tests to the spec folder and start testing:

npm run test
npm run test-watch

Note: babel-watch does not work on Windows as mentioned here: https://www.npmjs.com/package/babel-watch#system-requirements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment