From e805f88a95e6cb4ac864104c85e4601327503485 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 09:02:05 +0100 Subject: [PATCH 01/22] feat: enable passing of `--fuel-core-port` on `fuels init` --- packages/fuels/src/cli.ts | 4 ++ .../src/cli/commands/dev/autoStartFuelCore.ts | 6 +-- packages/fuels/src/cli/commands/init/index.ts | 3 +- .../fuels/src/cli/templates/fuels.config.hbs | 3 ++ .../fuels/src/cli/templates/fuels.config.ts | 1 + packages/fuels/test/features/dev.test.ts | 41 +++++++++++++++++++ packages/fuels/test/features/init.test.ts | 12 ++++++ packages/fuels/test/utils/runCommands.ts | 3 ++ 8 files changed, 68 insertions(+), 5 deletions(-) diff --git a/packages/fuels/src/cli.ts b/packages/fuels/src/cli.ts index 0299c304750..9a716cbfb7d 100644 --- a/packages/fuels/src/cli.ts +++ b/packages/fuels/src/cli.ts @@ -65,6 +65,10 @@ export const configureCli = () => { .option('--forc-path ', 'Path to the `forc` binary') .option('--fuel-core-path ', 'Path to the `fuel-core` binary') .option('--auto-start-fuel-core', 'Auto-starts a `fuel-core` node during `dev` command') + .option( + '--fuel-core-port ', + 'Port to use when starting a local `fuel-core` node for dev mode' + ) .action(withProgram(command, Commands.init, init)); (command = program.command(Commands.dev)) diff --git a/packages/fuels/src/cli/commands/dev/autoStartFuelCore.ts b/packages/fuels/src/cli/commands/dev/autoStartFuelCore.ts index 3853682c678..283341e90f8 100644 --- a/packages/fuels/src/cli/commands/dev/autoStartFuelCore.ts +++ b/packages/fuels/src/cli/commands/dev/autoStartFuelCore.ts @@ -25,9 +25,7 @@ export const autoStartFuelCore = async (config: FuelsConfig) => { const port = config.fuelCorePort ?? (await getPortPromise({ port: 4000 })); - const providerUrl = `http://${accessIp}:${port}/v1/graphql`; - - const { cleanup, snapshotDir } = await launchNode({ + const { cleanup, url, snapshotDir } = await launchNode({ args: [ ['--snapshot', config.snapshotDir], ['--db-type', 'in-memory'], @@ -44,7 +42,7 @@ export const autoStartFuelCore = async (config: FuelsConfig) => { bindIp, accessIp, port, - providerUrl, + providerUrl: url, snapshotDir, killChildProcess: cleanup, }; diff --git a/packages/fuels/src/cli/commands/init/index.ts b/packages/fuels/src/cli/commands/init/index.ts index 0f537c5431a..cf15d11af49 100644 --- a/packages/fuels/src/cli/commands/init/index.ts +++ b/packages/fuels/src/cli/commands/init/index.ts @@ -10,7 +10,7 @@ import { log } from '../../utils/logger'; export function init(program: Command) { const options = program.opts(); - const { path, autoStartFuelCore, forcPath, fuelCorePath } = options; + const { path, autoStartFuelCore, forcPath, fuelCorePath, fuelCorePort } = options; let workspace: string | undefined; let absoluteWorkspace: string | undefined; @@ -61,6 +61,7 @@ export function init(program: Command) { forcPath, fuelCorePath, autoStartFuelCore, + fuelCorePort, }); writeFileSync(fuelsConfigPath, renderedConfig); diff --git a/packages/fuels/src/cli/templates/fuels.config.hbs b/packages/fuels/src/cli/templates/fuels.config.hbs index dc351121c38..33ceaa33b18 100644 --- a/packages/fuels/src/cli/templates/fuels.config.hbs +++ b/packages/fuels/src/cli/templates/fuels.config.hbs @@ -36,6 +36,9 @@ export default createConfig({ {{#if (isDefined autoStartFuelCore)}} autoStartFuelCore: {{autoStartFuelCore}}, {{/if}} + {{#if (isDefined fuelCorePort)}} + fuelCorePort: {{fuelCorePort}}, + {{/if}} }); /** diff --git a/packages/fuels/src/cli/templates/fuels.config.ts b/packages/fuels/src/cli/templates/fuels.config.ts index 71930e975a9..cda74e22e1a 100644 --- a/packages/fuels/src/cli/templates/fuels.config.ts +++ b/packages/fuels/src/cli/templates/fuels.config.ts @@ -16,6 +16,7 @@ export function renderFuelsConfigTemplate(props: { forcPath?: string; fuelCorePath?: string; autoStartFuelCore?: boolean; + fuelCorePort?: string; }) { const renderTemplate = Handlebars.compile(fuelsConfigTemplate, { strict: true, diff --git a/packages/fuels/test/features/dev.test.ts b/packages/fuels/test/features/dev.test.ts index a03d97dfba1..8b62287d77b 100644 --- a/packages/fuels/test/features/dev.test.ts +++ b/packages/fuels/test/features/dev.test.ts @@ -1,3 +1,5 @@ +import { deferPromise } from '@fuel-ts/account'; +import { spawn } from 'child_process'; import * as chokidar from 'chokidar'; import * as buildMod from '../../src/cli/commands/build/index'; @@ -77,4 +79,43 @@ describe('dev', () => { expect(watch).toHaveBeenCalledTimes(2); expect(on).toHaveBeenCalledTimes(2); }); + + test('`dev` command uses fuelCorePort from config', async () => { + await runInit({ + root: paths.root, + workspace: paths.workspaceDir, + output: paths.outputDir, + forcPath: paths.forcPath, + fuelCorePath: paths.fuelCorePath, + fuelCorePort: '0', + }); + + const devProcess = spawn(`pnpm fuels dev --path ${paths.root}`, { + shell: 'bash', + }); + + const nodeLaunched = deferPromise(); + + const graphQLStartSubstring = 'Binding GraphQL provider to'; + + devProcess.stdout.on('data', (chunk) => { + const text: string = chunk.toString(); + + if (text.indexOf(graphQLStartSubstring) !== -1) { + const rows = text.split('\n'); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const rowWithUrl = rows.find((row) => row.indexOf(graphQLStartSubstring) !== -1)!; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const [, port] = rowWithUrl.split(' ').at(-1)!.trim().split(':'); // e.g. "2024-02-13T12:31:44.445844Z INFO new{name=fuel-core}: fuel_core::graphql_api::service: 216: Binding GraphQL provider to 127.0.0.1:35039" + + nodeLaunched.resolve(port); + } + }); + + const nodePort = await nodeLaunched.promise; + + expect(nodePort).not.toBe('0'); + // we verify it not to be the default port + expect(nodePort).not.toBe('4000'); + }); }); diff --git a/packages/fuels/test/features/init.test.ts b/packages/fuels/test/features/init.test.ts index f55d512d68b..0e3d7d0d292 100644 --- a/packages/fuels/test/features/init.test.ts +++ b/packages/fuels/test/features/init.test.ts @@ -112,6 +112,18 @@ describe('init', () => { expect(fuelsContents).toMatch(`fuelCorePath: 'fuels-core',`); }); + it('should run `init` command with custom fuel-core-port', async () => { + await runInit({ + root: paths.root, + workspace: paths.workspaceDir, + output: paths.outputDir, + fuelCorePort: '1234', + }); + + const fuelsContents = readFileSync(paths.fuelsConfigPath, 'utf-8'); + expect(fuelsContents).toMatch(`fuelCorePort: 1234,`); + }); + it('should run `init` command and throw for existent config file', async () => { const { error } = mockLogger(); diff --git a/packages/fuels/test/utils/runCommands.ts b/packages/fuels/test/utils/runCommands.ts index b1f10eab728..f5a052d81a8 100644 --- a/packages/fuels/test/utils/runCommands.ts +++ b/packages/fuels/test/utils/runCommands.ts @@ -102,6 +102,7 @@ export type InitParams = BaseParams & { autoStartFuelCore?: boolean; build?: boolean; privateKey?: string; + fuelCorePort?: string; }; export type BuildParams = BaseParams & { @@ -120,6 +121,7 @@ export async function runInit(params: InitParams) { fuelCorePath, workspace, privateKey, + fuelCorePort, } = params; const flag = ( @@ -137,6 +139,7 @@ export async function runInit(params: InitParams) { flag(['--forc-path', forcPath], forcPath), flag(['--fuel-core-path', fuelCorePath], fuelCorePath), flag(['--auto-start-fuel-core'], autoStartFuelCore), + flag(['--fuel-core-port', fuelCorePort], fuelCorePort), ].flat(); const command = await runCommand(Commands.init, flags); From c6ed262f20c4781908dc99bd0734e4e279708e12 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 09:07:25 +0100 Subject: [PATCH 02/22] use `fuelCorePort: 0` with `fuels build --deploy` in our pretests --- apps/docs/fuels.config.ts | 1 + apps/docs/package.json | 3 +-- apps/docs/scripts/pretest.sh | 16 ---------------- packages/fuel-gauge/fuels.config.ts | 1 + packages/fuel-gauge/package.json | 2 +- 5 files changed, 4 insertions(+), 19 deletions(-) delete mode 100755 apps/docs/scripts/pretest.sh diff --git a/apps/docs/fuels.config.ts b/apps/docs/fuels.config.ts index 5b0109ac896..0051980ab1a 100644 --- a/apps/docs/fuels.config.ts +++ b/apps/docs/fuels.config.ts @@ -6,4 +6,5 @@ export default createConfig({ forcBuildFlags: ['--release'], forcPath: 'fuels-forc', fuelCorePath: 'fuels-core', + fuelCorePort: 0, }); diff --git a/apps/docs/package.json b/apps/docs/package.json index a8253ab69d8..3cf733aa415 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -8,14 +8,13 @@ "dev": "nodemon --config nodemon.config.json -x 'run-s build:snippets dev:docs'", "build": "run-s build:snippets build:docs", "preview": "run-s build:snippets preview:docs", - "pretest": "./scripts/pretest.sh", "test": "cd ../.. && pnpm run test:filter apps/docs", "build:snippets": "run-s wrap:snippets build:forc", "build:docs": "vitepress build", "preview:docs": "vitepress preview", "dev:docs": "vitepress dev", "wrap:snippets": "tsx ./scripts/wrap-snippets.ts", - "build:forc": "pnpm fuels build", + "build:forc": "pnpm fuels build --deploy", "type:check": "pnpm tsc --noEmit --project tsconfig.emit.json" }, "keywords": [], diff --git a/apps/docs/scripts/pretest.sh b/apps/docs/scripts/pretest.sh deleted file mode 100755 index 25d456ae373..00000000000 --- a/apps/docs/scripts/pretest.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# Kill anything running on port 4000 -lsof -t -i:4000 | xargs -r kill - -# Runs a node at port 4000 -pnpm fuels node > /dev/null 2>&1 & - -# Builds projects -pnpm fuels build - -# Deploys projects (needed for loader bytecode) -pnpm fuels deploy - -# Kills the node -lsof -t -i:4000 | xargs -r kill \ No newline at end of file diff --git a/packages/fuel-gauge/fuels.config.ts b/packages/fuel-gauge/fuels.config.ts index 016d6327b74..121075f5e4b 100644 --- a/packages/fuel-gauge/fuels.config.ts +++ b/packages/fuel-gauge/fuels.config.ts @@ -6,4 +6,5 @@ export default createConfig({ forcBuildFlags: ['--release'], forcPath: 'fuels-forc', fuelCorePath: 'fuels-core', + fuelCorePort: 0, }); diff --git a/packages/fuel-gauge/package.json b/packages/fuel-gauge/package.json index 740c95be9a7..6d488cbafd8 100644 --- a/packages/fuel-gauge/package.json +++ b/packages/fuel-gauge/package.json @@ -6,7 +6,7 @@ "author": "Fuel Labs (https://fuel.network/)", "scripts": { "pretest": "run-s build:forc build:process-predicates", - "build:forc": "pnpm fuels build", + "build:forc": "pnpm fuels build --deploy", "build:process-predicates": "tsx ./scripts/process-predicates.ts", "type:check": "tsc --noEmit" }, From 953805e2a9a570f3505fecafb563d5e42630b68c Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 10:02:39 +0100 Subject: [PATCH 03/22] rename test --- packages/fuels/test/features/dev.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fuels/test/features/dev.test.ts b/packages/fuels/test/features/dev.test.ts index 8b62287d77b..08fd42bc763 100644 --- a/packages/fuels/test/features/dev.test.ts +++ b/packages/fuels/test/features/dev.test.ts @@ -80,7 +80,7 @@ describe('dev', () => { expect(on).toHaveBeenCalledTimes(2); }); - test('`dev` command uses fuelCorePort from config', async () => { + test('`dev` command can work with ephemeral port 0', async () => { await runInit({ root: paths.root, workspace: paths.workspaceDir, From 54f32ef368bf1e7199f0120bed316eb63e914a98 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 10:05:44 +0100 Subject: [PATCH 04/22] update docs --- apps/docs/src/guide/fuels-cli/commands.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/docs/src/guide/fuels-cli/commands.md b/apps/docs/src/guide/fuels-cli/commands.md index f842abd7a72..a1e919140f1 100644 --- a/apps/docs/src/guide/fuels-cli/commands.md +++ b/apps/docs/src/guide/fuels-cli/commands.md @@ -15,11 +15,17 @@ npx fuels@{{fuels}} help init ```console Options: - -w, --workspace Relative dir path to Forc workspace - -c, --contracts Relative path/globals to Contracts - -s, --scripts Relative path/globals to Scripts - -p, --predicates Relative path/globals to Predicates - -o, --output Relative dir path for Typescript generation + --path Path to project root (default: root of current project) + -w, --workspace Relative dir path to Forc workspace + -c, --contracts [paths...] Relative paths to Contracts + -s, --scripts [paths...] Relative paths to Scripts + -p, --predicates [paths...] Relative paths to Predicates + -o, --output Relative dir path for Typescript generation output + --forc-path Path to the `forc` binary + --fuel-core-path Path to the `fuel-core` binary + --auto-start-fuel-core Auto-starts a `fuel-core` node during `dev` command + --fuel-core-port Port to use when starting a local `fuel-core` node for dev mode + -h, --help Display help ``` Creating a sample `fuel.config.ts` file: From 142be12cd418d7c40cc1a534eed009ddc4393b79 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 10:19:58 +0100 Subject: [PATCH 05/22] revert changes that are for another PR --- .changeset/spicy-oranges-worry.md | 5 +++++ apps/docs/src/guide/fuels-cli/commands.md | 16 +++++----------- packages/fuels/src/cli.ts | 4 ---- packages/fuels/src/cli/commands/init/index.ts | 3 +-- .../fuels/src/cli/templates/fuels.config.hbs | 3 --- packages/fuels/src/cli/templates/fuels.config.ts | 1 - packages/fuels/test/features/init.test.ts | 12 ------------ packages/fuels/test/utils/runCommands.ts | 11 ++++++++++- 8 files changed, 21 insertions(+), 34 deletions(-) create mode 100644 .changeset/spicy-oranges-worry.md diff --git a/.changeset/spicy-oranges-worry.md b/.changeset/spicy-oranges-worry.md new file mode 100644 index 00000000000..ed8a8aaf161 --- /dev/null +++ b/.changeset/spicy-oranges-worry.md @@ -0,0 +1,5 @@ +--- +"fuels": patch +--- + +fix: enable usage of `0` port for the `fuelCorePort` field diff --git a/apps/docs/src/guide/fuels-cli/commands.md b/apps/docs/src/guide/fuels-cli/commands.md index a1e919140f1..f842abd7a72 100644 --- a/apps/docs/src/guide/fuels-cli/commands.md +++ b/apps/docs/src/guide/fuels-cli/commands.md @@ -15,17 +15,11 @@ npx fuels@{{fuels}} help init ```console Options: - --path Path to project root (default: root of current project) - -w, --workspace Relative dir path to Forc workspace - -c, --contracts [paths...] Relative paths to Contracts - -s, --scripts [paths...] Relative paths to Scripts - -p, --predicates [paths...] Relative paths to Predicates - -o, --output Relative dir path for Typescript generation output - --forc-path Path to the `forc` binary - --fuel-core-path Path to the `fuel-core` binary - --auto-start-fuel-core Auto-starts a `fuel-core` node during `dev` command - --fuel-core-port Port to use when starting a local `fuel-core` node for dev mode - -h, --help Display help + -w, --workspace Relative dir path to Forc workspace + -c, --contracts Relative path/globals to Contracts + -s, --scripts Relative path/globals to Scripts + -p, --predicates Relative path/globals to Predicates + -o, --output Relative dir path for Typescript generation ``` Creating a sample `fuel.config.ts` file: diff --git a/packages/fuels/src/cli.ts b/packages/fuels/src/cli.ts index 9a716cbfb7d..0299c304750 100644 --- a/packages/fuels/src/cli.ts +++ b/packages/fuels/src/cli.ts @@ -65,10 +65,6 @@ export const configureCli = () => { .option('--forc-path ', 'Path to the `forc` binary') .option('--fuel-core-path ', 'Path to the `fuel-core` binary') .option('--auto-start-fuel-core', 'Auto-starts a `fuel-core` node during `dev` command') - .option( - '--fuel-core-port ', - 'Port to use when starting a local `fuel-core` node for dev mode' - ) .action(withProgram(command, Commands.init, init)); (command = program.command(Commands.dev)) diff --git a/packages/fuels/src/cli/commands/init/index.ts b/packages/fuels/src/cli/commands/init/index.ts index cf15d11af49..0f537c5431a 100644 --- a/packages/fuels/src/cli/commands/init/index.ts +++ b/packages/fuels/src/cli/commands/init/index.ts @@ -10,7 +10,7 @@ import { log } from '../../utils/logger'; export function init(program: Command) { const options = program.opts(); - const { path, autoStartFuelCore, forcPath, fuelCorePath, fuelCorePort } = options; + const { path, autoStartFuelCore, forcPath, fuelCorePath } = options; let workspace: string | undefined; let absoluteWorkspace: string | undefined; @@ -61,7 +61,6 @@ export function init(program: Command) { forcPath, fuelCorePath, autoStartFuelCore, - fuelCorePort, }); writeFileSync(fuelsConfigPath, renderedConfig); diff --git a/packages/fuels/src/cli/templates/fuels.config.hbs b/packages/fuels/src/cli/templates/fuels.config.hbs index 33ceaa33b18..dc351121c38 100644 --- a/packages/fuels/src/cli/templates/fuels.config.hbs +++ b/packages/fuels/src/cli/templates/fuels.config.hbs @@ -36,9 +36,6 @@ export default createConfig({ {{#if (isDefined autoStartFuelCore)}} autoStartFuelCore: {{autoStartFuelCore}}, {{/if}} - {{#if (isDefined fuelCorePort)}} - fuelCorePort: {{fuelCorePort}}, - {{/if}} }); /** diff --git a/packages/fuels/src/cli/templates/fuels.config.ts b/packages/fuels/src/cli/templates/fuels.config.ts index cda74e22e1a..71930e975a9 100644 --- a/packages/fuels/src/cli/templates/fuels.config.ts +++ b/packages/fuels/src/cli/templates/fuels.config.ts @@ -16,7 +16,6 @@ export function renderFuelsConfigTemplate(props: { forcPath?: string; fuelCorePath?: string; autoStartFuelCore?: boolean; - fuelCorePort?: string; }) { const renderTemplate = Handlebars.compile(fuelsConfigTemplate, { strict: true, diff --git a/packages/fuels/test/features/init.test.ts b/packages/fuels/test/features/init.test.ts index 0e3d7d0d292..f55d512d68b 100644 --- a/packages/fuels/test/features/init.test.ts +++ b/packages/fuels/test/features/init.test.ts @@ -112,18 +112,6 @@ describe('init', () => { expect(fuelsContents).toMatch(`fuelCorePath: 'fuels-core',`); }); - it('should run `init` command with custom fuel-core-port', async () => { - await runInit({ - root: paths.root, - workspace: paths.workspaceDir, - output: paths.outputDir, - fuelCorePort: '1234', - }); - - const fuelsContents = readFileSync(paths.fuelsConfigPath, 'utf-8'); - expect(fuelsContents).toMatch(`fuelCorePort: 1234,`); - }); - it('should run `init` command and throw for existent config file', async () => { const { error } = mockLogger(); diff --git a/packages/fuels/test/utils/runCommands.ts b/packages/fuels/test/utils/runCommands.ts index f5a052d81a8..9fa85967ba2 100644 --- a/packages/fuels/test/utils/runCommands.ts +++ b/packages/fuels/test/utils/runCommands.ts @@ -139,7 +139,6 @@ export async function runInit(params: InitParams) { flag(['--forc-path', forcPath], forcPath), flag(['--fuel-core-path', fuelCorePath], fuelCorePath), flag(['--auto-start-fuel-core'], autoStartFuelCore), - flag(['--fuel-core-port', fuelCorePort], fuelCorePort), ].flat(); const command = await runCommand(Commands.init, flags); @@ -154,6 +153,16 @@ export async function runInit(params: InitParams) { writeFileSync(configPath, config.replace(search, replace)); } + if (fuelCorePort) { + const configPath = join(root, 'fuels.config.ts'); + const config = readFileSync(configPath, 'utf-8'); + + const search = /(^.*fuelCorePath:.*$)/m; + const replace = `$1\n fuelCorePort: '${fuelCorePort}',`; + + writeFileSync(configPath, config.replace(search, replace)); + } + return command; } From da894d1d2760563539cbf027e227683a0835d4bc Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 10:21:57 +0100 Subject: [PATCH 06/22] add newline on end --- packages/fuels/test/utils/runCommands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fuels/test/utils/runCommands.ts b/packages/fuels/test/utils/runCommands.ts index 9fa85967ba2..e79c218249f 100644 --- a/packages/fuels/test/utils/runCommands.ts +++ b/packages/fuels/test/utils/runCommands.ts @@ -148,7 +148,7 @@ export async function runInit(params: InitParams) { const config = readFileSync(configPath, 'utf-8'); const search = /(^.*fuelCorePath:.*$)/m; - const replace = `$1\n privateKey: '${privateKey}',`; + const replace = `$1\n privateKey: '${privateKey}',\n`; writeFileSync(configPath, config.replace(search, replace)); } From 73363d471b2e56aae79b0fab0ea7f7d0bbadacb7 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 10:23:02 +0100 Subject: [PATCH 07/22] add new line 2 --- packages/fuels/test/utils/runCommands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fuels/test/utils/runCommands.ts b/packages/fuels/test/utils/runCommands.ts index e79c218249f..124ea7f5208 100644 --- a/packages/fuels/test/utils/runCommands.ts +++ b/packages/fuels/test/utils/runCommands.ts @@ -158,7 +158,7 @@ export async function runInit(params: InitParams) { const config = readFileSync(configPath, 'utf-8'); const search = /(^.*fuelCorePath:.*$)/m; - const replace = `$1\n fuelCorePort: '${fuelCorePort}',`; + const replace = `$1\n fuelCorePort: '${fuelCorePort}',\n`; writeFileSync(configPath, config.replace(search, replace)); } From 36e657cafe924d52c2b6159dafc40f780dc814e2 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 10:46:39 +0100 Subject: [PATCH 08/22] investigate why test fails --- package.json | 4 ++-- packages/fuels/test/features/dev.test.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fa3798c102c..475e0afb781 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "packageManager": "pnpm@9.4.0", "scripts": { "dev": "nodemon --config nodemon.config.json -x 'pnpm build:packages'", - "build": "turbo run build --cache-dir=.turbo", + "build": "turbo run build --cache-dir=.turbo --filter fuels", "build:packages": "turbo run build --filter=!docs --filter=!template-*", "ci:test": "./scripts/tests-ci.sh", "pretest": "turbo run pretest", @@ -20,7 +20,7 @@ "depsync:lint": "syncpack list-mismatches", "depsync:fix": "syncpack fix-mismatches", "test": "vitest --run --coverage --config vitest.node.config.mts $(scripts/tests-find.sh --node)", - "test:node": "vitest --run --coverage --config vitest.node.config.mts $(scripts/tests-find.sh --node)", + "test:node": "vitest --run --coverage --config vitest.node.config.mts packages/fuels/test/features/dev.test.ts", "test:browser": "vitest --run --coverage --config vitest.browser.config.mts $(scripts/tests-find.sh --browser)", "test:all": "run-p test:node test:browser", "test:filter": "vitest --run --coverage false --config vitest.node.config.mts", diff --git a/packages/fuels/test/features/dev.test.ts b/packages/fuels/test/features/dev.test.ts index 08fd42bc763..b3b03961c0f 100644 --- a/packages/fuels/test/features/dev.test.ts +++ b/packages/fuels/test/features/dev.test.ts @@ -97,9 +97,13 @@ describe('dev', () => { const nodeLaunched = deferPromise(); const graphQLStartSubstring = 'Binding GraphQL provider to'; + devProcess.stderr.on('data', (chunk) => { + console.error(chunk.toString()); + }); devProcess.stdout.on('data', (chunk) => { const text: string = chunk.toString(); + console.log(text); if (text.indexOf(graphQLStartSubstring) !== -1) { const rows = text.split('\n'); From 265ffb9419fd7273f3288b1fb0e14e3a3eac7e9e Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 12:57:21 +0100 Subject: [PATCH 09/22] investigate further --- .github/workflows/test.yaml | 9 ++++----- package.json | 2 +- packages/fuels/test/features/dev.test.ts | 7 ++++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b4eebdd9f42..712b5b5f37b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,12 +18,11 @@ jobs: strategy: fail-fast: false matrix: - env: - [ - { name: node, version: 18.20.3, display-name: "node@18" }, - { name: node, version: 20.14.0, display-name: "node@20" }, + env: [ + # { name: node, version: 18.20.3, display-name: "node@18" }, + # { name: node, version: 20.14.0, display-name: "node@20" }, { name: node, version: 22.3.0, display-name: "node@22" }, - { name: browser, display-name: "browser" }, + # { name: browser, display-name: "browser" }, ] timeout-minutes: 25 steps: diff --git a/package.json b/package.json index 475e0afb781..0210eaf15b0 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "packageManager": "pnpm@9.4.0", "scripts": { "dev": "nodemon --config nodemon.config.json -x 'pnpm build:packages'", - "build": "turbo run build --cache-dir=.turbo --filter fuels", + "build": "turbo run build --cache-dir=.turbo", "build:packages": "turbo run build --filter=!docs --filter=!template-*", "ci:test": "./scripts/tests-ci.sh", "pretest": "turbo run pretest", diff --git a/packages/fuels/test/features/dev.test.ts b/packages/fuels/test/features/dev.test.ts index b3b03961c0f..8380be4a1e3 100644 --- a/packages/fuels/test/features/dev.test.ts +++ b/packages/fuels/test/features/dev.test.ts @@ -1,6 +1,7 @@ import { deferPromise } from '@fuel-ts/account'; import { spawn } from 'child_process'; import * as chokidar from 'chokidar'; +import { cwd } from 'process'; import * as buildMod from '../../src/cli/commands/build/index'; import * as deployMod from '../../src/cli/commands/deploy/index'; @@ -80,7 +81,7 @@ describe('dev', () => { expect(on).toHaveBeenCalledTimes(2); }); - test('`dev` command can work with ephemeral port 0', async () => { + test.only('`dev` command can work with ephemeral port 0', async () => { await runInit({ root: paths.root, workspace: paths.workspaceDir, @@ -98,12 +99,12 @@ describe('dev', () => { const graphQLStartSubstring = 'Binding GraphQL provider to'; devProcess.stderr.on('data', (chunk) => { - console.error(chunk.toString()); + console.error('err', chunk.toString()); }); devProcess.stdout.on('data', (chunk) => { const text: string = chunk.toString(); - console.log(text); + console.log('data', text); if (text.indexOf(graphQLStartSubstring) !== -1) { const rows = text.split('\n'); From 429102f22c12727f2b1abc4e6bb497420f115c63 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 13:07:58 +0100 Subject: [PATCH 10/22] remove only --- packages/fuels/test/features/dev.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/fuels/test/features/dev.test.ts b/packages/fuels/test/features/dev.test.ts index 8380be4a1e3..785995b4602 100644 --- a/packages/fuels/test/features/dev.test.ts +++ b/packages/fuels/test/features/dev.test.ts @@ -81,7 +81,7 @@ describe('dev', () => { expect(on).toHaveBeenCalledTimes(2); }); - test.only('`dev` command can work with ephemeral port 0', async () => { + test('`dev` command can work with ephemeral port 0', async () => { await runInit({ root: paths.root, workspace: paths.workspaceDir, @@ -95,6 +95,7 @@ describe('dev', () => { shell: 'bash', }); + console.log('cwd', cwd()); const nodeLaunched = deferPromise(); const graphQLStartSubstring = 'Binding GraphQL provider to'; From ca8e96a4092731a40f5d6f9a4cc52796e880e74f Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 13:17:27 +0100 Subject: [PATCH 11/22] remove replacement --- packages/fuels/test/utils/runCommands.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/packages/fuels/test/utils/runCommands.ts b/packages/fuels/test/utils/runCommands.ts index 33a7a0abd0b..0de65a6ebca 100644 --- a/packages/fuels/test/utils/runCommands.ts +++ b/packages/fuels/test/utils/runCommands.ts @@ -154,16 +154,6 @@ export async function runInit(params: InitParams) { writeFileSync(configPath, config.replace(search, replace)); } - if (fuelCorePort) { - const configPath = join(root, 'fuels.config.ts'); - const config = readFileSync(configPath, 'utf-8'); - - const search = /(^.*fuelCorePath:.*$)/m; - const replace = `$1\n fuelCorePort: '${fuelCorePort}',\n`; - - writeFileSync(configPath, config.replace(search, replace)); - } - return command; } From b4e5451b2346e0dd24632467ffa801c98cfc2df0 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Fri, 3 Jan 2025 14:56:54 +0100 Subject: [PATCH 12/22] try detached --- packages/fuels/test/features/dev.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/fuels/test/features/dev.test.ts b/packages/fuels/test/features/dev.test.ts index 785995b4602..7076401a3c3 100644 --- a/packages/fuels/test/features/dev.test.ts +++ b/packages/fuels/test/features/dev.test.ts @@ -93,6 +93,7 @@ describe('dev', () => { const devProcess = spawn(`pnpm fuels dev --path ${paths.root}`, { shell: 'bash', + detached: true, }); console.log('cwd', cwd()); From 70b711a571fd9c6f5c27db3b77c3fa8d09413728 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Sun, 5 Jan 2025 17:35:13 +0100 Subject: [PATCH 13/22] try out separate file --- package.json | 2 +- packages/fuels/test/features/dev-2.test.ts | 53 ++++++++++++++++++++++ packages/fuels/test/utils/runCommands.ts | 5 +- 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 packages/fuels/test/features/dev-2.test.ts diff --git a/package.json b/package.json index 0210eaf15b0..2eb62e870b6 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "depsync:lint": "syncpack list-mismatches", "depsync:fix": "syncpack fix-mismatches", "test": "vitest --run --coverage --config vitest.node.config.mts $(scripts/tests-find.sh --node)", - "test:node": "vitest --run --coverage --config vitest.node.config.mts packages/fuels/test/features/dev.test.ts", + "test:node": "vitest --run --coverage --config vitest.node.config.mts packages/fuels/test/features/dev-2.test.ts", "test:browser": "vitest --run --coverage --config vitest.browser.config.mts $(scripts/tests-find.sh --browser)", "test:all": "run-p test:node test:browser", "test:filter": "vitest --run --coverage false --config vitest.node.config.mts", diff --git a/packages/fuels/test/features/dev-2.test.ts b/packages/fuels/test/features/dev-2.test.ts new file mode 100644 index 00000000000..bb327df1e7e --- /dev/null +++ b/packages/fuels/test/features/dev-2.test.ts @@ -0,0 +1,53 @@ +import { deferPromise } from '@fuel-ts/account'; +import { spawn } from 'child_process'; +import { cwd } from 'process'; + +import { bootstrapProject, runInit } from '../utils/runCommands'; + +describe('dev-2', () => { + test('`dev` command can work with ephemeral port 0', async () => { + using paths = bootstrapProject(__filename); + + await runInit({ + root: paths.root, + workspace: paths.workspaceDir, + output: paths.outputDir, + forcPath: paths.forcPath, + fuelCorePath: paths.fuelCorePath, + fuelCorePort: '0', + }); + + const devProcess = spawn(`pnpm fuels dev --path ${paths.root}`, { + shell: 'bash', + }); + + console.log('cwd', cwd()); + const nodeLaunched = deferPromise(); + + const graphQLStartSubstring = 'Binding GraphQL provider to'; + devProcess.stderr.on('data', (chunk) => { + console.error('err', chunk.toString()); + }); + + devProcess.stdout.on('data', (chunk) => { + const text: string = chunk.toString(); + console.log('data', text); + + if (text.indexOf(graphQLStartSubstring) !== -1) { + const rows = text.split('\n'); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const rowWithUrl = rows.find((row) => row.indexOf(graphQLStartSubstring) !== -1)!; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const [, port] = rowWithUrl.split(' ').at(-1)!.trim().split(':'); // e.g. "2024-02-13T12:31:44.445844Z INFO new{name=fuel-core}: fuel_core::graphql_api::service: 216: Binding GraphQL provider to 127.0.0.1:35039" + + nodeLaunched.resolve(port); + } + }); + + const nodePort = await nodeLaunched.promise; + + expect(nodePort).not.toBe('0'); + // we verify it not to be the default port + expect(nodePort).not.toBe('4000'); + }); +}); diff --git a/packages/fuels/test/utils/runCommands.ts b/packages/fuels/test/utils/runCommands.ts index 0de65a6ebca..905c6bc663b 100644 --- a/packages/fuels/test/utils/runCommands.ts +++ b/packages/fuels/test/utils/runCommands.ts @@ -1,4 +1,4 @@ -import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs'; +import { cpSync, existsSync, mkdirSync, readFileSync, rmdirSync, rmSync, writeFileSync } from 'fs'; import { join, basename } from 'path'; import { Commands } from '../../src'; @@ -75,6 +75,9 @@ export function bootstrapProject(testFilepath: string) { fooContractFactoryPath, forcPath, fuelCorePath, + [Symbol.dispose]: () => { + rmdirSync(root, { recursive: true }); + }, }; } From 3fba15147f4c6e99f7070fb6fde27d050bf7a0a1 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Sun, 5 Jan 2025 17:39:27 +0100 Subject: [PATCH 14/22] add test group --- package.json | 2 +- packages/fuels/test/features/dev-2.test.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2eb62e870b6..97e17aaedad 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "packageManager": "pnpm@9.4.0", "scripts": { "dev": "nodemon --config nodemon.config.json -x 'pnpm build:packages'", - "build": "turbo run build --cache-dir=.turbo", + "build": "turbo run build --cache-dir=.turbo --filter=fuels", "build:packages": "turbo run build --filter=!docs --filter=!template-*", "ci:test": "./scripts/tests-ci.sh", "pretest": "turbo run pretest", diff --git a/packages/fuels/test/features/dev-2.test.ts b/packages/fuels/test/features/dev-2.test.ts index bb327df1e7e..e9adc061983 100644 --- a/packages/fuels/test/features/dev-2.test.ts +++ b/packages/fuels/test/features/dev-2.test.ts @@ -4,6 +4,9 @@ import { cwd } from 'process'; import { bootstrapProject, runInit } from '../utils/runCommands'; +/** + * @group node + */ describe('dev-2', () => { test('`dev` command can work with ephemeral port 0', async () => { using paths = bootstrapProject(__filename); From 1811615976d55603b71df4609b828dec57bedcdc Mon Sep 17 00:00:00 2001 From: nedsalk Date: Sun, 5 Jan 2025 18:16:43 +0100 Subject: [PATCH 15/22] test again --- packages/fuels/test/features/dev-2.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/fuels/test/features/dev-2.test.ts b/packages/fuels/test/features/dev-2.test.ts index e9adc061983..c1fb79a2b0e 100644 --- a/packages/fuels/test/features/dev-2.test.ts +++ b/packages/fuels/test/features/dev-2.test.ts @@ -1,5 +1,6 @@ import { deferPromise } from '@fuel-ts/account'; -import { spawn } from 'child_process'; +import { execSync, spawn } from 'child_process'; +import { join } from 'path'; import { cwd } from 'process'; import { bootstrapProject, runInit } from '../utils/runCommands'; @@ -20,7 +21,12 @@ describe('dev-2', () => { fuelCorePort: '0', }); - const devProcess = spawn(`pnpm fuels dev --path ${paths.root}`, { + const fuelsPath = execSync('which fuels').toString().trim(); + console.log('fuelsPath', fuelsPath); + + const buildFuelsPath = join(cwd(), 'packages/fuels/dist/bin.js'); + + const devProcess = spawn(`node ${buildFuelsPath} dev --path ${paths.root}`, { shell: 'bash', }); From 8e32d336642850f9495a50b19f2178332c2c0798 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Sun, 5 Jan 2025 18:21:42 +0100 Subject: [PATCH 16/22] retry --- packages/fuels/test/features/dev-2.test.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/fuels/test/features/dev-2.test.ts b/packages/fuels/test/features/dev-2.test.ts index c1fb79a2b0e..fea0b60ca44 100644 --- a/packages/fuels/test/features/dev-2.test.ts +++ b/packages/fuels/test/features/dev-2.test.ts @@ -21,9 +21,6 @@ describe('dev-2', () => { fuelCorePort: '0', }); - const fuelsPath = execSync('which fuels').toString().trim(); - console.log('fuelsPath', fuelsPath); - const buildFuelsPath = join(cwd(), 'packages/fuels/dist/bin.js'); const devProcess = spawn(`node ${buildFuelsPath} dev --path ${paths.root}`, { From ef184cb82aa82b6d65c7b9b35708543679197648 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Sun, 5 Jan 2025 18:29:49 +0100 Subject: [PATCH 17/22] okay so this works --- packages/fuels/test/features/dev-2.test.ts | 59 ---------------------- packages/fuels/test/features/dev.test.ts | 12 ++--- 2 files changed, 4 insertions(+), 67 deletions(-) delete mode 100644 packages/fuels/test/features/dev-2.test.ts diff --git a/packages/fuels/test/features/dev-2.test.ts b/packages/fuels/test/features/dev-2.test.ts deleted file mode 100644 index fea0b60ca44..00000000000 --- a/packages/fuels/test/features/dev-2.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { deferPromise } from '@fuel-ts/account'; -import { execSync, spawn } from 'child_process'; -import { join } from 'path'; -import { cwd } from 'process'; - -import { bootstrapProject, runInit } from '../utils/runCommands'; - -/** - * @group node - */ -describe('dev-2', () => { - test('`dev` command can work with ephemeral port 0', async () => { - using paths = bootstrapProject(__filename); - - await runInit({ - root: paths.root, - workspace: paths.workspaceDir, - output: paths.outputDir, - forcPath: paths.forcPath, - fuelCorePath: paths.fuelCorePath, - fuelCorePort: '0', - }); - - const buildFuelsPath = join(cwd(), 'packages/fuels/dist/bin.js'); - - const devProcess = spawn(`node ${buildFuelsPath} dev --path ${paths.root}`, { - shell: 'bash', - }); - - console.log('cwd', cwd()); - const nodeLaunched = deferPromise(); - - const graphQLStartSubstring = 'Binding GraphQL provider to'; - devProcess.stderr.on('data', (chunk) => { - console.error('err', chunk.toString()); - }); - - devProcess.stdout.on('data', (chunk) => { - const text: string = chunk.toString(); - console.log('data', text); - - if (text.indexOf(graphQLStartSubstring) !== -1) { - const rows = text.split('\n'); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const rowWithUrl = rows.find((row) => row.indexOf(graphQLStartSubstring) !== -1)!; - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const [, port] = rowWithUrl.split(' ').at(-1)!.trim().split(':'); // e.g. "2024-02-13T12:31:44.445844Z INFO new{name=fuel-core}: fuel_core::graphql_api::service: 216: Binding GraphQL provider to 127.0.0.1:35039" - - nodeLaunched.resolve(port); - } - }); - - const nodePort = await nodeLaunched.promise; - - expect(nodePort).not.toBe('0'); - // we verify it not to be the default port - expect(nodePort).not.toBe('4000'); - }); -}); diff --git a/packages/fuels/test/features/dev.test.ts b/packages/fuels/test/features/dev.test.ts index 7076401a3c3..0a3de9f8ba8 100644 --- a/packages/fuels/test/features/dev.test.ts +++ b/packages/fuels/test/features/dev.test.ts @@ -1,6 +1,7 @@ import { deferPromise } from '@fuel-ts/account'; import { spawn } from 'child_process'; import * as chokidar from 'chokidar'; +import { join } from 'path'; import { cwd } from 'process'; import * as buildMod from '../../src/cli/commands/build/index'; @@ -91,23 +92,18 @@ describe('dev', () => { fuelCorePort: '0', }); - const devProcess = spawn(`pnpm fuels dev --path ${paths.root}`, { + const buildFuelsPath = join(cwd(), 'packages/fuels/dist/bin.js'); + + const devProcess = spawn(`node ${buildFuelsPath} dev --path ${paths.root}`, { shell: 'bash', - detached: true, }); - console.log('cwd', cwd()); const nodeLaunched = deferPromise(); const graphQLStartSubstring = 'Binding GraphQL provider to'; - devProcess.stderr.on('data', (chunk) => { - console.error('err', chunk.toString()); - }); devProcess.stdout.on('data', (chunk) => { const text: string = chunk.toString(); - console.log('data', text); - if (text.indexOf(graphQLStartSubstring) !== -1) { const rows = text.split('\n'); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion From 28799cca6526e41dc215b7130e8ef3d0328b4212 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Sun, 5 Jan 2025 18:36:20 +0100 Subject: [PATCH 18/22] point to `fuels.js` --- packages/fuels/test/features/dev.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fuels/test/features/dev.test.ts b/packages/fuels/test/features/dev.test.ts index 0a3de9f8ba8..1e32d7dadd5 100644 --- a/packages/fuels/test/features/dev.test.ts +++ b/packages/fuels/test/features/dev.test.ts @@ -92,7 +92,7 @@ describe('dev', () => { fuelCorePort: '0', }); - const buildFuelsPath = join(cwd(), 'packages/fuels/dist/bin.js'); + const buildFuelsPath = join(cwd(), 'packages/fuels/fuels.js'); const devProcess = spawn(`node ${buildFuelsPath} dev --path ${paths.root}`, { shell: 'bash', From 01494e9de49170885102eec6700bab1ded845a4a Mon Sep 17 00:00:00 2001 From: nedsalk Date: Sun, 5 Jan 2025 18:39:27 +0100 Subject: [PATCH 19/22] run correct test --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 97e17aaedad..0eacd58abb4 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "depsync:lint": "syncpack list-mismatches", "depsync:fix": "syncpack fix-mismatches", "test": "vitest --run --coverage --config vitest.node.config.mts $(scripts/tests-find.sh --node)", - "test:node": "vitest --run --coverage --config vitest.node.config.mts packages/fuels/test/features/dev-2.test.ts", + "test:node": "vitest --run --coverage --config vitest.node.config.mts packages/fuels/test/features/dev.test.ts", "test:browser": "vitest --run --coverage --config vitest.browser.config.mts $(scripts/tests-find.sh --browser)", "test:all": "run-p test:node test:browser", "test:filter": "vitest --run --coverage false --config vitest.node.config.mts", From cbf539f91ff968f311c4f044233541c58908af1f Mon Sep 17 00:00:00 2001 From: nedsalk Date: Sun, 5 Jan 2025 18:49:34 +0100 Subject: [PATCH 20/22] wip --- packages/fuels/test/features/dev.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/fuels/test/features/dev.test.ts b/packages/fuels/test/features/dev.test.ts index 1e32d7dadd5..93bca9d78b9 100644 --- a/packages/fuels/test/features/dev.test.ts +++ b/packages/fuels/test/features/dev.test.ts @@ -92,6 +92,11 @@ describe('dev', () => { fuelCorePort: '0', }); + /** + * TODO: This is a workaround to get to fuels.js + * because it's not available as a binary in the fuels package itself. + * I must test this in fuels-gauge to verify. + */ const buildFuelsPath = join(cwd(), 'packages/fuels/fuels.js'); const devProcess = spawn(`node ${buildFuelsPath} dev --path ${paths.root}`, { From 247ae759303701353b4ab5df99a1f9543f7b6dc1 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Mon, 6 Jan 2025 09:11:54 +0100 Subject: [PATCH 21/22] verify `fuels` is available in `fuel-gauge` --- package.json | 2 +- packages/fuel-gauge/src/fuels-dev.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 packages/fuel-gauge/src/fuels-dev.test.ts diff --git a/package.json b/package.json index 0eacd58abb4..0d88be570a0 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "depsync:lint": "syncpack list-mismatches", "depsync:fix": "syncpack fix-mismatches", "test": "vitest --run --coverage --config vitest.node.config.mts $(scripts/tests-find.sh --node)", - "test:node": "vitest --run --coverage --config vitest.node.config.mts packages/fuels/test/features/dev.test.ts", + "test:node": "vitest --run --coverage --config vitest.node.config.mts packages/fuel-gauge/src/fuels-dev.test.ts", "test:browser": "vitest --run --coverage --config vitest.browser.config.mts $(scripts/tests-find.sh --browser)", "test:all": "run-p test:node test:browser", "test:filter": "vitest --run --coverage false --config vitest.node.config.mts", diff --git a/packages/fuel-gauge/src/fuels-dev.test.ts b/packages/fuel-gauge/src/fuels-dev.test.ts new file mode 100644 index 00000000000..7a79864a4a5 --- /dev/null +++ b/packages/fuel-gauge/src/fuels-dev.test.ts @@ -0,0 +1,9 @@ +import { execSync } from 'child_process'; + +describe('fuels-dev', () => { + test('it works', () => { + const res = execSync('pnpm fuels init').toString(); + + console.log(res); + }); +}); From d43f113360319c3ed85a28c41b24fdf3858a2770 Mon Sep 17 00:00:00 2001 From: nedsalk Date: Mon, 6 Jan 2025 09:16:58 +0100 Subject: [PATCH 22/22] add node group --- packages/fuel-gauge/src/fuels-dev.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/fuel-gauge/src/fuels-dev.test.ts b/packages/fuel-gauge/src/fuels-dev.test.ts index 7a79864a4a5..1f871e8fcfe 100644 --- a/packages/fuel-gauge/src/fuels-dev.test.ts +++ b/packages/fuel-gauge/src/fuels-dev.test.ts @@ -1,5 +1,8 @@ import { execSync } from 'child_process'; +/** + * @group node + */ describe('fuels-dev', () => { test('it works', () => { const res = execSync('pnpm fuels init').toString();