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 initAdd 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