Skip to content

Commit 6780419

Browse files
committed
fix: skipping e2e tests on gh ci
1 parent f9e9ac5 commit 6780419

4 files changed

Lines changed: 43 additions & 2 deletions

File tree

src/commands/chain/install.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,19 @@ export async function ensureLeapInstalled(): Promise<void> {
188188
return
189189
}
190190

191+
// In test mode, skip auto-installation and just check if nodeos is available
192+
if (process.env.WHARFKIT_TEST) {
193+
if (!status.nodeos) {
194+
throw new Error(
195+
'LEAP is not installed and auto-installation is disabled in test mode. ' +
196+
'Please install LEAP manually or ensure nodeos is available in PATH.'
197+
)
198+
}
199+
// If nodeos is available, continue even if other components are missing
200+
console.log(`LEAP nodeos is available (version: ${status.version || 'unknown'})`)
201+
return
202+
}
203+
191204
console.log('LEAP is not installed, installing automatically...')
192205

193206
if (!status.nodeos) {

test/tests/chain-interact.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {execSync} from 'child_process'
33
import * as fs from 'fs'
44
import * as path from 'path'
55
import * as os from 'os'
6-
import {killProcessAtPort} from '../utils/test-helpers'
6+
import {killProcessAtPort, isNodeosAvailable} from '../utils/test-helpers'
77

88
suite('Chain Interaction', () => {
99
const cliPath = path.join(__dirname, '../../lib/cli.js')
@@ -12,6 +12,14 @@ suite('Chain Interaction', () => {
1212
let contractAccount: string
1313

1414
suiteSetup(function () {
15+
// Skip suite if nodeos is not available
16+
if (!isNodeosAvailable()) {
17+
// eslint-disable-next-line no-console
18+
console.log('Skipping Chain Interaction tests: nodeos is not available')
19+
this.skip()
20+
return
21+
}
22+
1523
this.timeout(120000) // Increase timeout for chain startup and deploy
1624

1725
// Create a temporary test directory

test/tests/e2e-workflow.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as os from 'os'
66
import {ABI, APIClient, FetchProvider, Serializer} from '@wharfkit/antelope'
77
import fetch from 'node-fetch'
88
import {log} from '../../src/utils'
9-
import {killProcessAtPort} from '../utils/test-helpers'
9+
import {killProcessAtPort, isNodeosAvailable} from '../utils/test-helpers'
1010

1111
/**
1212
* E2E tests for the complete workflow:
@@ -41,6 +41,14 @@ suite('E2E Workflow', () => {
4141
let originalHome: string
4242

4343
suiteSetup(function () {
44+
// Skip suite if nodeos is not available
45+
if (!isNodeosAvailable()) {
46+
// eslint-disable-next-line no-console
47+
console.log('Skipping E2E Workflow tests: nodeos is not available')
48+
this.skip()
49+
return
50+
}
51+
4452
// Create a temporary test directory
4553
testDir = path.join(os.tmpdir(), `wharfkit-e2e-test-${Date.now()}`)
4654
fs.mkdirSync(testDir, {recursive: true})

test/utils/test-helpers.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import {execSync} from 'child_process'
22

3+
/**
4+
* Check if nodeos is available in PATH
5+
*/
6+
export function isNodeosAvailable(): boolean {
7+
try {
8+
execSync('which nodeos', {encoding: 'utf8', stdio: 'ignore'})
9+
return true
10+
} catch {
11+
return false
12+
}
13+
}
14+
315
/**
416
* Kill any nodeos processes listening on the specified port
517
* @param port - The port number to check

0 commit comments

Comments
 (0)