Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

many tests are failing, probably because of -json switch #225

Closed
philaris opened this issue Feb 27, 2020 · 6 comments
Closed

many tests are failing, probably because of -json switch #225

philaris opened this issue Feb 27, 2020 · 6 comments

Comments

@philaris
Copy link

The latest commit in master 35d07fc makes most tests fail. It seems that somewhere a -json switch is used (instead of --json).

  ● Wallet Methods › Wallet cancel › Throws an error if it is given a transaction that cannot be canceled

    Error parsing command line arguments: flag provided but not defined: -json

      64 |       if (code) {
      65 |         const errorMessage = Buffer.concat(stdErrBuffer).toString('utf8')
    > 66 |         return reject(new Error(errorMessage))
         |                       ^
      67 |       } else {
      68 |         const stdout = Buffer.concat(stdOutBuffer).toString('utf8')
      69 |

      at ChildProcess.<anonymous> (src/utils/keybaseExec.ts:66:23)

  ● Wallet Methods › Wallet cancel › Throws an error if it is given a transaction that cannot be canceled

    The client is not yet initialized.

       95 |   protected async _guardInitialized(): Promise<void> {
       96 |     if (!this.initialized) {
    >  97 |       throw new Error('The client is not yet initialized.')
          |             ^
       98 |     }
       99 |   }
      100 |   protected _pathToKeybaseBinary(): string {

      at Wallet.<anonymous> (src/client-base/index.ts:97:13)
      at step (lib/client-base/index.js:46:23)
      at Object.next (lib/client-base/index.js:27:53)
      at lib/client-base/index.js:21:71
      at __awaiter (lib/client-base/index.js:17:12)
      at Wallet.ClientBase._guardInitialized (lib/client-base/index.js:153:16)
      at Wallet.<anonymous> (src/wallet-client/index.ts:104:16)
      at step (lib/wallet-client/index.js:46:23)
      at Object.next (lib/wallet-client/index.js:27:53)

 PASS  src/utils/formatAPIObject.test.ts

Test Suites: 10 failed, 1 passed, 11 total
Tests:       80 failed, 12 passed, 92 total
Snapshots:   0 total
Time:        71.805s, estimated 94s
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.
@cpebble
Copy link

cpebble commented Feb 28, 2020

I'm getting this issue as well, with keybase-bot from npm

@malgorithms
Copy link
Contributor

thanks @mrcpj1998 and @philaris - it seems we added a feature to the bot library that required an admin build of the keybase app...which is why we weren't seeing this problem.

I'll rewind it and have a release out shortly.

cc @songgao and @joshblum

@malgorithms
Copy link
Contributor

ok, you 2 wanna give it a try with the latest? 3.6.1

@philaris
Copy link
Author

Thank you for the prompt response! Now almost all tests pass (except two, similar to the failing test in #221), so we are at the same situation as before.

$ yarn test
yarn run v1.22.0
$ jest --runInBand
 PASS  __tests__/init.test.ts (44.749s)
 PASS  __tests__/deinit.test.ts (29.473s)
 PASS  __tests__/team.test.ts (15.283s)
 PASS  __tests__/myInfo.test.ts
 PASS  __tests__/helpers.test.ts
 FAIL  __tests__/chat.test.ts (58.067s)
  ● Console

    console.log __tests__/chat.test.ts:92
      Caught err on removing existing membership

  ● Chat Methods › Chat read › Doesn't mark messages read on peek

    expect(received).toHaveProperty(path, value)

    Expected path: "unread"

    Expected value: true
    Received value: false

      174 |       await timeout(500)
      175 |       result = await alice1.chat.read(channel)
    > 176 |       expect(result.messages[0]).toHaveProperty('unread', true)
          |                                  ^
      177 |       result = await alice1.chat.read(channel)
      178 |       expect(result.messages[0]).toHaveProperty('unread', false)
      179 |

      at __tests__/chat.test.ts:176:34
      at step (__tests__/chat.test.ts:33:23)
      at Object.next (__tests__/chat.test.ts:14:53)
      at fulfilled (__tests__/chat.test.ts:5:58)

  ● Chat Methods › Chat createChannel, joinChannel, watchChannel, and leaveChannel › Successfully performs the complete flow

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

    Expected: "leave"
    Received: "text"

      397 |         },
      398 |       })
    > 399 |       expect(read2.messages[0].content.type).toEqual('leave')
          |                                              ^
      400 |       expect(read2.messages[0].sender.username).toEqual(config.bots.bob1.username)
      401 |       await timeout(500)
      402 |       await alice1.chat.send(teamChannel, message)

      at __tests__/chat.test.ts:399:46
      at step (__tests__/chat.test.ts:33:23)
      at Object.next (__tests__/chat.test.ts:14:53)
      at fulfilled (__tests__/chat.test.ts:5:58)

 PASS  __tests__/wallet.test.ts (70.609s)
 PASS  __tests__/kvstore.test.ts (8.311s)
 PASS  __tests__/chat.simple.watch.test.ts (12.795s)
 PASS  __tests__/race.conditions.test.ts (15.366s)
 PASS  src/utils/formatAPIObject.test.ts

Test Suites: 1 failed, 10 passed, 11 total
Tests:       2 failed, 90 passed, 92 total
Snapshots:   0 total
Time:        263.018s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@malgorithms
Copy link
Contributor

@philaris I believe that is a flakey test - maybe a race condition. curious, does that happen a second time?

@philaris
Copy link
Author

@malgorithms I ran the test two more times and I get exactly the one failure mentioned in #221 for both runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants