import { createFilter } from 'rollup-pluginutils';
import istanbul from 'istanbul';

export default function (options = {}) {
  const filter = createFilter(options.include, options.exclude);

  return {
    transform (code, id) {
      if (!filter(id)) return;

      var InstrumenterImpl = (options.instrumenter || istanbul).Instrumenter;
      var instrumenterOptions = options.instrumenterConfig || { };
      if (!('esModules' in instrumenterOptions)) {
        instrumenterOptions.esModules = true;
      }

      instrumenterOptions.codeGenerationOptions = instrumenter.codeGenerationOptions || {
        sourceMap: id,
        sourceMapWithCode: true
      };

      var instrumenter = new InstrumenterImpl(instrumenterOptions);

      code = instrumenter.instrumentSync(code, id);

      var map = instrumenter.lastSourceMap();
      map = map ? map.toJSON() : { mappings: '' };

      return { code, map };
    }
  };
}

@@ -396,17 +396,16 @@
 fig %7C%7C %7B
- 
 %7D;%0A     
@@ -567,16 +567,23 @@
 rumenter
+Options
 .codeGen

fix failing tests