Home

Awesome

webpack-tape-run

npm package Build status

Run tape-run as webpack plugin

Runs webpack with the generated output bundle in browser with tape-run (headless or non-headless). This works well with webpack --watch as it will run your test every time a file changed.

Webpack 5.x.x changes

Update to support webpack 5.x.x, some modules require in the webpack config for this to work :-

Usage

var WebpackTapeRun = require('webpack-tape-run')

new WebpackTapeRun(opts)
module.exports = {
  entry: './test',
  mode: 'development',
  output: {
    path: path.resolve(__dirname, './output'),
    filename: 'test.js'
  },
  resolve: {
    modules: ['node_modules'],
    extensions: ['*', '.js'],
    fallback: {
      fs: false,
      buffer: false,
      path: require.resolve('path-browserify'),
      stream: require.resolve('stream-browserify')
    }
  },
  target: 'web',
  plugins: [
    new webpack.ProvidePlugin({
      process: 'process/browser'
    }),
    new WebpackTapeRun({
      tapeRun: {
       browser: 'phantomjs'
      },
      reporter: 'tap-spec'
    })
  ]
}

By default, output is pipe to process.stdout. You can specify a reporter as an option for the output, if you using coverify, you also need transform-loader in the webpack.config.js, check this for a working example