Skip to main content

hubify test

Test skills in isolated E2B sandbox environments before publishing or deploying.

Usage

hubify test <skill> [options]

Arguments

ArgumentDescription
skillSkill name or path to test

Options

OptionDescription
--scenario <name>Run specific test scenario
--allRun all scenarios
--timeout <ms>Test timeout (default: 60000)
--verboseVerbose output
--jsonOutput as JSON

Examples

Test a Skill

hubify test typescript-strict-mode
Output:
Testing typescript-strict-mode in E2B sandbox...

  Creating sandbox... ✓
  Installing dependencies... ✓
  Loading skill... ✓

  Running tests:

    Scenario: New Next.js project
      ✓ Skill executed successfully
      ✓ tsconfig.json created
      ✓ Strict mode enabled
      ✓ No TypeScript errors

    Scenario: Existing project migration
      ✓ Skill executed successfully
      ✓ tsconfig.json updated
      ✓ Incremental flags applied
      ⚠ 3 type errors to fix (expected)

    Scenario: Monorepo configuration
      ✓ Skill executed successfully
      ✓ Base config created
      ✓ Package configs extend base

  Results:
    Passed: 3/3 scenarios
    Warnings: 1
    Errors: 0

  Cleanup... ✓

All tests passed!

Test Local Skill

hubify test ./my-skill

Run Specific Scenario

hubify test typescript-strict-mode --scenario "monorepo"

Run All Scenarios

hubify test typescript-strict-mode --all

Verbose Output

hubify test typescript-strict-mode --verbose
Output includes:
  • Full sandbox logs
  • Skill execution output
  • File system changes
  • Command outputs

JSON Output

hubify test typescript-strict-mode --json
{
  "skill": "typescript-strict-mode",
  "version": "1.2.0",
  "duration": 45000,
  "scenarios": [
    {
      "name": "New Next.js project",
      "status": "passed",
      "checks": [
        { "name": "Skill executed", "passed": true },
        { "name": "tsconfig.json created", "passed": true }
      ]
    }
  ],
  "summary": {
    "total": 3,
    "passed": 3,
    "failed": 0,
    "warnings": 1
  }
}

Test Scenarios

Skills can define test scenarios in their .hub file:
name: typescript-strict-mode
version: 1.2.0

tests:
  scenarios:
    - name: "New Next.js project"
      setup:
        - npx create-next-app@latest test-app --typescript
      checks:
        - file_exists: tsconfig.json
        - file_contains:
            path: tsconfig.json
            pattern: '"strict": true'
        - command_succeeds: npx tsc --noEmit

    - name: "Existing project migration"
      setup:
        - mkdir test-project
        - echo '{"compilerOptions":{}}' > test-project/tsconfig.json
      checks:
        - file_contains:
            path: tsconfig.json
            pattern: '"strict": true'

    - name: "Monorepo configuration"
      setup:
        - npx create-turbo@latest test-mono
      checks:
        - file_exists: tsconfig.base.json
        - file_contains:
            path: packages/*/tsconfig.json
            pattern: '"extends"'

Check Types

CheckDescription
file_existsFile exists at path
file_not_existsFile does not exist
file_containsFile contains pattern
file_not_containsFile does not contain pattern
command_succeedsCommand exits with 0
command_failsCommand exits non-zero
output_containsCommand output contains text

E2B Sandbox

Tests run in isolated E2B cloud sandboxes:
  • Fresh environment for each test
  • No access to local files
  • No network access (unless configured)
  • Automatic cleanup

Requirements

# Set E2B API key
export E2B_API_KEY=your-api-key

Sandbox Configuration

tests:
  sandbox:
    template: ubuntu      # Sandbox template
    timeout: 120000       # Timeout in ms
    memory: 2048          # Memory in MB
    network: false        # Network access

CI Integration

Run tests in CI:
# .github/workflows/test.yml
name: Test Skills

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Hubify
        run: npm install -g hubify

      - name: Test skills
        run: hubify test ./skills/* --json > results.json
        env:
          E2B_API_KEY: ${{ secrets.E2B_API_KEY }}

      - name: Upload results
        uses: actions/upload-artifact@v4
        with:
          name: test-results
          path: results.json

Debugging Failed Tests

# Keep sandbox alive for debugging
hubify test typescript-strict-mode --keep-alive

# Connect to sandbox
hubify test connect <sandbox-id>

See Also