diff --git a/lib/basedriver/driver.js b/lib/basedriver/driver.js index c05cacb90..e26ca1bc2 100644 --- a/lib/basedriver/driver.js +++ b/lib/basedriver/driver.js @@ -3,6 +3,7 @@ import { } from '../protocol'; import { PROTOCOLS, DEFAULT_BASE_PATH } from '../constants'; import os from 'os'; +import path from 'path'; import commands from './commands'; import * as helpers from './helpers'; import log from './logger'; @@ -20,6 +21,7 @@ B.config({ cancellation: true, }); +const BASEDRIVER_VER = require(path.resolve(__dirname, '..', '..', '..', 'package.json')).version; const NEW_COMMAND_TIMEOUT_MS = 60 * 1000; const EVENT_SESSION_INIT = 'newSessionRequested'; @@ -30,6 +32,12 @@ const ON_UNEXPECTED_SHUTDOWN_EVENT = 'onUnexpectedShutdown'; class BaseDriver extends Protocol { + /** + * Make the basedriver version available so for any driver which inherits from this package, we + * know which version of basedriver it inherited from + */ + static baseVersion = BASEDRIVER_VER; + constructor (opts = {}, shouldValidateCaps = true) { super(); diff --git a/package.json b/package.json index a711bfcce..d40fa1bb9 100644 --- a/package.json +++ b/package.json @@ -78,12 +78,12 @@ "chai": "^4.1.2", "chai-as-promised": "^7.1.1", "content-disposition": "^0.5.0", - "eslint-config-appium": "^4.0.1", + "eslint-config-appium": "^4.7.0", "finalhandler": "^1.1.1", "gulp": "^4.0.0", "mocha": "^8.0.1", - "querystring": "^0.2.0", "pre-commit": "^1.1.3", + "querystring": "^0.2.0", "serve-static": "^1.13.1", "sinon": "^9.0.0" } diff --git a/test/basedriver/driver-tests.js b/test/basedriver/driver-tests.js index 5e1638fc1..05d36547e 100644 --- a/test/basedriver/driver-tests.js +++ b/test/basedriver/driver-tests.js @@ -29,6 +29,10 @@ function baseDriverUnitTests (DriverClass, defaultCaps = {}) { await d.deleteSession(); }); + it('should report the version of BaseDriver used', function () { + should.exist(DriverClass.baseVersion); + }); + it('should return an empty status object', async function () { let status = await d.getStatus(); status.should.eql({});