larsgw / citation.js

Citation.js converts formats like BibTeX, Wikidata JSON and ContentMine JSON to CSL-JSON to convert to other formats like APA, Vancouver and back to BibTeX.
https://citation.js.org/
MIT License
219 stars 30 forks source link

Jest builds unable to exit #190

Closed isTravis closed 4 years ago

isTravis commented 4 years ago

citation-js requires sync-request which in turn uses sync-rpc. Simply importing the citation-js package causes my CI build to fail as Jest doesn't exit and throws the following warning:

Screen Shot 2019-09-05 at 1 50 28 PM

This happens when running jest 24.5.0 on node 10.14.1. I've submitted an issue on sync-rcp here - but am unsure where in the stack this open handler needs to be addressed.

Any suggestions for working around this?

Thanks!

larsgw commented 4 years ago

I'd really like to drop the sync-request dependency for a number of reasons, although I hadn't discovered this one yet. I developed sync-fetch for this (which doesn't use a separate process for the server), however I don't want to replace it and introduce regressions without a new major version. Additionally, I'd have to drop Node 6 support probably.

isTravis commented 4 years ago

Thanks for the context. Any hope of a @x.0.0-beta in the interim?

Node 6 appears to be out of "maintenance" on the nodejs release chart since May 2019 - so a major version update that loses support for Node 6 doesn't seem like an egregious decision from my (biased) perspective 🙂

larsgw commented 4 years ago

Can you try citation-js@0.5.0-alpha.0?

isTravis commented 4 years ago

Coming from successful tests with citation-js@0.4.10 and running tests with citation-js@0.5.0-alpha.0 I get a new error in a path that seems unrelated to sync-fetch:

[0] Err TypeError: Cannot use 'in' operator to search for 'literal' in null
[0]     at correctDate (.../node_modules/@citation-js/core/lib/plugins/input/csl.js:142:24)
[0]     at correctField (.../node_modules/@citation-js/core/lib/plugins/input/csl.js:158:14)
[0]     at .../node_modules/@citation-js/core/lib/plugins/input/csl.js:183:26
[0]     at Array.map (<anonymous>)
[0]     at parseCsl (.../node_modules/@citation-js/core/lib/plugins/input/csl.js:179:15)
[0]     at Cite.format (.../node_modules/@citation-js/core/lib/Cite/get.js:21:53)
[0]     at Cite.get (.../node_modules/@citation-js/core/lib/Cite/get.js:66:23)
[0]     at get (.../server/utils/citations.js:80:6)
[0]     at tryCatch (.../node_modules/regenerator-runtime/runtime.js:45:40)
[0]     at Generator.invoke [as _invoke] (.../node_modules/regenerator-runtime/runtime.js:271:22)
[0]     at Generator.prototype.(anonymous function) [as next] (.../node_modules/regenerator-runtime/runtime.js:97:21)
[0]     at asyncGeneratorStep (.../node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
[0]     at _next (.../node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
[0]     at process._tickCallback (internal/process/next_tick.js:68:7)

Seems to come from this recent line change: https://github.com/citation-js/citation-js/commit/08da3e7f7f4772a2646272d7c31f42289e0d5164#diff-040f2ba621ded4a0338c7ba7939eeed6R191

larsgw commented 4 years ago

I've just released 0.5.0-alpha.2 with a fix. Sorry for the peer dependency warnings, I'll fix that next release.

isTravis commented 4 years ago

That did the trick! Smooth sailing on my end now.

Thanks so much!