2.3.0 • Published 6 months ago

karma-esbuild v2.3.0

Weekly downloads
431
License
MIT
Repository
github
Last release
6 months ago

karma-esbuild

An esbuild preprocessor for the karma test runner. The main benefits of esbuild is speed and readability of the compiled output.

Installation

npm install --save-dev karma-esbuild

Usage

Add esbuild as your preprocessor inside your karma.conf.js:

module.exports = function (config) {
	config.set({
		preprocessors: {
			// Add esbuild to your preprocessors
			"test/**/*.test.js": ["esbuild"],
		},
	});
};

Advanced: Custom configuration

A custom esbuild configuration can be passed via an additional property on karma's config. Check out the documentation for esbuild for available options.

module.exports = function (config) {
	config.set({
		preprocessors: {
			// Add esbuild to your preprocessors
			"test/**/*.test.js": ["esbuild"],
		},

		esbuild: {
			// Replace some global variables
			define: {
				COVERAGE: coverage,
				"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || ""),
				ENABLE_PERFORMANCE: true,
			},
			plugins: [createEsbuildPlugin()],

			// Karma-esbuild specific options
			singleBundle: true, // Merge all test files into one bundle(default: true)
		},
	});
};

License

MIT, see the LICENSE file.

2.3.0

6 months ago

2.2.5

2 years ago

2.2.3

2 years ago

2.2.4

2 years ago

2.2.2

2 years ago

2.2.1

2 years ago

2.2.0

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago