Skip to content

Commit

Permalink
Avoid ESLint path resolution errors on Windows (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhorky committed Nov 15, 2023
1 parent c6d78bd commit 8012268
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
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,
);

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

0 comments on commit 8012268

Please sign in to comment.