If I'm developing a library which work is based a lot around of current working directory and the filesystem generally, a lot of paths resolution, and I want to see how it will behave when will be installed as a node module, I don't want to get unexpected results when I'll upload it to the npm. How do I test my library behavior pretending it's a node module? Is placing its folder in node_modules
enough?
Asked
Active
Viewed 153 times
1

felps321
- 357
- 4
- 10
-
1Well, yes. After all `node_modules` are just some other code downloaded to your project and get called – Omri Attiya Dec 13 '20 at 05:45
1 Answers
1
Make a local package and install it everywhere:
$ npm pack
it will generate a zipped file, so you can copy somewhere and install it.
// another project
$ npm install /path/to/pack
Resources: npm pack, Add local package
Absolutely you can use
npm link
too. link

Raeisi
- 1,647
- 1
- 6
- 18