Skip to content

Commit 8fd1265

Browse files
committed
removed test helper
1 parent 6d4d2be commit 8fd1265

File tree

2 files changed

+19
-40
lines changed

2 files changed

+19
-40
lines changed

packages/fuels/test/features/dev.test.ts

+19-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { mockCheckForUpdates } from '../utils/mockCheckForUpdates';
1212
import { mockLogger } from '../utils/mockLogger';
1313
import { resetDiskAndMocks } from '../utils/resetDiskAndMocks';
1414
import { runInit, runDev, bootstrapProject, resetConfigAndMocks } from '../utils/runCommands';
15-
import { runInitTemp } from '../utils/testHelpers';
1615

1716
vi.mock('chokidar', async () => {
1817
const mod = await vi.importActual('chokidar');
@@ -85,24 +84,38 @@ describe('dev', () => {
8584
});
8685

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

93-
const devProcess = spawn('pnpm fuels dev', {
94-
cwd: temp.rootDir,
91+
await runInit({
92+
root: paths.root,
93+
output: paths.outputDir,
94+
workspace: paths.workspaceDir,
95+
fuelCorePort: '0',
96+
});
97+
98+
const devProcess = spawn(`pnpm fuels dev --path ${paths.root}`, {
9599
detached: true,
96100
shell: 'bash',
97101
});
98102

103+
const data: string[] = [];
104+
105+
devProcess.stdout?.on('data', (chunk) => {
106+
data.push(chunk.toString());
107+
});
108+
99109
await new Promise((resolve) => {
100110
devProcess.on('exit', (code) => {
101111
expect(code).not.toEqual(0);
102112
resolve(undefined);
103113
});
104114
});
115+
116+
expect(data.join('')).toContain('forc exited with error code 1');
105117
});
118+
106119
test('`dev` command can work with ephemeral port 0', { timeout: 25000 }, async () => {
107120
await runInit({
108121
root: paths.root,

packages/fuels/test/utils/testHelpers.ts

-34
This file was deleted.

0 commit comments

Comments
 (0)