In one of my NodeJS modules I need to access a file that is part of the module in an own folder (for unit tests). It tried __dirname
in the calling file with a relative path to that resource file. This works when running from within vscode, but not whe executing npm test
in a terminal. In that case the constructed path is one level off. How can that be? Is the __dirname
value different, depending on the environment the execution starts?
via Mike Lischke
No comments:
Post a Comment