Skip to content

Instantly share code, notes, and snippets.

@tracker1
Created March 24, 2015 00:43
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save tracker1/04dccf21ffd92d4d16e2 to your computer and use it in GitHub Desktop.
Save tracker1/04dccf21ffd92d4d16e2 to your computer and use it in GitHub Desktop.
ES6 Testing With Mocha and BabelJS
{
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": false,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": true,
"modules": false,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": false,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"octalLiterals": false,
"regexUFlag": false,
"regexYFlag": false,
"superInFunctions": false,
"templateStrings": true,
"unicodeCodePointEscapes": false,
"globalReturn": false,
"jsx": false
},
"rules": {
"strict": "never",
"quotes": "single",
"curly": "multi-line",
"comma-style": "first",
"comma-spacing": "off",
"no-use-before-define": "nofunc",
"no-trailing-spaces": false,
"no-underscore-dangle": false
},
"globals": {
//from node
"require": false,
"module": false,
"exports": false,
"process": false,
}
}
{
"config": {
"MOCHA_OPTS": "--recursive test/unit/",
"ISPARTA_OPTS": "--report html",
"COVERAGE_OPTS": "--statements 100 --functions 100 --branches 100 --lines 100"
},
"scripts": {
"clean": "rimraf ./dist",
"build": "babel ./src --experimental --source-maps-inline -d ./dist",
"lint": "npm run lint-src && npm run lint-test",
"lint-src": "eslint src",
"lint-test": "eslint test --global describe,it,beforeEach,afterEach --rule no-unused-expressions:false ",
"unit": "babel-node -r node_modules/.bin/_mocha $npm_package_config_MOCHA_OPTS",
"coverage": "babel-node -r node_modules/.bin/isparta cover $npm_package_config_ISPARTA_OPTS node_modules/.bin/_mocha -- $npm_package_config_MOCHA_OPTS",
"coverage-check": "node node_modules/isparta/node_modules/istanbul/lib/cli check-coverage $npm_package_config_COVERAGE_OPTS",
"show-report": "node test/open-coverage-report",
"test": "npm run lint && npm run coverage && (npm run coverage-check || node scripts/open-coverage-report)"
},
"devDependencies": {
"eslint": "^0.17.0",
"babel": "^4.7.12",
"chai": "^2.1.1",
"isparta": "^2.2.0",
"mocha": "^2.2.1",
"open": "0.0.5",
"proxyquire": "^1.4.0",
"sinon": "^1.13.0",
"sinon-chai": "^2.7.0"
}
}
if (!process.env.NODE_ENV || process.env.NODE_ENV.toLowerCase().trim().substr(0,3) === 'dev') {
console.log('opening coverage report coverage/lcov-report/index.html');
require('open')(__dirname + '/../coverage/lcov-report/index.html');
}
@Yvem
Copy link

Yvem commented Mar 15, 2016

-r is no longer a babel-node option...

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