diff --git a/src/__tests__/LDClient-test.js b/src/__tests__/LDClient-test.js index aada71a3..224edbea 100644 --- a/src/__tests__/LDClient-test.js +++ b/src/__tests__/LDClient-test.js @@ -2,6 +2,7 @@ import sinon from 'sinon'; import * as common from 'launchdarkly-js-sdk-common'; import * as LDClient from '../index'; +import * as pkg from '../../package.json'; describe('LDClient', () => { const envName = 'UNKNOWN_ENVIRONMENT_ID'; @@ -30,6 +31,10 @@ describe('LDClient', () => { expect(LDClient).toBeDefined(); }); + it('should return current version', () => { + expect(LDClient.version).toEqual(pkg.version); + }); + describe('initialization', () => { it('should trigger the ready event', async () => { const client = LDClient.initialize(envName, user, { bootstrap: {}, sendEvents: false }); diff --git a/src/index.js b/src/index.js index 8c00ef3a..92995e20 100644 --- a/src/index.js +++ b/src/index.js @@ -56,7 +56,7 @@ export function initialize(env, user, options = {}) { export const createConsoleLogger = common.createConsoleLogger; -export const version = common.version; +export const version = VERSION; function deprecatedInitialize(env, user, options = {}) { console && console.warn && console.warn(common.messages.deprecated('default export', 'named LDClient export'));