Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
};
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;
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;
module.exports = config => {
config.set(
merge(defaultSettings(config), {
files: [
// allows running single tests with the --grep flag
config.grep ? config.grep : 'test/**/*.test.js',
],
// TODO: not yet within the 90% default
coverageIstanbulReporter: {
thresholds: {
global: {
statements: 80,
branches: 70,
functions: 70,
lines: 80,
},
},
},
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,
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'],
},
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,
},
},
},
}),
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
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;
};
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
},
}),
);