Skip to content

Enhance E2E tests to verify bin file executability #363

@groupsky

Description

@groupsky

Problem

E2E tests currently check that bin files exist but not that they are executable:

@test "emulator CLI binary exists" {
  [ -f "../../packages/emulator/dist/esm/bin/ya-modbus-emulator.js" ]
}

This test would pass even if the file has no executable permissions.

Context

  • E2E tests invoke bins with node <path>, bypassing executable permissions
  • This means bins could ship without executable permissions and tests would still pass
  • Real users expect to run ya-modbus-emulator directly, not node ya-modbus-emulator.js

Proposed Solution

Update E2E tests to check executability instead of just existence:

tests/e2e/tests/02-emulator.bats:

@test "emulator CLI binary is executable" {
  [ -x "../../packages/emulator/dist/esm/bin/ya-modbus-emulator.js" ]
}

@test "emulator CLI binary can be invoked directly" {
  run ../../packages/emulator/dist/esm/bin/ya-modbus-emulator.js --version
  assert_success
}

Apply similar changes to:

  • tests/e2e/tests/03-mqtt-bridge.bats
  • tests/e2e/tests/04-cli.bats
  • tests/e2e/tests/05-device-profiler.bats (if exists)

Benefits

  • Tests match real-world usage (direct invocation, not via node)
  • Catches permission issues before they reach production
  • More accurate validation of CLI behavior

Effort

~1 hour (update 3-4 test files)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority:mediumMedium priorityscope:cliIssues related to the CLI packagescope:device-profilerIssues related to the device-profiler packagescope:emulatorIssues related to the emulator packagescope:mqtt-bridgeIssues related to the MQTT bridge packagetestingTesting improvements and additions

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions