javascript - Setting the module path for gulp-jasmine -
i'm trying unit test javascript code jasmine uses peg parser. peg parser built @ build time.
unfortunately haven't found out how tell jasmine dynamically built parser is.
so far i've got:
gulp.task('parser', () => { return gulp.src("src/parser.peg") .pipe(peg()) .pipe(gulp.dest(".obj")) }); gulp.task('test', ["parser"], () => { return gulp.src(["tests/**/*.js", "src/**/*.js", ".obj/parser.js"]) .pipe(jasmine()) });
now, time tests run, parser correctly built , put in .obj
; it's not on module path, test loads real code, real code tries import parser "parser"
, , test fails.
i change real code import ../obj/parser
instead of parser
, fail in production, of course. need somehow tell jasmine find modules in .obj
. how?
Comments
Post a Comment