Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/syarul/webpack-tape-run
The excellent tape-run ported as Webpack plugin
https://github.com/syarul/webpack-tape-run
Last synced: 3 days ago
JSON representation
The excellent tape-run ported as Webpack plugin
- Host: GitHub
- URL: https://github.com/syarul/webpack-tape-run
- Owner: syarul
- License: mit
- Created: 2017-08-18T09:30:55.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T08:44:31.000Z (over 1 year ago)
- Last Synced: 2024-09-19T13:49:54.121Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 354 KB
- Stars: 12
- Watchers: 3
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webpack-tape-run
[![npm package](https://img.shields.io/badge/npm-1.0.3-blue.svg)](https://www.npmjs.com/package/webpack-tape-run)
[![Build status](https://ci.appveyor.com/api/projects/status/5hk4mr4d50fd6ntm/branch/master?svg=true)](https://ci.appveyor.com/project/syarul/webpack-tape-run/branch/master)Run [tape-run](https://github.com/juliangruber/tape-run) as [webpack](https://webpack.github.io/) 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
```javascript
var WebpackTapeRun = require('webpack-tape-run')new WebpackTapeRun(opts)
```
- **opts.tapeRun**: *(object)* ***optional*** tape-run options.
- **opts.reporter**: *(string)* ***optional*** reporter options.```javascript
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](https://github.com/sindresorhus/awesome-tap#reporters) as an option for the output,
if you using [coverify](https://github.com/substack/coverify), you also need [transform-loader](https://github.com/webpack-contrib/transform-loader) in
the ```webpack.config.js```, check [this](https://github.com/syarul/webpack-tape-run/blob/master/webpack.test.js) for a working example