If read() throws an error, we should return a valid Protobuf message that can be processed down the line as if the device had returned an actual Protobuf message.
Use try/catch in sendRaw to catch errors and return a valid Protobuf Failure message
Other changes:
Add "addDefaultTransform" transform function to jest
rollup's commonjs module converts all commonjs module into ES6 modules with default exports
This allows import module from 'module' syntax to work
ts-jest does NOT do this, so the compiled TypeScript files are looking for .default when importing commonjs modules, resulting in an error
Change jest config to only look for .ts test files to avoid running any .js files in dist
Description
If
read()
throws an error, we should return a valid Protobuf message that can be processed down the line as if the device had returned an actual Protobuf message.try/catch
insendRaw
to catch errors and return a valid ProtobufFailure
messageOther changes:
import module from 'module'
syntax to workts-jest
does NOT do this, so the compiled TypeScript files are looking for.default
when importing commonjs modules, resulting in an error.ts
test files to avoid running any.js
files indist
.default