From a1c1b1261072d00f8b083f914060de2d7f17c6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naoki=20Tomita=F0=9F=90=B1?= Date: Mon, 22 Mar 2021 00:02:41 +0900 Subject: [PATCH] Bugfix for specifying arguments. --- index.js | 2 +- test.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 72f5717..3e43373 100644 --- a/index.js +++ b/index.js @@ -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, { diff --git a/test.js b/test.js index 271043f..447e5df 100644 --- a/test.js +++ b/test.js @@ -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 => {