Skip to content

tests\functional\test.cli.run.js fails with EINVAL on Windows #3435

@Rob--W

Description

@Rob--W

STR:

Set up a Windows developer environment in a VM if needed: Install git, Node.js, clone the repo and install the project dependencies.

Install nvm-windows and git. Open Powershell. I also had to call Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser because otherwise npm ci below would fail and point to https://go.microsoft.com/fwlink/?LinkID=135170 (for a VM Unrestricted is okay; if this is not a throw-away system, consider -Scope Process instead).

nvm install 22
nvm use 22

git clone https://github.com/mozilla/web-ext

cd web-ext
npm ci

npm run build

.\node_modules\.bin\mocha .\tests\functional\test.cli.run.js

The test fails with EINVAL being reported by spawn. This is because the test uses a .bat file to launch Node.js:

export const fakeFirefoxPath = path.join(
functionalTestsDir,
process.platform === 'win32'
? 'fake-firefox-binary.bat'
: 'fake-firefox-binary.js',
);

... and Node.js stopped supporting that in spawn unless shell: true is passed:

We should replace this mechanism of loading the script with something else.

This is currently not failing in our CI, because we use Node.js versions that predate the breaking change in Node.js: we use 18.19.0 and 20.11.0, according to

- &nodejs_current "18.19.0"
- &nodejs_next "20.11.0"
- &nodejs_experimental "21.5"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions