packages/karma-esm/src/preprocessor.js
function karmaEsmPreprocessor(logger) {
  const log = logger.create('preprocessor.esm');

  function preprocess(code, file, done) {
    try {
      let compiledCode = esm.compiler.getCached(file.originalPath);
      if (!compiledCode) {
        compiledCode = esm.compiler.compile(file.originalPath, code);
      }
      done(null, compiledCode);
    } catch (e) {
      const message = `\n\n${e.message}\n at ${file.originalPath}\n\n`;
      log.error(message);
      done(null, code);
    }
  }

  return preprocess;
}
function karmaEsmPreprocessor(logger) {
  const log = logger.create('preprocessor.esm');

  function preprocess(code, file, done) {
    try {
      let compiledCode = esm.compiler.getCached(file.originalPath);
      if (!compiledCode) {
        compiledCode = esm.compiler.compile(file.originalPath, code);
      }
      done(null, compiledCode);
    } catch (e) {
      const message = `\n\n${e.message}\n at ${file.originalPath}\n\n`;
      log.error(message);
      done(null, code);
    }
  }

  return preprocess;
}
function karmaEsmPreprocessor ( logger ) { const log = logger . create ( 'preprocessor.esm' ) ; function preprocess ( code , file , done ) { try { let compiledCode = esm . compiler . getCached ( file . originalPath ) ; if ( ! compiledCode ) { compiledCode = esm . compiler . compile ( file . originalPath , code ) ; } done ( null , compiledCode ) ; } catch ( e ) { const message = ` \n \n ${ e . message } \n ${ file . originalPath } \n \n ` ; log . error ( message ) ; done ( null , code ) ; } } return preprocess ; }
Karma preprocessor to handle compiling entry point test files.
Karma preprocessor to handle compiling entry point test files .