SmartThingsCommunity / SmartThingsEdgeDrivers

Apache License 2.0
268 stars 453 forks source link

Error - missing module 'init' on test.run_registered_tests() #56

Open ronie-z-wave opened 2 years ago

ronie-z-wave commented 2 years ago

After the minor change under capabilities/init.lua I was able to run the test. (see #54) Unfortunately it was throwing the next error:

PS Q:\repos\smartthings_edge_drivers> lua54 "Q:\repos\SmartThingsEdgeDrivers\drivers\SmartThings\zigbee-contact\src\test\test_zigbee_contact_battery.lua"
Running test "Battery Voltage test cases" (1 of 3)
--------------------------------------------------
Received unexpected error: module 'init' not found:
        no field package.preload['init']
        no file 'Q:\repos\smartthings_edge_drivers\lua_libs-api_v0\init.lua'
        no file 'Q:\repos\smartthings_edge_drivers\lua_libs-api_v0\init\init.lua'
        no file '.\init.lua'
        no file '.\init\init.lua'
        no file ''
        no file 'Q:\lua\init.dll'
        no file 'Q:\lua\..\lib\lua\5.4\init.dll'
        no file 'Q:\lua\loadall.dll'
        no file '.\init.dll'
        no file 'Q:\lua\init54.dll'
        no file '.\init54.dll'
stack traceback:
        [C]: in function 'require'
        [C]: in function 'xpcall'
        ...s_edge_drivers\lua_libs-api_v0\integration_test\init.lua:214: in upvalue 'run_configured_test'
        ...s_edge_drivers\lua_libs-api_v0\integration_test\init.lua:326: in function 'integration_test.run_registered_tests'
        ...\zigbee-contact\src\test\test_zigbee_contact_battery.lua:139: in main chunk
        [C]: in ?
FAILED
varzac commented 2 years ago

We appear to have a gap in the documentation, and I can make a not of that. If you want to run the tests for a driver, you have to execute it from the src directory of the driver you are testing as that mimics how they would be expected to run on target.