Skip to content
New issue

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

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

Already on GitHub? # to your account

Many failed tests when run "npm test" #747

Closed
tiendq opened this issue May 7, 2018 · 2 comments
Closed

Many failed tests when run "npm test" #747

tiendq opened this issue May 7, 2018 · 2 comments

Comments

@tiendq
Copy link

tiendq commented May 7, 2018

I just forked and followed exactly this guide Contributing. All steps were done successfully but running test the first time result in many failed tests.

  1. Fork: Ok
  2. npm install: Ok
  3. Install Docker: Ok (Docker CE for Mac 18.03.1-ce)
  4. CouchDB docker pull apache/couchdb:2.1.1: Ok
  5. Fake private key (echo -n "PRIVATE_KEY="; openssl genrsa 2>/dev/null | gzip | base64) >> .env: Ok
  6. npm test: Failed
Test Suites: 2 failed, 54 passed, 56 total
Tests:       32 failed, 284 passed, 316 total
Snapshots:   0 total

There were many errors but I have noticed most of them related to package.json, github-event, monorepo,

Some errors (there were many, if you want to see them all, let me know so I'll copy all console log).

github-event push › package.json added/modified for a not enabled repo (333)

github-event push › monorepo: subdirectory package.json, which is not listed in the config, was modified (555)

github-event push: monorepo › monorepo: new greenkeeper.json is added with 2 groups (3462)

github-event push: monorepo › monorepo: greenkeeper.json modified by user and it now has invalid groupname (mgm1)

/Users/tiendq/Github/greenkeeper/test/jobs/update-payments.js: babel-plugin-jest-hoist: The module factory of `jest.mock()` is not allowed to reference any out-of-scope variables.
    Invalid variable access: console

macOS 10.12.6
NodeJS 10.0.0

@tiendq
Copy link
Author

tiendq commented May 8, 2018

This is one of the test errors I reported in original issue, interestingly I found out that it is a Jest's bug - it doesn't have console in the whitelist. They fixed it too with but not released.

The error caused by line 107 in file update-payments.js (test passed if I comment out this line):

console.log('fail: stripe was called')

Run this test:

NODE_ENV=testing node_modules/.bin/jest test/jobs/update-payments.js

get this result:

 FAIL  test/jobs/update-payments.js
  ● Test suite failed to run

    /Users/tiendq/Github/greenkeeper/test/jobs/update-payments.js: babel-plugin-jest-hoist: The module factory of `jest.mock()` is not allowed to reference any out-of-scope variables.
    Invalid variable access: console
    Whitelisted objects: Array, ArrayBuffer, Boolean, DataView, Date, Error, EvalError, Float32Array, Float64Array, Function, Generator, GeneratorFunction, Infinity, Int16Array, Int32Array, Int8Array, InternalError, Intl, JSON, Map, Math, NaN, Number, Object, Promise, Proxy, RangeError, ReferenceError, Reflect, RegExp, Set, String, Symbol, SyntaxError, TypeError, URIError, Uint16Array, Uint32Array, Uint8Array, Uint8ClampedArray, WeakMap, WeakSet, arguments, expect, jest, require, undefined, DTRACE_NET_SERVER_CONNECTION, DTRACE_NET_STREAM_END, DTRACE_HTTP_SERVER_REQUEST, DTRACE_HTTP_SERVER_RESPONSE, DTRACE_HTTP_CLIENT_REQUEST, DTRACE_HTTP_CLIENT_RESPONSE, global, process, Buffer, clearImmediate, clearInterval, clearTimeout, setImmediate, setInterval, setTimeout.
    Note: This is a precaution to guard against uninitialized mock variables. If it is ensured that the mock is required lazily, variable names prefixed with `mock` are permitted.

@janl
Copy link
Contributor

janl commented Jul 10, 2018

can you try running this in Node 8 instead?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants