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

Re-enable Windows in CI #500

Merged
merged 11 commits into from
May 18, 2022
Merged

Re-enable Windows in CI #500

merged 11 commits into from
May 18, 2022

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented May 17, 2022

This fixes the tests on Windows CI, and re-enables it. 🎉

@ehmicky ehmicky force-pushed the chore/ci-windows branch 4 times, most recently from ec48728 to d33cf55 Compare May 17, 2022 17:21

process.env.PATH = fileURLToPath(new URL('fixtures', import.meta.url)) + path.delimiter + process.env.PATH;
setFixtureDir();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How the PATH/Path environment variable in the GitHub actions Windows environment seems to have changed, making the CI tests fail. In particular, its name is now Path instead of PATH.
Using path-key fixes this. I put this as a shared helper to avoid code duplication.

});

test('preferLocal: false', async t => {
await t.throwsAsync(execa('ava', ['--version'], {preferLocal: false, env: {Path: '', PATH: ''}}), {message: ENOENT_REGEXP});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not completely sure why, but this fixes those tests on Windows.
Filtering the .bin directories from the PATH variable seems more adequate than making it completely empty as well.

t.deepEqual(stdout.split('\n'), ['foo', 'bar']);
});

test('do not extend environment with `extendEnv: false`', async t => {
const {stdout} = await execa('environment.js', [], {env: {BAR: 'bar', PATH: process.env.PATH}, extendEnv: false});
const {stdout} = await execa('environment.js', [], {env: {BAR: 'bar', [PATH_KEY]: process.env[PATH_KEY]}, extendEnv: false});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the tests on Windows.

@ehmicky ehmicky marked this pull request as ready for review May 17, 2022 17:59
@sindresorhus
Copy link
Owner

Good investigation 👍

@sindresorhus sindresorhus merged commit 071d0a2 into main May 18, 2022
@sindresorhus sindresorhus deleted the chore/ci-windows branch May 18, 2022 05:40
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