☕️ Classic, reliable, trusted test framework for Node.js and the browser
Add ability to query Mocha version programmatically (#3535)
P. Roebuck593e9b8f1b23
diff --git a/lib/mocha.js b/lib/mocha.jsindex 1700fe9c..e4140406 100644--- a/lib/mocha.js+++ b/lib/mocha.js@@ -677,6 +677,20 @@ Mocha.prototype.forbidPending = function() {return this;};+/**+ * Mocha version as specified by "package.json".+ *+ * @name Mocha#version+ * @type string+ * @readonly+ */+Object.defineProperty(Mocha.prototype, 'version', {+ value: require('../package').version,+ configurable: false,+ enumerable: true,+ writable: false+});+/*** Callback to be invoked when test execution is complete.*diff --git a/package-lock.json b/package-lock.jsonindex 97fdde53..72c4a6f2 100644--- a/package-lock.json+++ b/package-lock.json@@ -1316,6 +1316,12 @@"inherits": "^2.0.1"}},+ "browserify-package-json": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/browserify-package-json/-/browserify-package-json-1.0.1.tgz",+ "integrity": "sha1-mN3oqlxWH9bT/km7qhArdLOW/eo=",+ "dev": true+ },"browserify-rsa": {"version": "4.0.1","resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz",@@ -13686,6 +13692,15 @@"thunkify": "^2.1.2"}},+ "package-json-versionify": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/package-json-versionify/-/package-json-versionify-1.0.4.tgz",+ "integrity": "sha1-WGBYepRIc6a35tJujlH/siMVvxc=",+ "dev": true,+ "requires": {+ "browserify-package-json": "^1.0.0"+ }+ },"pako": {"version": "1.0.6","resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz",diff --git a/package.json b/package.jsonindex f85057cb..7b1938ff 100644--- a/package.json+++ b/package.json@@ -446,10 +446,19 @@"type": "git","url": "https://github.com/mochajs/mocha.git"},+ "bugs": {+ "url": "https://github.com/mochajs/mocha/issues/"+ },+ "homepage": "https://mochajs.org/",+ "logo": "https://cldup.com/S9uQ-cOLYz.svg","bin": {"mocha": "./bin/mocha","_mocha": "./bin/_mocha"},+ "directories": {+ "lib": "./lib",+ "test": "./test"+ },"engines": {"node": ">= 6.0.0"},@@ -502,6 +511,7 @@"markdownlint-cli": "^0.9.0","nps": "^5.7.1","nyc": "^11.7.3",+ "package-json-versionify": "^1.0.4","prettier-eslint-cli": "^4.7.1","rimraf": "^2.5.2","svgo": "^0.7.2",@@ -518,9 +528,10 @@"mocha.js","browser-entry.js"],- "directories": {- "lib": "lib",- "test": "test"+ "browserify": {+ "transform": [+ "package-json-versionify"+ ]},"browser": {"growl": "./lib/browser/growl.js",@@ -531,13 +542,8 @@"path": false,"supports-color": false},- "homepage": "https://mochajs.org/",- "logo": "https://cldup.com/S9uQ-cOLYz.svg","prettier": {"singleQuote": true,"bracketSpacing": false- },- "bugs": {- "url": "https://github.com/mochajs/mocha/issues/"}}