Skip to content

Commit 094158a

Browse files
committed
chore: added publish-next script
1 parent 29d7d5f commit 094158a

File tree

6 files changed

+1181
-1
lines changed

6 files changed

+1181
-1
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,8 @@ clean:
6969
.PHONY: distclean
7070
distclean: clean
7171
rm -rf node_modules/
72+
73+
.PHONY: publish-next
74+
publish-next: lib
75+
yarn version --minor --no-git-tag-version
76+
yarn publish --tag next

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wharfkit/cli",
3-
"version": "2.11.0",
3+
"version": "2.12.0",
44
"license": "BSD-3-Clause",
55
"homepage": "https://github.com/wharfkit/cli#readme",
66
"description": "Command line utilities for Wharf",

test/tests/e2e-cli-structure.ts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import {assert} from 'chai'
2+
import {execSync} from 'child_process'
3+
import * as path from 'path'
4+
import {isNodeosAvailable} from '../utils/test-helpers'
5+
6+
/**
7+
* E2E tests for CLI command structure:
8+
* - Verifies commands exist and have correct help text
9+
* - Tests command hierarchy
10+
*
11+
* Note: These tests don't require a running chain, but we still
12+
* check for nodeos availability to match other E2E test behavior.
13+
*/
14+
suite('E2E: CLI Structure', () => {
15+
const cliPath = path.join(__dirname, '../../lib/cli.js')
16+
17+
suiteSetup(function () {
18+
if (!isNodeosAvailable()) {
19+
// eslint-disable-next-line no-console
20+
console.log('Skipping E2E tests: nodeos is not available in PATH')
21+
this.skip()
22+
}
23+
})
24+
25+
suite('Command Structure', () => {
26+
test('wallet command has correct subcommands', function () {
27+
const output = execSync(`node ${cliPath} wallet --help`, {encoding: 'utf8'})
28+
29+
assert.include(output, 'create')
30+
assert.include(output, 'keys')
31+
assert.include(output, 'account')
32+
assert.include(output, 'transact')
33+
})
34+
35+
test('wallet account command has create subcommand', function () {
36+
const output = execSync(`node ${cliPath} wallet account --help`, {encoding: 'utf8'})
37+
38+
assert.include(output, 'create')
39+
assert.include(output, 'Create a new account on the blockchain')
40+
})
41+
42+
test('contract deploy command works', function () {
43+
const output = execSync(`node ${cliPath} contract deploy --help`, {encoding: 'utf8'})
44+
45+
assert.include(output, 'Deploy a compiled contract')
46+
assert.include(output, '--account')
47+
assert.include(output, '--url')
48+
assert.include(output, '--key')
49+
})
50+
51+
test('dev command is at top level', function () {
52+
const output = execSync(`node ${cliPath} dev --help`, {encoding: 'utf8'})
53+
54+
assert.include(output, 'Start local chain and watch for changes')
55+
assert.include(output, '--account')
56+
assert.include(output, '--port')
57+
assert.include(output, '--clean')
58+
})
59+
60+
test('compile command is at top level', function () {
61+
const output = execSync(`node ${cliPath} compile --help`, {encoding: 'utf8'})
62+
63+
assert.include(output, 'Compile C++ contract files')
64+
assert.include(output, '--output')
65+
})
66+
67+
test('wallet keys command has add subcommand', function () {
68+
const output = execSync(`node ${cliPath} wallet keys --help`, {encoding: 'utf8'})
69+
70+
assert.include(output, 'add')
71+
assert.include(output, 'create')
72+
assert.include(output, 'Add an existing private key')
73+
})
74+
})
75+
})
76+

test/tests/e2e-compile.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import {assert} from 'chai'
2+
import {execSync} from 'child_process'
3+
import * as fs from 'fs'
4+
import * as path from 'path'
5+
import {
6+
E2ETestContext,
7+
setupE2ETestEnvironment,
8+
teardownE2ETestEnvironment,
9+
} from '../utils/test-helpers'
10+
11+
/**
12+
* E2E tests for contract compilation:
13+
* - Compile command behavior
14+
* - Error handling for missing files
15+
* - CDT integration
16+
*/
17+
suite('E2E: Compile', () => {
18+
let ctx: E2ETestContext | null = null
19+
20+
suiteSetup(async function () {
21+
ctx = await setupE2ETestEnvironment(this)
22+
})
23+
24+
suiteTeardown(function () {
25+
this.timeout(30000)
26+
teardownE2ETestEnvironment(ctx)
27+
})
28+
29+
suite('Contract Compilation', () => {
30+
test('shows helpful error when no cpp files found', function () {
31+
if (!ctx) this.skip()
32+
try {
33+
execSync(`node ${ctx.cliPath} compile`, {
34+
encoding: 'utf8',
35+
cwd: ctx.testDir,
36+
})
37+
assert.fail('Should throw error when no cpp files found')
38+
} catch (error: any) {
39+
assert.isTrue(error.status !== 0 || error.code !== 0)
40+
}
41+
})
42+
43+
test('can compile a cpp file when cdt is installed', function () {
44+
if (!ctx) this.skip()
45+
const rootCppPath = path.join(__dirname, '../../test.cpp')
46+
const cppPath = path.join(ctx.testDir, 'test.cpp')
47+
48+
fs.copyFileSync(rootCppPath, cppPath)
49+
50+
try {
51+
const output = execSync(`node ${ctx.cliPath} compile`, {
52+
encoding: 'utf8',
53+
cwd: ctx.testDir,
54+
})
55+
56+
assert.isTrue(
57+
output.includes('Compilation complete!') ||
58+
output.includes('cdt-cpp is not installed') ||
59+
output.includes('LEAP is not installed')
60+
)
61+
} catch (error: any) {
62+
const output = error.stderr || error.stdout
63+
assert.isTrue(
64+
output.includes('cdt-cpp is not installed') ||
65+
output.includes('LEAP is not installed')
66+
)
67+
}
68+
})
69+
})
70+
})
71+

0 commit comments

Comments
 (0)