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

fix: update openApp(app) to not error when app is an array #335

Merged
merged 1 commit into from
Feb 26, 2024
Merged

fix: update openApp(app) to not error when app is an array #335

merged 1 commit into from
Feb 26, 2024

Conversation

raymondji
Copy link
Contributor

@raymondji raymondji commented Feb 26, 2024

openApp(apps.chrome) is one of the examples in the documentation:

// Open an app with arguments.
await openApp(apps.chrome, {arguments: ['--incognito']});

However this fails on WSL because openApp asserts that the app arguement is a string, but apps.chrome is an array of strings.

This PR fixes the issue by allowing arrays as well in the type check.

Repro steps:

Expected result:

  • Opens chrome

Got result:

  • Error: "TypeError: Expected a name"

Testing done:

  • Do the same repro steps, but run node index.js --withFix instead
  • Verified this opens chrome as expected

@raymondji raymondji changed the title fix: openApp(apps.chrome) fails on WSL with "TypeError: Expected a name" fix: update openApp(app, ...) to accept an array of strings Feb 26, 2024
@raymondji raymondji changed the title fix: update openApp(app, ...) to accept an array of strings fix: update openApp(app, ...) to not error when app is an array of strings Feb 26, 2024
@raymondji raymondji changed the title fix: update openApp(app, ...) to not error when app is an array of strings fix: update openApp(app, ...) to not error when app is an array Feb 26, 2024
@raymondji raymondji changed the title fix: update openApp(app, ...) to not error when app is an array fix: update openApp(app) to not error when app is an array Feb 26, 2024
@sindresorhus sindresorhus merged commit d9e7422 into sindresorhus:main Feb 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants