remove-outside-collaborators icon indicating copy to clipboard operation
remove-outside-collaborators copied to clipboard

Test Fails

Open kreig303 opened this issue 6 years ago • 4 comments

Platform:

macOS Mojave Node 10.14

Steps to reproduce:

$ git clone ...
$ npm it

Output:

npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.

> [email protected] install /remove-outside-collaborators/node_modules/dtrace-provider
> node-gyp rebuild || node suppress-error.js

  ACTION binding_gyp_ndtp_target_build_ndtp .
  TOUCH Release/obj.target/ndtp.stamp

> [email protected] install /remove-outside-collaborators/node_modules/fsevents
> node install

[fsevents] Success: "/remove-outside-collaborators/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.

added 881 packages from 506 contributors and audited 17553 packages in 12.396s
found 0 vulnerabilities


> [email protected] test /remove-outside-collaborators
> jest && standard

 FAIL  test/lib/plugins/RemoveOutsideCollaborators.test.js
  ● Test suite failed to run

    SecurityError: localStorage is not available for opaque origins

      at Window.get localStorage [as localStorage] (node_modules/jsdom/lib/jsdom/browser/Window.js:257:15)
          at Array.forEach (<anonymous>)

 FAIL  test/index.test.js
  ● Test suite failed to run

    SecurityError: localStorage is not available for opaque origins

      at Window.get localStorage [as localStorage] (node_modules/jsdom/lib/jsdom/browser/Window.js:257:15)
          at Array.forEach (<anonymous>)

Test Suites: 2 failed, 2 total
Tests:       0 total
Snapshots:   0 total
Time:        0.631s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

kreig303 avatar Dec 07 '18 02:12 kreig303

Found jest config update which allows tests to run without "localStorage" but still errors out.

Add to package.json:

 "jest": {
    "verbose": true,
    "testURL": "http://localhost/"
  }

Then upon execution of npm it...

npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.

> [email protected] install /remove-outside-collaborators/node_modules/dtrace-provider
> node-gyp rebuild || node suppress-error.js

  ACTION binding_gyp_ndtp_target_build_ndtp .
  TOUCH Release/obj.target/ndtp.stamp

> [email protected] install /remove-outside-collaborators/node_modules/fsevents
> node install

[fsevents] Success: "/remove-outside-collaborators/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.

added 881 packages from 506 contributors and audited 17553 packages in 14.304s
found 0 vulnerabilities


> [email protected] test /remove-outside-collaborators
> jest && standard

