How to use the @open-wc/testing-karma.createDefaultConfig function in @open-wc/testing-karma

To help you get started, we’ve selected a few @open-wc/testing-karma examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github open-wc / open-wc / packages / testing-karma-bs / demo / karma.conf.js View on Github external
module.exports = config => {
  config.set(
    merge(createDefaultConfig(config), {
      files: [
        // allows running single tests with the --grep flag
        { pattern: config.grep ? config.grep : 'test/**/*.test.js', type: 'module' },
      ],

      // you custom config
    }),
  );
  return config;
};
github open-wc / open-wc / packages / create / src / generators / testing-karma / templates / static / karma.conf.js View on Github external
module.exports = config => {
  config.set(
    merge(createDefaultConfig(config), {
      files: [
        // runs all files ending with .test in the test folder,
        // can be overwritten by passing a --grep flag. examples:
        //
        // npm run test -- --grep test/foo/bar.test.js
        // npm run test -- --grep test/bar/*
        { pattern: config.grep ? config.grep : 'test/**/*.test.js', type: 'module' },
      ],

      esm: {
        nodeResolve: true,
      },
      // you can overwrite/extend the config further
    }),
  );
  return config;
github open-wc / open-wc / packages / create / src / generators / app-lit-element / templates / static-testing / karma.conf.js View on Github external
module.exports = config => {
  config.set(
    merge(createDefaultConfig(config), {
      files: [
        // runs all files ending with .test in the test folder,
        // can be overwritten by passing a --grep flag. examples:
        //
        // npm run test -- --grep test/foo/bar.test.js
        // npm run test -- --grep test/bar/*
        { pattern: config.grep ? config.grep : 'components/*/test/**/*.test.js', type: 'module' },
      ],

      esm: {
        nodeResolve: true,
      },
      // you can overwrite/extend the config further
    }),
  );
  return config;
github adobe / lit-mobx / karma.conf.js View on Github external
module.exports = (config) => {
    config.set(
        merge(createDefaultConfig(config), {
            files: [
                // runs all files ending with .test in the test folder,
                // can be overwritten by passing a --grep flag. examples:
                //
                // npm run test -- --grep test/foo/bar.test.js
                // npm run test -- --grep test/bar/*
                {
                    pattern: config.grep ? config.grep : 'test/**/*.test.js',
                    type: 'module',
                },
            ],

            // see the karma-esm docs for all options
            esm: {
                // if you are using 'bare module imports' you will need this option
                nodeResolve: true,
github Dabolus / share-menu / karma.conf.js View on Github external
module.exports = config => {
  config.set(
    merge(createDefaultConfig(config), {
      files: [
        // runs all files ending with .spec in the test folder,
        // can be overwritten by passing a --grep flag. examples:
        //
        // npm test -- --grep test/foo/bar.spec.ts
        // npm test -- --grep test/bar/*
        {
          pattern: config.grep ? config.grep : 'test/**/*.spec.ts',
          type: 'module',
        },
      ],
      esm: {
        babel: true,
        nodeResolve: true,
        fileExtensions: ['.ts'],
      },
github open-wc / open-wc / packages / semantic-dom-diff / karma.conf.js View on Github external
module.exports = config => {
  config.set(
    merge(createDefaultConfig(config), {
      files: [
        // allows running single tests with the --grep flag
        { pattern: config.grep ? config.grep : 'test/**/*.test.js', type: 'module' },
      ],

      coverageIstanbulReporter: {
        thresholds: {
          global: {
            statements: 80,
            branches: 70,
            functions: 70,
            lines: 80,
          },
        },
      },
    }),
github uprtcl / js-uprtcl / packages / micro-orchestrator / karma.conf.js View on Github external
module.exports = config => {
  config.set(
    deepmerge(createDefaultConfig(config), {
      // see the karma-esm docs for all options
      esm: {
        babel: true,
        nodeResolve: true,
        fileExtensions: ['.ts'],
        preserveSymlinks: true
      },

      files: [
        {
          pattern: config.grep ? config.grep : './test/**/*.test.ts',
          type: 'module'
        }
      ],

  // ## code coverage config
github bashmish / carehtml / karma.conf.js View on Github external
module.exports = (config) => {
  config.set(createDefaultConfig(config));
  config.browsers = [];
  config.files = [
    // can be overwritten by passing a --grep flag. examples:
    //
    // npm run test -- --grep test/foo/bar.test.js
    // npm run test -- --grep test/bar/*
    { pattern: config.grep ? config.grep : 'test/**/*.spec.js', type: 'module' },
  ];
  config.frameworks = [...config.frameworks, 'detectBrowsers'];
  config.esm.nodeResolve = true;
  config.detectBrowsers = {
    usePhantomJS: false,
    preferHeadless: true,
  };
  return config;
};
github nik-christou / lit-element-bootstrap / packages / components / form / karma.conf.js View on Github external
module.exports = config => {
  config.set(
    merge(createDefaultConfig(config), {
      files: [
        { pattern: config.grep ? config.grep : 'test/**/*.test.js', type: 'module' }
      ],
      plugins: [
        require.resolve('@open-wc/karma-esm'), // load plugin
        'karma-*', // fallback: resolve any karma- plugins
      ],

      frameworks: ['esm'],

      esm: {
        nodeResolve: true, // if you are using 'bare module imports' you will need this option
        compatibility: 'all', // set compatibility mode to all
      },
    }),
  );
github bennypowers / stripe-elements / karma.conf.js View on Github external
module.exports = config => {
  config.set(
    merge(createDefaultConfig(config), {
      files: [
        { pattern: config.grep ? config.grep : 'src/**/*.test.js', type: 'module' },
      ],
      esm: {
        nodeResolve: true,
        babel: true,
      },
    })
  );

  return config;
};

@open-wc/testing-karma

Testing with karma following open-wc recommendations

MIT
Latest version published 4 years ago

Package Health Score

69 / 100
Full package analysis