Skip to content

Instantly share code, notes, and snippets.

@duereg
Last active March 28, 2017 13:03
Show Gist options
  • Save duereg/8e398f05e962af0965053d8ddf827165 to your computer and use it in GitHub Desktop.
Save duereg/8e398f05e962af0965053d8ddf827165 to your computer and use it in GitHub Desktop.
Node 6.10.1 test
{
"sourceMap": true,
"presets": ["es2015-node6"],
"plugins": ["add-module-exports", "transform-object-rest-spread"]
}
const DEFAULT_FLAGS = [1];
export default function brokenNodeTest() {
const query = {
flags: true ?
[...DEFAULT_FLAGS, 2] :
DEFAULT_FLAGS
};
}
import assert from 'assert';
import brokenNodeTest from './brokenNodeTest';
describe.only('broken node test', () => {
let results;
describe('this should not explode', () => {
beforeEach(() => {
results = brokenNodeTest();
});
it('no explode', () => {
assert(true);
});
});
});
import gulp from 'gulp';
import istanbul from 'gulp-istanbul';
import {Instrumenter} from 'isparta';
import mocha from 'gulp-mocha';
function runTestsWithCoverage(cb) {
return gulp.src(['./brokenNodeTest.js'])
.pipe(istanbul({ // Covering files
instrumenter: Instrumenter,
includeUntested: true
}))
.pipe(istanbul.hookRequire()) // Force `require` to return covered files
.on('finish', function finish() {
gulp.src(["./brokenNodeTest.spec.js"], {read: false})
.pipe(mocha({reporter: 'spec', timeout: 15000}))
.pipe(istanbul.writeReports({
dir: "coverage",
reportOpts: {dir: "coverage"},
reporters: ['text', 'text-summary', 'json', 'html']
}))
.on('end', console.error)
.on('error', console.error);
});
}
gulp.task('unit-test', runTestsWithCoverage);
gulp.task('default', ['unit-test']);
gulp.task('test', ['unit-test']);
{
"name": "make-v8-great-again",
"version": "1.0.0",
"description": "Make V8 go boom!",
"dependencies": {
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-transform-object-rest-spread": "^6.3.13",
"babel-preset-es2015-node6": "^0.3.0",
"babel-register": "^6.3.13",
"gulp": "^3.9.0",
"gulp-istanbul": "duereg/gulp-istanbul#143c0bad",
"gulp-mocha": "^2.0.1",
"isparta": "^4.0.0"
},
"engines": {
"node": "6.10.1",
"npm": "^4"
}
}
@hzoo
Copy link

hzoo commented Mar 28, 2017

btw I'd recommend using https://github.com/babel/babel-preset-env/ instead

{
  "presets": [
    ["env", {
      "targets": {
        "node": "current" // or 6.10
      }
    }]
  ]
}

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