OASIS-learn-study / minecraft-storeys-maker

Minecraft extension to make your own stories in, with and for Minecraft - it's like being a movie director!
https://www.learn.study
GNU Affero General Public License v3.0
14 stars 10 forks source link

Mineflayer test failures get "stuck" (Jest did not exit one second after the test run has completed.) #397

Closed vorburger closed 1 year ago

vorburger commented 2 years ago

@edewit I do think the Mineflayer test gets "stuck", when I broke the plugin this happened:

$ npm test

> mineflayer@1.0.0 test /home/vorburger/git/github.com/OASIS-learn-study/minecraft-storeys-maker/test-mineflayer
> jest

 FAIL  ./storeys.test.js (20.594 s)
  Storeys plugin test
    ✕ should connect to minecraft server and execute /make (10002 ms)
    ✕ should execute /new (10002 ms)

  ● Storeys plugin test › should connect to minecraft server and execute /make

    expect(received).toEqual(expected) // deep equality

    Expected: "Click here to open Scratch and MAKE actions"
    Received: "Unknown command. Try /help for a list of commands"

      34 |     bot.on('messagestr', (msg) => {
      35 |       if (msg !== "Player joined the game") {
    > 36 |         expect(msg).toEqual("Click here to open Scratch and MAKE actions");
         |                     ^
      37 |         done();
      38 |         bot.quit();
      39 |       }

      at EventEmitter.<anonymous> (storeys.test.js:36:21)
      at Client.<anonymous> (node_modules/mineflayer/lib/plugins/chat.js:120:9)
      at FullPacketParser.<anonymous> (node_modules/minecraft-protocol/src/client.js:91:12)
      at addChunk (node_modules/readable-stream/lib/_stream_readable.js:298:12)
      at readableAddChunk (node_modules/readable-stream/lib/_stream_readable.js:280:11)
      at FullPacketParser.Object.<anonymous>.Readable.push (node_modules/readable-stream/lib/_stream_readable.js:241:10)
      at FullPacketParser.Object.<anonymous>.Transform.push (node_modules/readable-stream/lib/_stream_transform.js:139:32)

  ● Storeys plugin test › should connect to minecraft server and execute /make

    thrown: "Exceeded timeout of 10000 ms for a test.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

      27 |   });
      28 |
    > 29 |   test("should connect to minecraft server and execute /make", (done) => {
         |   ^
      30 |     // given
      31 |     const bot = createBot("/make");
      32 |

      at storeys.test.js:29:3
      at Object.<anonymous> (storeys.test.js:22:1)

  ● Storeys plugin test › should execute /new

    thrown: "Exceeded timeout of 10000 ms for a test.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

      43 |   }, TIMEOUT);
      44 |
    > 45 |   test("should execute /new", (done) => {
         |   ^
      46 |     // given
      47 |     const bot = createBot("/new");
      48 |

      at storeys.test.js:45:3
      at Object.<anonymous> (storeys.test.js:22:1)

Test Suites: 1 failed, 1 total
Tests:       2 failed, 2 total
Snapshots:   0 total
Time:        20.636 s, estimated 21 s
Ran all test suites.
Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

The shell prompt "never returned" - Node was somehow "hanging" here.

vorburger commented 1 year ago

@edewit did #389 (or another of your recent PRs) fix this, or is open? (I'm just doing a round going over open issues.)

vorburger commented 1 year ago

Oh the intended fix for this one may be part of #400 (I think).

vorburger commented 1 year ago

Ah no this error (above) currently still appears on the GCB CI log of #400.

edewit commented 1 year ago

yes #400 should have fixed this, but I think if an timeout occurs this still happens

edewit commented 1 year ago

fixed by: #427