webpack-tape-run

    1.0.3 • Public • Published

    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

    Install

    npm i webpack-tape-run

    DownloadsWeekly Downloads

    2

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    7.83 kB

    Total Files

    7

    Last publish

    Collaborators

    • syarul