Closed tosbaha closed 5 years ago
I am trying to remove the cache for mocha test. When I run the below code I get the error
(node:1550) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
const glob = require('glob-promise'); const clearModule = require('clear-module'); const specs = await glob('./testfiles/*.js', { absolute: true }); console.log(specs); specs.map(spec => { clearModule(spec); mocha.addFile(spec); });
I checked more to find the error and found out that when I use following code
console.log(callerPath());
I get null. So it seems callerPath can't get the folder. I tested above code with NodeJS v10.4.1
callerPath
Ditto, I have the same issue with Node 10.
https://github.com/sindresorhus/clear-module/releases/tag/v3.1.0 should fix this. Let me know if it does not.
I am trying to remove the cache for mocha test. When I run the below code I get the error
I checked more to find the error and found out that when I use following code
I get null. So it seems
callerPath
can't get the folder. I tested above code with NodeJS v10.4.1