PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

Fix broken tests for 1.13 and 1.14 #3129

Closed rom1504 closed 1 year ago

rom1504 commented 1 year ago

looking at failures actually it seems something is broken with inventories / windows will need to look at recent changes and add tests where needed

rom1504 commented 1 year ago

https://github.com/PrismarineJS/mineflayer/actions/runs/5699720568/job/15448906714

rom1504 commented 1 year ago
1) mineflayer_external 1.13.2
       exampleInventory:
     Uncaught AssertionError [ERR_ASSERTION]: Unexpected message: cannot equip diamond_boots: Server rejected transaction for clicking on slot 39, on window with id 0., wanted equipped diamond_boots
      at /home/runner/work/mineflayer/mineflayer/test/externalTests/exampleInventory.js:80:14
      at checkCondition (test/externalTests/plugins/testCommon.js:157:65)
      at EventEmitter.onEvent (lib/promise_utils.js:51:50)
      at EventEmitter.<anonymous> (lib/plugins/chat.js:85:104)
      at Client.<anonymous> (lib/plugins/chat.js:130:9)
      at Client.<anonymous> (node_modules/minecraft-protocol/src/client/play.js:46:16)
      at emitPacket (node_modules/minecraft-protocol/src/client.js:83:12)
      at FullPacketParser.<anonymous> (node_modules/minecraft-protocol/src/client.js:106:9)
      at addChunk (node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:279:12)
      at readableAddChunk (node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:262:11)
      at FullPacketParser.Readable.push (node_modules/protodef/node_modules/readable-stream/lib/_stream_readable.js:228:10)
      at FullPacketParser.Transform.push (node_modules/protodef/node_modules/readable-stream/lib/_stream_transform.js:132:32)
      at FullPacketParser._transform (node_modules/protodef/src/serializer.js:89:10)
      at FullPacketParser.Transform._read (node_modules/protodef/node_modules/readable-stream/lib/_stream_transform.js:166:10)
      at FullPacketParser.Transform._write (node_modules/protodef/node_modules/readable-stream/lib/_stream_transform.js:155:83)
      at doWrite (node_modules/protodef/node_modules/readable-stream/lib/_stream_writable.js:390:139)
      at writeOrBuffer (node_modules/protodef/node_modules/readable-stream/lib/_stream_writable.js:381:5)
      at FullPacketParser.Writable.write (node_modules/protodef/node_modules/readable-stream/lib/_stream_writable.js:302:11)
      at Decompressor.ondata (node_modules/readable-stream/lib/internal/streams/readable.js:662:22)
      at addChunk (node_modules/readable-stream/lib/internal/streams/readable.js:278:12)
      at readableAddChunk (node_modules/readable-stream/lib/internal/streams/readable.js:255:9)
      at Decompressor.Readable.push (node_modules/readable-stream/lib/internal/streams/readable.js:201:10)
      at Unzip.cb (node_modules/minecraft-protocol/src/transforms/compression.js:69:14)
      at Unzip.zlibBufferOnEnd (zlib.js:158:10)
      at endReadableNT (internal/streams/readable.js:1333:12)
      at processTicksAndRejections (internal/process/task_queues.js:82:21)

  2) mineflayer_external 1.13.2
       exampleInventory:
     done() called multiple times in test <mineflayer_external 1.13.2 exampleInventory> of file /home/runner/work/mineflayer/mineflayer/test/externalTest.js; in addition, done() received error: Error: Promise timed out.
    at /home/runner/work/mineflayer/mineflayer/lib/promise_utils.js:79:13
    at async Object.runExample (/home/runner/work/mineflayer/mineflayer/test/externalTests/plugins/testCommon.js:206:7)
    at async /home/runner/work/mineflayer/mineflayer/test/externalTests/exampleInventory.js:50:3
  Error: done() called multiple times in test <mineflayer_external 1.13.2 exampleInventory> of file /home/runner/work/mineflayer/mineflayer/test/externalTest.js; in addition, done() received error: Error: Promise timed out.
      at /home/runner/work/mineflayer/mineflayer/lib/promise_utils.js:79:13
      at async Object.runExample (test/externalTests/plugins/testCommon.js:206:7)
      at async /home/runner/work/mineflayer/mineflayer/test/externalTests/exampleInventory.js:50:3
      at /home/runner/work/mineflayer/mineflayer/test/externalTest.js:135:68
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)

  3) mineflayer_external 1.13.2
       "before each" hook for "fishing":
     Error: Timeout of 600000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/mineflayer/mineflayer/test/externalTest.js)
      at listOnTimeout (internal/timers.js:[557](https://github.com/PrismarineJS/mineflayer/actions/runs/5699720568/job/15448906714#step:6:558):17)
      at processTimers (internal/timers.js:500:7)
rom1504 commented 1 year ago

maybe https://github.com/PrismarineJS/prismarine-windows/pull/74 is related

any thoughts @kaduvert ?

kaduvert commented 1 year ago

so it may be with my changes, but when i made my pr testing my fork, all tests were green i guess it has something to do with the environment or changes more recent than mine

i don't really know what can cause my changes to work in the pr but not work when they are merged also it's only with 1.13/1.14 so i have even less clue

rom1504 commented 1 year ago

Your changes are used. The ^ before the version number means use last minor version of this major.

However yes it may well be that the cause is due to something else. Still appreciated if you have any ideas

On Sat, Jul 29, 2023, 13:15 kaduvert @.***> wrote:

so it may be with my changes, but when i made my pr testing my fork, all tests were green i guess it has something to do with the environment or changes more recent than mine

i don't really know what can cause my changes to work in the pr but not work when they are merged

— Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/3129#issuecomment-1656707453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437QDCZDOTEMRJTZRTHTXSTWD3ANCNFSM6AAAAAA24M4VLE . You are receiving this because you authored the thread.Message ID: @.***>

rom1504 commented 1 year ago

Actually not flaky, broken with 100% reproducibility

rom1504 commented 1 year ago

trying some fixes at https://github.com/PrismarineJS/mineflayer/pull/3130

frej4189 commented 1 year ago

Still failing after downgrading to prismarine-windows@2.6.1 so likely not caused by any of the changes in 2.7.0

frej4189 commented 1 year ago

Issue with prismarine-item. Caused by https://github.com/PrismarineJS/prismarine-item/pull/86 in conjunction with https://github.com/PrismarineJS/prismarine-item/pull/103

rom1504 commented 1 year ago

Fixed now, thanks @frej4189 and @extremeheat