Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

How to specify 3rd party preprocessors for karma in web-module build's config? #408

@4d4mm

Description

@4d4mm

I was trying to configure nwb with karma-html2js-preprocessor with the following configuration:

module.exports = {
  type: 'web-module',
  npm: {
    esModules: true,
    umd: false
  },
  karma: {
    preprocessors: {
      'tests/data/**/*.html': ['html2js']
    },
    testFiles: [
      'tests/data/**/*.html'
    ],
    html2JsPreprocessor: {
      stripPrefix: 'tests/data/',
      processPath: function(filePath) {
        return filePath.replace(/\.html$/, '');
      }
    }
  }
}

Seemingly, the both the preprocessors and the html2JsPreprocessor are completely ignored. As I can see, the getKarmaPluginConfig() has only hardwired preprocessors config:

var preprocessors = {};

  if (userKarma.testContext) {
    files.push(userKarma.testContext);
    preprocessors[userKarma.testContext] = ['webpack', 'sourcemap'];
  } else {
    testFiles.forEach(function (testGlob) {
      files.push(testGlob);
      preprocessors[testGlob] = ['webpack', 'sourcemap'];
    });
  }

I understand that nwb karma config is not the same as the raw karma config because it's being transformed. Do you guys have a workaround for this? Am I missing something? Is there any way to configure nwb karma with 3rd party pre-processors?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions