Closed dfriederich closed 2 months ago
Could you sync your branch? I've just fixed the CI config, so PR check should work.
I did update, the tests run but the HW tests do fail on the validation build. They do run then I run them here locally, so not sure how to fix this. Could this be a setup issue in the validation setup?
dfriederich2@xdfriederich:.../src/adbkit$ RUN_DEVICE_TESTS=true npm run test
> @devicefarmer/adbkit@3.2.6 test
> mocha -r ts-node/register --reporter spec --colors test/**/*.ts
LineTransform
✔ should implement stream.Transform
✔ should not modify data that does not have 0x0d 0x0a in it
✔ should not remove 0x0d if not followed by 0x0a
✔ should remove 0x0d if followed by 0x0a
✔ should push 0x0d without 0x0a if last in stream
✔ should push saved 0x0d if next chunk does not start with 0x0a
✔ should remove saved 0x0d if next chunk starts with 0x0a
with autoDetect
✔ should not modify data if first byte is 0x0a
✔ should not include initial 0x0a
✔ should not include initial 0x0d 0x0a
✔ should not include initial 0x0d 0x0a even if in separate chunks
✔ should transform as usual if first byte is not 0x0a
without autoDetect
✔ should transform as usual even if first byte is 0x0a
Parser
end()
✔ should end the stream and consume all remaining data
readAll()
✔ should return a cancellable Promise
✔ should read all remaining content until the stream ends
✔ should resolve with an empty Buffer if the stream has already ended and there's nothing more to read
readBytes(howMany)
✔ should return a cancellable Promise
✔ should read as many bytes as requested
✔ should wait for enough data to appear (51ms)
✔ should keep data waiting even when nothing has been requested (52ms)
✔ should reject with Parser.PrematureEOFError if stream ends before enough bytes can be read
readByteFlow(maxHowMany, targetStream)
✔ should return a cancellable Promise
✔ should read as many bytes as requested
✔ should progress with new/partial chunk until maxHowMany
readAscii(howMany)
✔ should return a cancellable Bluebird Promise
✔ should read as many ascii characters as requested
✔ should reject with Parser.PrematureEOFError if stream ends before enough bytes can be read
readValue()
✔ should return a cancellable Bluebird Promise
✔ should read a protocol value as a Buffer
✔ should return an empty value
✔ should reject with Parser.PrematureEOFError if stream ends before the value can be read
readError()
✔ should return a cancellable Bluebird Promise
✔ should reject with Parser.FailError using the value
✔ should reject with Parser.PrematureEOFError if stream ends before the error can be read
searchLine(re)
✔ should return a cancellable Bluebird Promise
✔ should return the re.exec match of the matching line
✔ should reject with Parser.PrematureEOFError if stream ends before a line is found
readLine()
✔ should return a cancellable Bluebird Promise
✔ should skip a line terminated by \n
✔ should return skipped line
✔ should strip trailing \r
✔ should reject with Parser.PrematureEOFError if stream ends before a line is found
readUntil(code)
✔ should return a cancellable Bluebird Promise
✔ should return any characters before given value
✔ should reject with Parser.PrematureEOFError if stream ends before a line is found
raw()
✔ should return the resumed raw stream
unexpected(data, expected)
✔ should reject with Parser.UnexpectedDataError
Protocol
✔ should expose a 'FAIL' property
✔ should expose an 'OKAY' property
@decodeLength(length)
✔ should return a Number
✔ should accept a hexadecimal string
@encodeLength(length)
✔ should return a String
✔ should return a valid hexadecimal number
✔ should return uppercase hexadecimal digits
✔ should pad short values with zeroes for a 4-byte size
✔ should return 0000 for 0 length
@encodeData(data)
✔ should return a Buffer
✔ should accept a string or a Buffer
✔ should prefix data with length
Sync
end()
✔ should end the sync connection
push(contents, path[, mode])
✔ should call pushStream when contents is a Stream
✔ should call pushFile when contents is a String
✔ should return a PushTransfer instance
pushStream(stream, path[, mode])
✔ should return a PushTransfer instance
✔ should be able to push >65536 byte chunks without error (54ms)
pull(path)
✔ should retrieve the same content pushStream() pushed
✔ should emit error for non-existing files
✔ should return a PullTransfer instance
Stream
✔ should emit 'end' when pull is done
stat(path)
✔ should return a Promise
✔ should call with an ENOENT error if the path does not exist
✔ should call with an fs.Stats instance for an existing path
Stats
✔ should implement Fs.Stats
✔ should set the `.mode` property for isFile() etc
✔ should set the `.size` property
✔ should set the `.mtime` property
Entry
✔ should implement Stats
✔ should set the `.name` property (63ms)
✔ should set the Stats properties
Tracker
✔ should emit 'add' when a device is added
✔ should emit 'remove' when a device is removed
✔ should emit 'change' when a device changes
✔ should emit 'changeSet' with all changes
✔ should emit 'error' and 'end' when connection ends
✔ should read devices from socket
end()
✔ should close the connection
✔ should not cause an error to be emit
util
readAll(stream)
✔ should return a cancellable Bluebird Promise
✔ should read all remaining content until the stream ends
90 passing (431ms)
It seems despite that there are no connected devices in the CI environment the before hook in the synct.ts test still runs and fails randomly due to timeout. I've added a RUN_DEVICE_TESTS check in that hook.
Could you sync once more?
When running HW tests with
RUN_DEVICE_TESTS=true yarn test
the HW tests all failed with:
Error: Resolution method is overspecified. Specify a callback or return a Promise; not both.
Basically the test framework no longer allows to return a Promise and to end with a callback. As the callback was only used with the return promise anyhow, I simplified the code by dropping the done callback, just using the promise.