We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 18f6249 + 1a17870 commit 331de75Copy full SHA for 331de75
1 file changed
Nodejs/Product/Nodejs/TestFrameworks/mocha/mocha.js
@@ -79,8 +79,17 @@ function logError() {
79
}
80
81
function detectMocha(projectFolder) {
82
- try {
83
- var mochaPath = path.join(projectFolder, 'node_modules', 'mocha');
+ try {
+ var node_modulesFolder = projectFolder;
84
+ var mochaJsonPath = path.join(node_modulesFolder, 'test', 'mocha.json');
85
+ if (fs.existsSync(mochaJsonPath)) {
86
+ var opt = require(mochaJsonPath);
87
+ if (opt && opt.path) {
88
+ node_modulesFolder = path.resolve(projectFolder, opt.path);
89
+ }
90
91
+
92
+ var mochaPath = path.join(node_modulesFolder, 'node_modules', 'mocha');
93
var Mocha = new require(mochaPath);
94
return Mocha;
95
} catch (ex) {
0 commit comments