Adding dependencies in package.json of an express project

Assume the following scenario. Suppose I am developing an express project named test. In that project I am using a node module named x. x uses another module named y. I have already added x to the dependencies of package.json of project test. Do I need to add y too? Simple intuition says I don't need to but it's causing me problem. Any help?

To answer your question, yes you need to add y. From what I understand, it works the other way around. If you have y already installed as your projects dependency, x won't need to install it as its dependency.

Node looks at the upper level directories (before looking at the current directory) if there are present node_modules folders, and searches them if the module you are looking for is already present.