You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are different situations in work with relative and absolute paths. I didn't find an approach based only on process.cwd() or __dirname. Either of this two function has wrong situations.
In my tests, problem was:
relative path are defined in test folder
source code of vatican is in other place (process.cwd() is used in vatican.js)
If I'm in test folder and I call
mocha file.js
or
node file.js
all will be ok because `process.cwd()' point to test folder.
If I'm not in test folder and call
mocha test/file.js
or
node test/file.js
then the workflow will fail because process.cwd() point to other folder, from wich we call.
__dirname can help only if it is used in file.js (this is not the case of relative paths).
Express.js framework, in tests, does not use relative paths.
there is an option which indicate to folder with datas by an absolute path (only absolute). If this option is not setted the path is considered equal to process.cwd()
other paths from project are used directly if they are absolute and are computed from path from point 1 if they are relative.
A strategy in working with paths is very important because if project is called by crontab then this issue will raise again.
The text was updated successfully, but these errors were encountered:
There are different situations in work with relative and absolute paths. I didn't find an approach based only on
process.cwd()
or__dirname
. Either of this two function has wrong situations.In my tests, problem was:
process.cwd()
is used in vatican.js)If I'm in test folder and I call
or
all will be ok because `process.cwd()' point to test folder.
If I'm not in test folder and call
or
then the workflow will fail because
process.cwd()
point to other folder, from wich we call.__dirname
can help only if it is used infile.js
(this is not the case of relative paths).Express.js framework, in tests, does not use relative paths.
Webpack (http://webpack.github.io/docs/configuration.html ) has an interesting approach
process.cwd()
A strategy in working with paths is very important because if project is called by crontab then this issue will raise again.
The text was updated successfully, but these errors were encountered: