Skip to content

Commit

Permalink
Fix the app.argument option (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
naoki-tomita committed Mar 21, 2021
1 parent 14daa34 commit e127ae8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -88,7 +88,7 @@ const open = async (target, options) => {
}));
}

let {name: app, appArguments = []} = options.app || {};
let {name: app, arguments: appArguments = []} = options.app || {};

if (Array.isArray(app)) {
return pTryEach(app, appName => open(target, {
Expand Down
5 changes: 4 additions & 1 deletion test.js
Expand Up @@ -27,7 +27,10 @@ test('open URL in specified app', async t => {
});

test('open URL in specified app with arguments', async t => {
await t.notThrowsAsync(open('https://sindresorhus.com', {app: {name: open.apps.chrome, arguments: ['--incognito']}}));
await t.notThrowsAsync(async () => {
const proc = await open('https://sindresorhus.com', {app: {name: open.apps.chrome, arguments: ['--incognito']}});
t.deepEqual(proc.spawnargs, ['open', '-a', open.apps.chrome, 'https://sindresorhus.com', '--args', '--incognito']);
});
});

test('return the child process when called', async t => {
Expand Down

0 comments on commit e127ae8

Please sign in to comment.