Skip to content

iredelmeier/jasmine-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jasmine Webpack Plugin

A simple webpack plugin that creates a specRunner.html file for running Jasmine specs in the browser, e.g., for use with webpack-dev-server and hot module replacement for fast development.

Usage

In your webpack configuration:

// webpack-test.config.js

var JasmineWebpackPlugin = require('jasmine-webpack-plugin');

module.exports = {
  entry: ['specRoot.js'],
  // ... more configuration
  plugins: [new JasmineWebpackPlugin()]
};

Options

filename - output filename; defaults to _specRunner.html

htmlOptions - an object of options to pass to HtmlWebpackPlugin; defaults to {}

Notes

Webpack doesn't support wildcards in config.entry. As a workaround to easily build and watch your spec files, you can provide something like this in your entry file:

// specRoot.js

const requireAll = (requireContext) => { requireContext.keys().map(requireContext); };

requireAll(require.context('spec/helpers/', true, /\.js$/));
requireAll(require.context('spec/', true, /[sS]pec\.js$/));

See require.context

About

Run jasmine specs using webpack or webpack-dev-server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published