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

Avoid ESLint path resolution errors on Windows #469

Merged
merged 21 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,21 @@ jobs:

- run: pnpm install
- run: pnpm install
if: runner.os != 'Windows'
working-directory: docker

- name: Lint
if: runner.os != 'Windows'
run: pnpm lint

- run: pnpm tsc
if: runner.os != 'Windows'
- run: pnpm tsc --project bin/tsconfig.json
if: runner.os != 'Windows'
- run: pnpm tsc --project docker/tsconfig.json
if: runner.os != 'Windows'
- run: pnpm tsc --project tsconfig.nonsrc.json
if: runner.os != 'Windows'

- name: Build
run: pnpm build
Expand Down
18 changes: 13 additions & 5 deletions __tests__/e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { tmpdir } from 'node:os';
import { beforeAll, expect, test } from '@jest/globals';
import { execaCommand } from 'execa';
import pMap from 'p-map';

const fixturesTempDir = '__tests__/fixtures/__temp';
const fixturesTempDir = process.env.GITHUB_ACTIONS
? // Switch to `tmpdir()` on GitHub Actions to avoid
// ESLint crashing with Windows paths over the 260
// character MAX_PATH limit
// https://github.com/upleveled/preflight/pull/469/#issuecomment-1812422819
// https://github.com/eslint/eslint/issues/17763
tmpdir()
: '__tests__/fixtures/__temp';

function cloneRepoToFixtures(repoPath: string, fixtureDirName: string) {
return execaCommand(
Expand Down Expand Up @@ -79,8 +87,8 @@ beforeAll(
{ concurrency: 1 },
);
},
// 5 minute timeout for pnpm installation inside test repos
300000,
// 7.5 minute timeout for pnpm installation inside test repos
450000,
Comment on lines -82 to +91
Copy link
Member Author

Choose a reason for hiding this comment

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

we have to increase the timeout because it takes longer for pnpm to install on Windows in tmpdir() apparently

);

function sortStdoutAndStripVersionNumber(stdout: string) {
Expand All @@ -97,7 +105,7 @@ function sortStdoutAndStripVersionNumber(stdout: string) {

test('Passes in the react-passing test project', async () => {
const { stdout, stderr } = await execaCommand(
`../../../../bin/preflight.js`,
`${process.cwd()}/bin/preflight.js`,
{
cwd: `${fixturesTempDir}/react-passing`,
},
Expand All @@ -109,7 +117,7 @@ test('Passes in the react-passing test project', async () => {

test('Passes in the next-js-passing test project', async () => {
const { stdout, stderr } = await execaCommand(
`../../../../bin/preflight.js`,
`${process.cwd()}/bin/preflight.js`,
{
cwd: `${fixturesTempDir}/next-js-passing`,
},
Expand Down