SBoudrias / gulp-istanbul

Istanbul unit test coverage plugin for gulp.
MIT License
186 stars 87 forks source link

unexpected token "export" #104

Closed caperavensoftware closed 8 years ago

caperavensoftware commented 8 years ago

i get a unexpected token error on this code:

class ValueAdder {
}
export default class Multiplyer {
}
export class Calculator {
    add(value1, value2) {
        return value1 + value2;
    }
}
export function TestCalculator(value1, value2) {
    return value1 + value2;
}

If you delete the export keyword it works fine again

task =

function coverageUnit(path) {
    return new Promise(function(resolve) {
        gulp.src(paths.compiledSourceFiles)
            .pipe(istanbul({includeUntested: true}))
            .pipe(istanbul.hookRequire())
            .on('finish', function() {
                testUnit(path)
                    .pipe(istanbul.writeReports({
                        dir: "audits"
                    }))
                    .on("finish", resolve);
            });
    })
}
SBoudrias commented 8 years ago

The default AST parser used by istanbul doesn't fully support ES6 yet. Please refer to gulp-istanbul documentation on custom instrumenters (you'll probably want to use esparta).