Skip to content

Avoid using shell commands for browser detectionΒ #237

@PayBas

Description

@PayBas
const MACOS_GET_BROWSER_LIST_COMMAND = 'ls "/Applications/" | grep -E "Chrome|Firefox|Opera|Safari|Chromium|Edge" | sed -E "s/ /032/"';

in https://github.com/DevExpress/testcafe-browser-tools/blob/master/src/api/get-installations.js#L14 has claimed another victim.

I've just spent an entire evening trying to figure out why TestCafe was throwing errors like:

    "  code: 'E1005',\n" +
    "  data: [ 'chrome:headless' ]\n" +

Eventually found the testcafe --list-browsers command, which returns no output!
And then the arduous undertaking of trying to figure out what the hell was going on.

Turns out it's the aliases and functions in from https://ohmybash.nntoan.com/ that are making MACOS_GET_BROWSER_LIST_COMMAND unreliable for me.

So basically DevExpress/testcafe#3821 again.

It has been opted that this functionality should be reworked in #168 , but it was never actually implemented.

I strongly feel that relying on ls, grep and sed for this on macOS is a bad idea. The whole Bash/Zsh GNU/BSD mess is still very much alive.

It's just way to easy to break stuff. And the end-user has absolutely no idea that the problem could be caused by shell profile settings like aliases. Why would he/she? No other nodejs app/tool works like that. The issue is totally counter-intuitive.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions