Skip to content

The excellent tape-run ported as Webpack plugin

License

Notifications You must be signed in to change notification settings

CryptozombiesHQ/webpack-tape-run

 
 

Repository files navigation

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 :-

  • path-browserify
  • stream-browserify
  • process/browser

Usage

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

new WebpackTapeRun(opts)
  • opts.tapeRun: (object) optional tape-run options.
  • opts.reporter: (string) optional reporter options.
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

About

The excellent tape-run ported as Webpack plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%