Skip to content

Commit

Permalink
removed test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
nedsalk committed Jan 30, 2025
1 parent 6d4d2be commit 8fd1265
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 40 deletions.
25 changes: 19 additions & 6 deletions packages/fuels/test/features/dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { mockCheckForUpdates } from '../utils/mockCheckForUpdates';
import { mockLogger } from '../utils/mockLogger';
import { resetDiskAndMocks } from '../utils/resetDiskAndMocks';
import { runInit, runDev, bootstrapProject, resetConfigAndMocks } from '../utils/runCommands';
import { runInitTemp } from '../utils/testHelpers';

vi.mock('chokidar', async () => {
const mod = await vi.importActual('chokidar');
Expand Down Expand Up @@ -85,24 +84,38 @@ describe('dev', () => {
});

it('exits when build fails', { timeout: 30_000 }, async () => {
using temp = runInitTemp();
const mainSw = readFileSync(`${temp.contractDir}/src/main.sw`).toString();
const mainSw = readFileSync(`${paths.contractsBarDir}/src/main.sw`).toString();
const invalidSwayCode = `${mainSw}\nabi `;
writeFileSync(`${temp.contractDir}/src/main.sw`, invalidSwayCode);
writeFileSync(`${paths.contractsBarDir}/src/main.sw`, invalidSwayCode);

const devProcess = spawn('pnpm fuels dev', {
cwd: temp.rootDir,
await runInit({
root: paths.root,
output: paths.outputDir,
workspace: paths.workspaceDir,
fuelCorePort: '0',
});

const devProcess = spawn(`pnpm fuels dev --path ${paths.root}`, {
detached: true,
shell: 'bash',
});

const data: string[] = [];

devProcess.stdout?.on('data', (chunk) => {
data.push(chunk.toString());
});

await new Promise((resolve) => {
devProcess.on('exit', (code) => {
expect(code).not.toEqual(0);
resolve(undefined);
});
});

expect(data.join('')).toContain('forc exited with error code 1');

Check failure on line 116 in packages/fuels/test/features/dev.test.ts

View workflow job for this annotation

GitHub Actions / node@18

packages/fuels/test/features/dev.test.ts > dev > exits when build fails

AssertionError: expected 'undefined\n ERR_PNPM_RECURSIVE_EXEC_F…' to contain 'forc exited with error code 1' - Expected + Received - forc exited with error code 1 + undefined +  ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command "fuels" not found + + Did you mean "pnpm build"? + ❯ packages/fuels/test/features/dev.test.ts:116:27

Check failure on line 116 in packages/fuels/test/features/dev.test.ts

View workflow job for this annotation

GitHub Actions / node@20

packages/fuels/test/features/dev.test.ts > dev > exits when build fails

AssertionError: expected 'undefined\n ERR_PNPM_RECURSIVE_EXEC_F…' to contain 'forc exited with error code 1' - Expected + Received - forc exited with error code 1 + undefined +  ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command "fuels" not found + + Did you mean "pnpm build"? + ❯ packages/fuels/test/features/dev.test.ts:116:27

Check failure on line 116 in packages/fuels/test/features/dev.test.ts

View workflow job for this annotation

GitHub Actions / node@22

packages/fuels/test/features/dev.test.ts > dev > exits when build fails

AssertionError: expected 'undefined\n ERR_PNPM_RECURSIVE_EXEC_F…' to contain 'forc exited with error code 1' - Expected + Received - forc exited with error code 1 + undefined +  ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command "fuels" not found + + Did you mean "pnpm build"? + ❯ packages/fuels/test/features/dev.test.ts:116:27
});

test('`dev` command can work with ephemeral port 0', { timeout: 25000 }, async () => {
await runInit({
root: paths.root,
Expand Down
34 changes: 0 additions & 34 deletions packages/fuels/test/utils/testHelpers.ts

This file was deleted.

0 comments on commit 8fd1265

Please sign in to comment.