(node:40372) UnhandledPromiseRejectionWarning: TypeError: this.github.orgs.checkMembership is not a function
(node:40372) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async fun
ction without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:40372) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not hand
led will terminate the Node.js process with a non-zero exit code.
(node:40372) UnhandledPromiseRejectionWarning: TypeError: this.github.orgs.checkMembership is not a function
(node:40372) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async fun
ction without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:40372) UnhandledPromiseRejectionWarning: TypeError: this.github.orgs.checkMembership is not a function
(node:40372) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async fun
ction without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:40372) UnhandledPromiseRejectionWarning: TypeError: this.github.orgs.checkMembership is not a function
(node:40372) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async fun
ction without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:40372) UnhandledPromiseRejectionWarning: TypeError: this.github.orgs.checkMembership is not a function
(node:40372) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async fun
ction without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
(node:40372) UnhandledPromiseRejectionWarning: TypeError: this.github.orgs.checkMembership is not a function
(node:40372) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async fun
ction without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
 FAIL  test/lib/plugins/RemoveOutsideCollaborators.test.js
  removeOutsideCollaborators
    update
      ✓ repo created by an org member (2ms)
      ✕ added and enableCollaboratorRemoval is disabled (13ms)
      ✕ added and enableCollaboratorRemoval is enabled (1ms)
      ✓ added and the collaborator is whitelisted (1ms)
      ✕ added and the collaborator is not whitelisted
      ✕ added collaborator and app is in monitorOnly mode (1ms)
      ✕ added collaborator and monitorOnly mode is disabled
    formIssueBody
      ✓ formIssueBody with ccList (1ms)
      ✓ formIssueBody with no ccList (1ms)
    createIssue
      ✓ createIssue with Title and Body
    removeCollaborator
      ✓ removeCollaborator from repo
    executeMonitorOnly
      ✓ executeMonitorOnly
    executeRemoval
      ✓ executeRemoval (1ms)

  ● removeOutsideCollaborators › update › added and enableCollaboratorRemoval is disabled

    expect(jest.fn()).toHaveBeenCalled()

    Expected mock function to have been called.

      51 |       config.update()
      52 |       expect(spyExecuteRemoval).not.toHaveBeenCalled()
    > 53 |       expect(spyMonitorOnly).toHaveBeenCalled()
      54 |     })
      55 |
      56 |     it('added and enableCollaboratorRemoval is enabled', () => {

      at Object.toHaveBeenCalled (test/lib/plugins/RemoveOutsideCollaborators.test.js:53:30)

  ● removeOutsideCollaborators › update › added and enableCollaboratorRemoval is enabled

    expect(jest.fn()).toHaveBeenCalled()

    Expected mock function to have been called.

      61 |       config.update()
      62 |       expect(spyExecuteRemoval).not.toHaveBeenCalled()
    > 63 |       expect(spyMonitorOnly).toHaveBeenCalled()
      64 |     })
      65 |
      66 |     it('added and the collaborator is whitelisted', () => {

      at Object.toHaveBeenCalled (test/lib/plugins/RemoveOutsideCollaborators.test.js:63:30)

  ● removeOutsideCollaborators › update › added and the collaborator is not whitelisted

    expect(jest.fn()).toHaveBeenCalled()

    Expected mock function to have been called.

      80 |       config.update()
      81 |       expect(spyExecuteRemoval).not.toHaveBeenCalled()
    > 82 |       expect(spyMonitorOnly).toHaveBeenCalled()
      83 |     })
      84 |
      85 |     it('added collaborator and app is in monitorOnly mode', () => {

      at Object.toHaveBeenCalled (test/lib/plugins/RemoveOutsideCollaborators.test.js:82:30)

  ● removeOutsideCollaborators › update › added collaborator and app is in monitorOnly mode

    expect(jest.fn()).toHaveBeenCalled()

    Expected mock function to have been called.

      90 |       config.update()
      91 |       expect(spyExecuteRemoval).not.toHaveBeenCalled()
    > 92 |       expect(spyMonitorOnly).toHaveBeenCalled()
      93 |     })
      94 |
      95 |     it('added collaborator and monitorOnly mode is disabled', () => {

      at Object.toHaveBeenCalled (test/lib/plugins/RemoveOutsideCollaborators.test.js:92:30)

  ● removeOutsideCollaborators › update › added collaborator and monitorOnly mode is disabled

    expect(jest.fn()).toHaveBeenCalled()

    Expected mock function to have been called.

       98 |       `)
       99 |       config.update()
    > 100 |       expect(spyExecuteRemoval).toHaveBeenCalled()
      101 |       expect(spyMonitorOnly).not.toHaveBeenCalled()
      102 |     })
      103 |   })

      at Object.toHaveBeenCalled (test/lib/plugins/RemoveOutsideCollaborators.test.js:100:33)

 PASS  test/index.test.js
  plugin
    analyzes on added collaborator
      ✓ analyzes member (2ms)

Test Suites: 1 failed, 1 passed, 2 total
Tests:       5 failed, 9 passed, 14 total
Snapshots:   0 total
Time:        1.094s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

kreig303 avatar Dec 07 '18 02:12 kreig303

Thanks @kreig303 I’ll look into this!

Hollywood avatar Dec 07 '18 17:12 Hollywood

I am going to try and finally fix this on the long break. Just have to set up a proper environment now that github actions are available in the core product.

kreig303 avatar Dec 23 '19 15:12 kreig303

#25 can’t work properly until this is addressed

kreig303 avatar Dec 23 '19 18:12 kreig303