Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(node:1550) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object #3

Closed
tosbaha opened this issue Jun 24, 2018 · 2 comments

Comments

@tosbaha
Copy link

tosbaha commented Jun 24, 2018

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

@thetutlage
Copy link

Ditto, I have the same issue with Node 10.

@sindresorhus
Copy link
Owner

https://github.com/sindresorhus/clear-module/releases/tag/v3.1.0 should fix this. Let me know if it does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants