Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Errors in Jest #42

Open
elado opened this issue May 31, 2018 · 2 comments
Open

Errors in Jest #42

elado opened this issue May 31, 2018 · 2 comments

Comments

@elado
Copy link

elado commented May 31, 2018

When trying to install a version of a package in jest, deasync throws

Assertion failed: (handle->type == UV_TCP || handle->type == UV_TTY ||
 handle->type == UV_NAMED_PIPE), function uv___stream_fd, file 
../deps/uv/src/unix/stream.c, line 1632.

Test code inside jest:

import niv from 'npm-install-version';
const packageName = 'noop2@1';
niv.install(packageName);
const noop = niv.require(packageName);

deasync bug @ abbr/deasync#55

Is there a workaround?

as a side note, had to add node to moduleFileExtensions in jest config
e.g. moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'node'],

@elado
Copy link
Author

elado commented May 31, 2018

Found a workaround: install the package version outside of jest's context, something like:

// package.json
"scripts": {
  "test:prepare": "niv foo@1 && niv foo@2".
  "test": "npm run test:prepare && FOO_VERSION=1 jest && FOO_VERSION=2 jest"
}

This still allows me to require a specific version

require(`foo@${process.env.FOO_VERSION}`)

@onursagir
Copy link

onursagir commented Jun 12, 2019

clearing the cache seems work for me as a work around $ jest --clearCache && jest

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

No branches or pull requests

2 participants