Skip to content

Commit

Permalink
replace deprecated optimist with yargs (#85)
Browse files Browse the repository at this point in the history
* replace deprecated optimist with yargs

* add github actions

* remove node 12

* add package-lock.json
  • Loading branch information
juliangruber authored May 4, 2022
1 parent ee4654e commit fb87809
Show file tree
Hide file tree
Showing 5 changed files with 7,253 additions and 46 deletions.
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: sudo apt-get install xvfb
- run: xvfb-run --auto-servernum npm test
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

93 changes: 50 additions & 43 deletions bin/run.js
Original file line number Diff line number Diff line change
@@ -1,53 +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('sandbox', 'Enable electron sandbox')
.boolean('sandbox')
.default('sandbox', true)

.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);

Expand Down
Loading

0 comments on commit fb87809

Please sign in to comment.