Skip to content

Check versions when npm.license is missing - #53

Closed
glensc wants to merge 9 commits into
orta:mainfrom
glensc:search-versions-for-license
Closed

Check versions when npm.license is missing#53
glensc wants to merge 9 commits into
orta:mainfrom
glensc:search-versions-for-license

Conversation

@glensc

@glensc glensc commented Mar 22, 2022

Copy link
Copy Markdown
Contributor

Re-create #6

Fixes #5

Original description by @macklinu:

I wanted to contribute a fix for #5, but it looks like I'm not mocking node-fetch properly in the tests, and I believe the danger test snapshot changed to the latest danger README (aka it's fetching data from the network in the tests). If you could help out on this, that'd be awesome. I think this is the general fix desired - open to feedback! 😄

glensc and others added 6 commits March 22, 2022 11:53
Co-Authored-by: Elan Ruusamäe <glen@delfi.ee>
Co-Authored-by: Macklin Underdown <macklinu@users.noreply.github.com>
Co-Authored-by: Macklin Underdown <macklinu@users.noreply.github.com>
@glensc

glensc commented Mar 22, 2022

Copy link
Copy Markdown
Contributor Author

Tried to re-create as smaller atomic commits while rebased:

@glensc

glensc commented Mar 22, 2022

Copy link
Copy Markdown
Contributor Author

Jest doesn't like things here.

➜ ./node_modules/.bin/jest
 FAIL  src/index.test.ts
  ● Test suite failed to run

    /Users/glen/scm/node/danger/danger-plugin-yarn/src/index.test.ts: babel-plugin-jest-hoist: The module factory of `jest.mock()` is not allowed to reference any out-of-scope variables.
    Invalid variable access: fixtureDangerNpmInfo
    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, global, clearInterval, clearTimeout, setInterval, setTimeout, queueMicrotask, performance, clearImmediate, setImmediate, structuredClone.
    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.

      at invariant (node_modules/babel-plugin-jest-hoist/build/index.js:13:11)
      at newFn (node_modules/babel-traverse/lib/visitors.js:276:21)
      at NodePath._call (node_modules/babel-traverse/lib/path/context.js:76:18)
      at NodePath.call (node_modules/babel-traverse/lib/path/context.js:48:17)
      at NodePath.visit (node_modules/babel-traverse/lib/path/context.js:105:12)
      at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:150:16)
      at TraversalContext.visitMultiple (node_modules/babel-traverse/lib/context.js:103:17)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.388s
Ran all test suites.

@glensc

glensc commented Mar 22, 2022

Copy link
Copy Markdown
Contributor Author

Now at 58d8b95, some other errors:

➜ ./node_modules/.bin/jest
 FAIL  src/index.test.ts
  ● Test suite failed to run

    /Users/glen/scm/node/danger/danger-plugin-yarn/node_modules/node-fetch/src/index.js:9
    import http from 'node:http';
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      at new Script (node:vm:100:7)
      at Object.<anonymous> (src/index.ts:13:15)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.304s, estimated 3s
Ran all test suites.

@glensc

glensc commented Mar 22, 2022

Copy link
Copy Markdown
Contributor Author

I would re-do the fetch mocking (in a separate PR) using this package:

WDYT?

@glensc

glensc commented Oct 21, 2022

Copy link
Copy Markdown
Contributor Author

Seems the repo owner nor the original PR author are interested of my efforts. What a pity. Closing then.

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

Successfully merging this pull request may close these issues.

Improve license checker

2 participants