Skip to content
This repository has been archived by the owner on Jun 11, 2020. It is now read-only.

feat(definition-parser): include package name in error #788

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

peterblazejewicz
Copy link
Contributor

This proposed change is intended to allow developers quickly figure out
the real reason of getTypingInfo failing due to version mismatch.
Current error message and related stack trace does not contain a clue
about the package failing and with the context of DT repository and
local development artifacts, this removes the problem with definition
parser failing on the stale data from local repository (non tracked
folders, etc).

Thanks!

@peterblazejewicz
Copy link
Contributor Author

peterblazejewicz commented May 25, 2020

sample for the context, here is an output of the DT npm test failing with local dev artifacts from other package (not one under test), the package under test is 'abc':

npm test

> definitely-typed@0.0.3 test /Users/piotrblazejewicz/git/DefinitelyTyped
> node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed

Clean data
Clean logs
Clean output
Using local Definitely Typed at /Users/piotrblazejewicz/git/DefinitelyTyped.
Parsing definitions...
Found 6791 packages.
Parsing in parallel...
Error: The latest version is 2.2, so the subdirectory 'v2' is not allowed; since it applies to any 2.* version, up to and including 2.2.
    at /Users/piotrblazejewicz/git/DefinitelyTyped/node_modules/types-publisher/bin/lib/definition-parser.js:31:19
    at Array.map (<anonymous>)
    at Object.getTypingInfo (/Users/piotrblazejewicz/git/DefinitelyTyped/node_modules/types-publisher/bin/lib/definition-parser.js:28:43)
    at /Users/piotrblazejewicz/git/DefinitelyTyped/node_modules/types-publisher/bin/lib/definition-parser-worker.js:17:50
    at Object.logUncaughtErrors (/Users/piotrblazejewicz/git/DefinitelyTyped/node_modules/types-publisher/bin/util/util.js:78:38)
    at process.<anonymous> (/Users/piotrblazejewicz/git/DefinitelyTyped/node_modules/types-publisher/bin/lib/definition-parser-worker.js:15:16)
    at process.emit (events.js:210:5)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
Error: Parsing failed.
    at fail (/Users/piotrblazejewicz/git/DefinitelyTyped/node_modules/types-publisher/bin/util/util.js:272:20)
    at ChildProcess.<anonymous> (/Users/piotrblazejewicz/git/DefinitelyTyped/node_modules/types-publisher/bin/util/util.js:261:21)
    at ChildProcess.emit (events.js:210:5)
    at finish (internal/child_process.js:861:14)
    at processTicksAndRejections (internal/process/task_queues.js:75:11)
npm ERR! Test failed.  See above for more details.

the stack trace has no notion of the package being parsed.
Only after the change, one could see that other package (not one under test), was the culprit:

...
Parsing in parallel...
Error: The latest version of the 'terser-webpack-plugin' package is 2.2, so the subdirectory 'v2' is not allowed; since it applies to any 2.* version, up to and including 2.2.
    at /Users/piotrblazejewicz/git/DefinitelyTyped/node_modules/types-publisher/bin/lib/definition-parser.js:31:19
    at Array.map (<anonymous>)
...

after seeing correct report I could issue:

git clean -fxd

to clean local artifacts, install dependencies and run tests again.

This proposed change is intended to allow developers quickly figure out
the real reason of `getTypingInfo` failing due to version mismatch.
Current error message and related stack trace does not contain a clue
about the package failing and with the context of DT repository and
local development artifacts, this removes the problem with definition
parser failing on the stale data from local repository (non tracked
folders, etc).

Thanks!
Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll port this to DefinitelyTyped-tools.

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

Successfully merging this pull request may close these issues.

None yet

2 participants