Skip to content

Commit 04ea861

Browse files
Gianluca Cironeclayreimann
Gianluca Cirone
authored andcommitted
#87 Couldn't determine Mocha version
- Resolve mocha package to determinate the version used
1 parent 239e456 commit 04ea861

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.c9/
2+
.idea/
23
node_modules/
34
test/subdir/
45
test/*.xml

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var mocha6plus;
1414

1515
try {
1616
var json = JSON.parse(
17-
fs.readFileSync("./node_modules/mocha/package.json", "utf8")
17+
fs.readFileSync(path.dirname(require.resolve('mocha')) + "/package.json", "utf8")
1818
);
1919
var version = json.version;
2020
if (version >= "6") {
@@ -24,6 +24,7 @@ try {
2424
mocha6plus = false;
2525
}
2626
} catch (e) {
27+
// eslint-disable-next-line no-console
2728
console.warn("Couldn't determine Mocha version");
2829
}
2930
module.exports = MochaJUnitReporter;

0 commit comments

Comments
 (0)