Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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