Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tape-testing/tape-run
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 500ce421358fde2c5e149e3402d2fdd83d044f00
Choose a base ref
...
head repository: tape-testing/tape-run
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dfc05e76fb816dafaa9d3850b5547ab4fc73f283
Choose a head ref

Commits on Mar 8, 2017

  1. Copy the full SHA
    ad1077b View commit details
  2. 3.0.0

    juliangruber committed Mar 8, 2017
    Copy the full SHA
    cad964a View commit details

Commits on Apr 12, 2017

  1. git ignore yarn.lock

    juliangruber committed Apr 12, 2017
    Copy the full SHA
    2b122ce View commit details

Commits on Aug 18, 2017

  1. docs: add webpack

    juliangruber authored Aug 18, 2017
    Copy the full SHA
    e6ea66c View commit details

Commits on Dec 4, 2017

  1. Copy the full SHA
    2eb9015 View commit details
  2. 3.0.1

    juliangruber committed Dec 4, 2017
    Copy the full SHA
    ed44bcd View commit details
  3. travis: drop 0.12

    juliangruber committed Dec 4, 2017
    Copy the full SHA
    3bdfd54 View commit details

Commits on Dec 5, 2017

  1. Add detail to webpack integration

    The description needs more detail to really explain anything. This file change clarifies steps needed for webpack integration, yet with minimal bloat to keep README.md nice to browse and read.
    
    Motivation: I believe there are people like me who use webpack instead of browserify and immediately want to integrate tape-run with webpack. With next to none details about the integration, it took me a long while to figure out everything needed. The first thing was that an additional `webpack.config.js` is needed to build the test suite. The second thing was that I can just `$ webpack --config ...` to run the tests, instead of something like `webpack | tape-run | tap-spec`. The third thing was that I do not need to add anything extra to the test code. These seem trivial afterwards but were hard to find out when everything was new.
    axelpale authored Dec 5, 2017
    Copy the full SHA
    4cb98b0 View commit details
  2. Merge pull request #70 from axelpale/patch-1

    Add detail to webpack integration
    juliangruber authored Dec 5, 2017
    Copy the full SHA
    8b01d6d View commit details

Commits on Jan 23, 2018

  1. Copy the full SHA
    4fdada2 View commit details
  2. 3.0.2

    juliangruber committed Jan 23, 2018
    Copy the full SHA
    193428b View commit details

Commits on Feb 9, 2018

  1. support

    juliangruber committed Feb 9, 2018
    Copy the full SHA
    257098f View commit details
  2. 3.0.3

    juliangruber committed Feb 9, 2018
    Copy the full SHA
    5defaec View commit details

Commits on Feb 10, 2018

  1. sponsors

    juliangruber committed Feb 10, 2018
    Copy the full SHA
    f7c7a68 View commit details
  2. 3.0.4

    juliangruber committed Feb 10, 2018
    Copy the full SHA
    f696cba View commit details

Commits on Mar 27, 2018

  1. remove package-lock

    juliangruber committed Mar 27, 2018
    Copy the full SHA
    16b5fe6 View commit details
  2. 4.0.0

    juliangruber committed Mar 27, 2018
    Copy the full SHA
    2186d4d View commit details

Commits on Dec 13, 2018

  1. update browser-run@5.0.1

    cezaraugusto committed Dec 13, 2018
    Copy the full SHA
    bcb8fad View commit details

Commits on Dec 14, 2018

  1. Merge pull request #73 from cezaraugusto/update-browser-run

    update browser-run@5.0.1
    juliangruber authored Dec 14, 2018
    Copy the full SHA
    9fa041c View commit details
  2. 5.0.0

    juliangruber committed Dec 14, 2018
    Copy the full SHA
    9fc2b4b View commit details

Commits on May 2, 2019

  1. Copy the full SHA
    544a86e View commit details
  2. 6.0.0

    juliangruber committed May 2, 2019
    Copy the full SHA
    0056a90 View commit details
  3. Copy the full SHA
    eb284e0 View commit details

