Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Instanceof fail with symbolic link #551

Closed
GMartigny opened this issue Aug 6, 2018 · 9 comments
Closed

Instanceof fail with symbolic link #551

GMartigny opened this issue Aug 6, 2018 · 9 comments
Labels

Comments

@GMartigny
Copy link

Hi,
I use Lerna in a multi-repo which create symbolic links between local packages. When using esm with it, tests for constructor fails. Whether you run instance instanceof Constructor or instance.constructor === Constructor, both fails.

I don't reproduce the bug when imported file aren't symbolic links.

Here's a repro-repo to demonstrate.

@dnalborczyk
Copy link
Contributor

dnalborczyk commented Aug 6, 2018

thank you @GMartigny !

just in case, could you also provide the node version you are experiencing this with as well as your operating system?

following your steps with node v10.8.0 on macOS:

To reproduce run :

npx lerna bootstrap
node
require("esm")
import "./index.js"
It should log false two time in the console instead of true.

my output is:

> require("esm")
esm enabled
> import './index.js'
instanceof false
== false
undefined

@dnalborczyk
Copy link
Contributor

dnalborczyk commented Aug 6, 2018

just reading your repo code ...

It should log false two time in the console instead of true.

I guess you mean the opposite: should log true two times in the console instead of false?

@GMartigny
Copy link
Author

I'm on Ubuntu 14.06 with node 10.6.0

Well, I meant that the script would return false when it should return true.

@dnalborczyk dnalborczyk added the bug label Aug 6, 2018
@dnalborczyk
Copy link
Contributor

@jdalton this seems to be a regression.

@GMartigny in the interim you might be able to use esm v3.0.71, your reduced repo seems to work, unless you need other bugfixes from patch 72 and above.

@GMartigny
Copy link
Author

Just for the record, esm@3.0.71 don't reproduce the bug as you've already said. However, I now have an exception while using nyc.

I'll wait for a fix then =)

@jdalton
Copy link
Member

jdalton commented Aug 6, 2018

For testing we can avoid pulling in various projects and test the root issues.
In this case symlinks fall into a couple buckets we don't have covered by tests.

  • hard links (of files and folders)
  • symlinks of folders in paths to a file
    (e.g. /a/path/this-is-a-symlink/the-file-is-not-a-symlink.js)

Update:

v3.0.75 is released 🎉

@GMartigny
Copy link
Author

Since I update to esm@3.0.75, another error pops up. This is not reproduce by my example repo tho.

When I run npx nyc ava (but not when I do npx ava) I get a bunch of TypeError: Cannot read property 'f' of undefined. Should I open another issue ?

@dnalborczyk
Copy link
Contributor

dnalborczyk commented Aug 21, 2018

Should I open another issue ?

might be better for tracking. although without a repro it might be quite difficult to pinpoint the problem.

couple things you could try prior: definitely try the very latest release version first, currently v3.0.79, as there's still quite a bit of things being ironed out with each release. If I hit an exception like you are experiencing, I also usually delete the cache files (in node_modules/.cache, or run npm ci, if you are using npm 6+, which wipes and re-installs node_modules altogether), and see if it goes away (which is not to say that it's not a bug).

@jdalton
Copy link
Member

jdalton commented Jan 29, 2019

Moving needs tests label to #717 and moving forward with that issue while locking this issue.

@standard-things standard-things locked as resolved and limited conversation to collaborators Jan 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants