Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace deprecated optimist with yargs #85

Merged
merged 4 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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