Friday 15 August 2014

javascript - Jasmine tests and ES6 module transpiler -



javascript - Jasmine tests and ES6 module transpiler -

i have issue es6 module transpiler , jasmine tests, here it:

import foo '../dist/foo.js'; describe('test foo', ()=>{ allow foo beforeeach(()=>{ foo = new foo() }) it('foo should create new instance', ()=>{ expect(foo instanceof foo).tobe(true) }) })

and gulp file:

gulp.task('tests:concat', function(){ homecoming gulp.src(['spec/*.js', '!spec/all.spec.js']) .pipe(concat('all.spec.js')) .pipe(gulp.dest('spec/')) }) gulp.task('tests:es6', ['tests:concat'], function(){ homecoming gulp.src('spec/all.spec.js') .pipe(es6moduletranspiler({ type: 'cjs' })) .pipe(es6transpiler()) .pipe(gulp.dest('spec/')) }) gulp.task('tests', ['tests:es6'], function(){ gulp.src('spec/all.spec.js') .pipe(browserify()) .pipe(gulp.dest('spec/')) })

and when seek run task

gulp tests

i got

throw err ^

error: no writecb in transform class

so found error throw globals such describe in tests, because if add together line:

let describe, beforeeach, it, expect

compilation finish without problems

in documentation es6 module transpiler no info how allow globals. how resolve it?

javascript jasmine ecmascript-6 code-translation

No comments:

Post a Comment