Commits on Aug 20, 2019

  1. Add rollup documentation

    thanks @munrocket
    munrocket authored and juliangruber committed Aug 20, 2019
    Copy the full SHA
    e8c2b76 View commit details
  2. 6.0.1

    juliangruber committed Aug 20, 2019
    Copy the full SHA
    01b5790 View commit details

Commits on Apr 6, 2020

  1. Copy the full SHA
    e032edb View commit details
  2. 7.0.0

    juliangruber committed Apr 6, 2020
    Copy the full SHA
    463bed9 View commit details
  3. Copy the full SHA
    e93c616 View commit details

Commits on Jul 22, 2020

  1. Bump browser-run to latest, fixing electron security issue (#80)

    * Bump browser-run version to v8.0.0
    ... and removing sudo: false in travis-config + changing nodejs-version to test on from 12 and 13 to 12 and 14
    
    * Version bump
    
    * Changing to correct version number
    
    * Back to original version =)
    eklem authored Jul 22, 2020
    Copy the full SHA
    20125a6 View commit details
  2. 8.0.0

    juliangruber committed Jul 22, 2020
    Copy the full SHA
    31de6f9 View commit details

Commits on Nov 3, 2020

  1. Include more detailed Headless Testing section (#81)

    I tried to get a build working yesterday via Github Actions and kept hitting a wall. Found these suggestions on `browser-run` and copied here to make it easier to find.
    manzt authored Nov 3, 2020
    Copy the full SHA
    ccad1ea View commit details

Commits on Apr 12, 2021

  1. Copy the full SHA
    57adc5f View commit details
  2. 9.0.0

    juliangruber committed Apr 12, 2021
    Copy the full SHA
    ee4654e View commit details

Commits on May 4, 2022

  1. replace deprecated optimist with yargs (#85)

    * replace deprecated optimist with yargs
    
    * add github actions
    
    * remove node 12
    
    * add package-lock.json
    juliangruber authored May 4, 2022
    Copy the full SHA
    fb87809 View commit details
  2. docs

    juliangruber committed May 4, 2022
    Copy the full SHA
    e5579fb View commit details
  3. 10.0.0

    juliangruber committed May 4, 2022
    Copy the full SHA
    8d0e790 View commit details

Commits on Jan 13, 2023

  1. docs: security

    juliangruber committed Jan 13, 2023
    Copy the full SHA
    41c594a View commit details

Commits on Jun 23, 2023

  1. upgrade through

    juliangruber committed Jun 23, 2023
    Copy the full SHA
    01f5097 View commit details

Commits on Sep 9, 2023

  1. fix ci (#88)

    * fix ci
    
    * attempt
    
    * update `browser-run`
    
    * Revert "attempt"
    
    This reverts commit 3aff22c.
    
    * ugprade `browser-run`
    juliangruber authored Sep 9, 2023
    Copy the full SHA
    2730fcb View commit details
  2. pkg: add engines.node

    juliangruber committed Sep 9, 2023
    Copy the full SHA
    26d520a View commit details
  3. 11.0.0

    juliangruber committed Sep 9, 2023
    Copy the full SHA
    dfc05e7 View commit details
Showing with 7,364 additions and 68 deletions.
  1. +18 −0 .github/workflows/ci.yml
  2. +1 −0 .gitignore
  3. +2 −6 .travis.yml
  4. +86 −17 README.md
  5. +50 −39 bin/run.js
  6. +7,198 −0 package-lock.json
  7. +9 −6 package.json
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI
on:
- push
- pull_request
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['14', '16', '18']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- run: npm ci
- run: xvfb-run npm test
timeout-minutes: 5
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
yarn.lock
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
sudo: false
language: node_js
node_js:
- "0.12"
- 4
- 5
- 6
- node
- 12
- 14
addons:
apt:
packages:
103 changes: 86 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ A [tape](https://github.com/substack/tape) test runner that runs your tests in
a (headless) browser and returns 0/1 as exit code, so you can use it as your
`npm test` script.

[![build status](https://secure.travis-ci.org/juliangruber/tape-run.svg)](http://travis-ci.org/juliangruber/tape-run)
[![CI](https://github.com/juliangruber/tape-run/actions/workflows/ci.yml/badge.svg)](https://github.com/juliangruber/tape-run/actions/workflows/ci.yml)
[![downloads](https://img.shields.io/npm/dm/tape-run.svg)](https://www.npmjs.org/package/tape-run)

## Usage
@@ -42,6 +42,35 @@ $ echo $?
0
```

## rollup

In simple cases you can run `rollup` and `tape-run` right from command line:
```bash
$ rollup test/test.js -f iife | tape-run
```
If you want to use a configuration file, here's an example for `rollup -c | tape-run`:
```js
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import builtins from 'rollup-plugin-node-builtins';
import istanbul from 'rollup-plugin-istanbul';

export default {
input: 'test/test.js',
output: { format: 'iife', sourcemap: 'inline' },
plugins: [
resolve(),
commonjs(),
builtins(),
istanbul({ exclude: ['dist'] })
]
}
```

## With webpack

To use with [webpack](https://webpack.github.io/), set up a `webpack.test.config.js` to bundle your tape tests. Then, include [webpack-tape-run](https://github.com/syarul/webpack-tape-run) plugin in it. As a result, `$ webpack --config webpack.test.config.js` builds your tests with webpack, runs them in a headless browser, and outputs tap into console with correct exit code. Neat!

## API

You can use tape-run from JavaScript too:
@@ -93,9 +122,10 @@ on `http://localhost:<port>` and tests will be run there.
* `ie`
* `phantom`
* `safari`
* `keepOpen` (Boolean): Leave the browser open for debugging after running tests.
* `node` (Boolean): Enable nodejs integration for electron.
* `basedir` (String): Set this if you need to require node modules in `node` mode
* `keepOpen (Boolean)`: Leave the browser open for debugging after running tests.
* `node (Boolean)` Enable nodejs integration for electron.
* `sandbox (Boolean) [Default: true]`: Enable electron sandbox.
* `basedir` (String): Set this if you need to require node modules in `node` mode.
The **CLI** takes the same arguments, plus `--render` (see blow):
@@ -105,15 +135,16 @@ Pipe a browserify stream into this.
browserify [opts] [files] | tape-run [opts]
Options:
--wait Timeout for tap-finished
--port Wait to be opened by a browser on that port
--static Serve static files from this directory
--wait Timeout for tap-finished
--port Wait to be opened by a browser on that port
--static Serve static files from this directory
--browser Browser to use. Always available: electron. Available if installed: chrome, firefox, ie, phantom, safari [default: "electron"]
--render Command to pipe tap output to for custom rendering
--keep-open Leave the browser open for debugging after running tests
--node Enable nodejs integration for electron
--basedir Set this if you need to require node modules in node mode
--help Print usage instructions
--render Command to pipe tap output to for custom rendering
--keep-open Leave the browser open for debugging after running tests
--node Enable nodejs integration for electron
--sandbox Enable electron sandbox [default: true]
--basedir Set this if you need to require node modules in node mode
--help Print usage instructions
```
...or any of the [other options you can pass to browser-run](https://github.com/juliangruber/browser-run#runopts).
@@ -131,9 +162,33 @@ $ browserify test.js | tape-run --render="tap-spec"
```
## Headless testing / Travis
## Headless testing
In environments without a screen, you can use `Xvfb` to simulate one. We recommend using the default electron browser,
which however requires you to add additional parts to your headless configurations.
To use tape-run with travis, we recommend using the default electron browser, which however requires you to add this part to your travis.yml:
### GitHub Actions
This is a full example to run `npm test`. Refer to the last 2 lines in the YAML config:
```yml
on:
- pull_request
- push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: npm install
- run: sudo apt-get install xvfb
- run: xvfb-run --auto-servernum npm test
```
### Travis
Add this to your travis.yml:
```yml
addons:
@@ -146,9 +201,9 @@ install:
- npm install
```
[Source](https://github.com/rhysd/Shiba/blob/055a11a0a2b4f727577fe61371a88d8db9277de5/.travis.yml).
[Full example](https://github.com/rhysd/Shiba/blob/055a11a0a2b4f727577fe61371a88d8db9277de5/.travis.yml).
For gnu/linux installations without a graphical environment:
### Any gnu/linux box
```bash
$ sudo apt-get install xvfb # or equivalent
@@ -157,7 +212,9 @@ $ Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
$ browser-run ...
```
There is also an example docker machine [here](https://github.com/fraserxu/docker-tape-run).
### Docker
There is also an example [Docker image](https://hub.docker.com/r/kipparker/docker-tape-run). [Source](https://github.com/fraserxu/docker-tape-run)
## Installation
@@ -168,6 +225,18 @@ $ npm install tape-run -g # for cli
$ npm install tape-run # for api
```
## Sponsors
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
## Security contact information
To report a security vulnerability, please use the
[Tidelift security contact](https://tidelift.com/security).
Tidelift will coordinate the fix and disclosure.
## License
(MIT)
89 changes: 50 additions & 39 deletions bin/run.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,60 @@
#!/usr/bin/env node

var run = require('..');
var optimist = require('optimist');
var yargs = require('yargs/yargs');
var { hideBin } = require('yargs/helpers');
var spawn = require('child_process').spawn;

var argv = optimist
var argv = yargs(hideBin(process.argv))
.usage('Pipe a browserify stream into this.\nbrowserify [opts] [files] | $0 [opts]')

.describe('wait', 'Timeout for tap-finished')
.alias('w', 'wait')

.describe('port', 'Wait to be opened by a browser on that port')
.alias('p', 'port')

.describe('static', 'Serve static files from this directory')
.alias('s', 'static')

.describe('browser', 'Browser to use. ' +
'Always available: electron. ' +
'Available if installed: chrome, firefox, ie, phantom, safari')
.alias('b', 'browser')
.default('browser', 'electron')

.describe('render', 'Command to pipe tap output to for custom rendering')
.alias('r', 'render')

.describe('keep-open', 'Leave the browser open for debugging after running tests')
.alias('k', 'keep-open')
.alias('keepOpen', 'keep-open')

.describe('node', 'Enable nodejs integration for electron')
.alias('n', 'integration')
.alias('node-integration', 'node')
.alias('nodeIntegration', 'node')

.describe('basedir', 'Set this if you need to require node modules in node mode')

.describe('help', 'Print usage instructions')
.alias('h', 'help')

.argv;

if (argv.help) {
return optimist.showHelp();
}
.option('wait', {
alias: 'w',
type: 'number',
description: 'Timeout for tap-finished'
})
.option('port', {
alias: 'p',
type: 'number',
description: 'Wait to be opened by a browser on that port'
})
.option('static', {
alias: 's',
type: 'string',
description: 'Serve static files from this directory'
})
.option('browser', {
alias: 'b',
type: 'string',
default: 'electron',
description: 'Browser to use. ' +
'Always available: electron. ' +
'Available if installed: chrome, firefox, ie, phantom, safari'
})
.option('render', {
alias: 'r',
type: 'string',
description: 'Command to pipe tap output to for custom rendering'
})
.option('keep-open', {
alias: ['k', 'keepOpen'],
type: 'boolean',
description: 'Leave the browser open for debugging after running tests'
})
.option('node', {
alias: ['n', 'node-integration', 'nodeIntegration'],
type: 'boolean',
description: 'Enable nodejs integration for electron'
})
.option('sandbox', {
type: 'boolean',
default: true,
description: 'Enable electron sandbox'
})
.option('basedir', {
description: 'Set this if you need to require node modules in node mode'
})
.parse();

var runner = run(argv);

7,198 changes: 7,198 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tape-run",
"description": "Headless tape test runner",
"version": "2.4.1",
"version": "11.0.0",
"repository": {
"type": "git",
"url": "git://github.com/juliangruber/tape-run.git"
@@ -16,10 +16,10 @@
},
"dependencies": {
"@juliangruber/tap-finished": "0.0.2",
"browser-run": "^3.6.0",
"optimist": "~0.6.1",
"through": "~2.3.4",
"throughout": "0.0.0"
"browser-run": "^12.0.0",
"through": "^2.3.8",
"throughout": "0.0.0",
"yargs": "^17.4.1"
},
"devDependencies": {
"browserify": "^14.0.0",
@@ -39,5 +39,8 @@
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
"license": "MIT"
"license": "MIT",
"engines": {
"node": ">=14"
}
}