Skip to content

Commit

Permalink
Install current Preflight globally before testing
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhorky committed Oct 13, 2024
1 parent 9e7b292 commit f5ef62d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions __tests__/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const fixturesTempDir = '__tests__/fixtures/__temp';

beforeAll(
async () => {
await execa`pnpm add --global .`;
await pMap(
[
{
Expand Down Expand Up @@ -60,7 +61,7 @@ function sortStdoutAndStripVersionNumber(stdout: string) {
test('Passes in the react-passing test project', async () => {
const { stdout, stderr } = await execa({

Check failure on line 62 in __tests__/e2e.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest: Build, lint, test

__tests__/e2e.test.ts > Passes in the react-passing test project

ExecaError: Command failed with ENOENT: preflight spawn preflight ENOENT ❯ getFinalError node_modules/.pnpm/execa@9.4.0/node_modules/execa/lib/return/final-error.js:6:9 ❯ makeError node_modules/.pnpm/execa@9.4.0/node_modules/execa/lib/return/result.js:108:16 ❯ getAsyncResult node_modules/.pnpm/execa@9.4.0/node_modules/execa/lib/methods/main-async.js:167:4 ❯ handlePromise node_modules/.pnpm/execa@9.4.0/node_modules/execa/lib/methods/main-async.js:150:17 ❯ __tests__/e2e.test.ts:62:30 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { shortMessage: 'Command failed with ENOENT: preflight\nspawn preflight ENOENT', originalMessage: 'spawn preflight ENOENT', command: 'preflight', escapedCommand: 'preflight', cwd: '/home/runner/work/preflight/preflight/__tests__/fixtures/__temp/react-passing', durationMs: 6.522373, failed: true, timedOut: false, isCanceled: false, isGracefullyCanceled: false, isTerminated: false, isMaxBuffer: false, isForcefullyTerminated: false, code: 'ENOENT', stdout: '', stderr: '', stdio: [ undefined, '', '' ], ipcOutput: [], pipedFrom: [] } Caused by: Caused by: Error: spawn preflight ENOENT ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { errno: -2, code: 'ENOENT', syscall: 'spawn preflight', path: 'preflight', spawnargs: [] }
cwd: `${fixturesTempDir}/react-passing`,
})`${process.cwd()}/bin/preflight.ts`;
})`preflight`;

expect(sortStdoutAndStripVersionNumber(stdout)).toMatchSnapshot();
expect(stderr.replace(/^\(node:\d+\) /, '')).toMatchSnapshot();
Expand All @@ -69,7 +70,7 @@ test('Passes in the react-passing test project', async () => {
test('Passes in the next-js-passing test project', async () => {
const { stdout, stderr } = await execa({

Check failure on line 71 in __tests__/e2e.test.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest: Build, lint, test

__tests__/e2e.test.ts > Passes in the next-js-passing test project

ExecaError: Command failed with ENOENT: preflight spawn preflight ENOENT ❯ getFinalError node_modules/.pnpm/execa@9.4.0/node_modules/execa/lib/return/final-error.js:6:9 ❯ makeError node_modules/.pnpm/execa@9.4.0/node_modules/execa/lib/return/result.js:108:16 ❯ getAsyncResult node_modules/.pnpm/execa@9.4.0/node_modules/execa/lib/methods/main-async.js:167:4 ❯ handlePromise node_modules/.pnpm/execa@9.4.0/node_modules/execa/lib/methods/main-async.js:150:17 ❯ __tests__/e2e.test.ts:71:30 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { shortMessage: 'Command failed with ENOENT: preflight\nspawn preflight ENOENT', originalMessage: 'spawn preflight ENOENT', command: 'preflight', escapedCommand: 'preflight', cwd: '/home/runner/work/preflight/preflight/__tests__/fixtures/__temp/next-js-passing', durationMs: 4.802663, failed: true, timedOut: false, isCanceled: false, isGracefullyCanceled: false, isTerminated: false, isMaxBuffer: false, isForcefullyTerminated: false, code: 'ENOENT', stdout: '', stderr: '', stdio: [ undefined, '', '' ], ipcOutput: [], pipedFrom: [] } Caused by: Caused by: Error: spawn preflight ENOENT ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { errno: -2, code: 'ENOENT', syscall: 'spawn preflight', path: 'preflight', spawnargs: [] }
cwd: `${fixturesTempDir}/next-js-passing`,
})`${process.cwd()}/bin/preflight.ts`;
})`preflight`;

expect(sortStdoutAndStripVersionNumber(stdout)).toMatchSnapshot();
expect(stderr.replace(/^\(node:\d+\) /, '')).toMatchSnapshot();
Expand Down

0 comments on commit f5ef62d

Please sign in to comment.