@atlaskit/platform-feature-flags
Advanced tools
Comparing version 0.0.2 to 0.0.3
# @atlaskit/platform-feature-flags | ||
## 0.0.3 | ||
### Patch Changes | ||
- [`f366312e13a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f366312e13a) - Add support for toggling on all the Platform Feature Flags when running unit tests | ||
## 0.0.2 | ||
@@ -4,0 +10,0 @@ |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.debug = void 0; | ||
exports.debug = exports.TESTS_MODE = void 0; | ||
@@ -12,2 +12,3 @@ var _ref, _process, _process$env, _process2, _process2$env; | ||
var TESTS_MODE = (_ref = ((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === 'test') !== null && _ref !== void 0 ? _ref : false; | ||
exports.TESTS_MODE = TESTS_MODE; | ||
var DEBUG_MODE = !TESTS_MODE && ((_process2 = process) === null || _process2 === void 0 ? void 0 : (_process2$env = _process2.env) === null || _process2$env === void 0 ? void 0 : _process2$env.NODE_ENV) !== 'production'; | ||
@@ -14,0 +15,0 @@ |
@@ -10,4 +10,11 @@ "use strict"; | ||
var _ref, _process, _process$env; | ||
var pkgName = '@atlaskit/platform-feature-flags'; | ||
var registry = {}; | ||
var IN_TESTS_ENABLE_PLATFORM_FF = (_ref = ((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.ENABLE_PLATFORM_FF) === 'true') !== null && _ref !== void 0 ? _ref : false; // A list of property keys that are not allowed to exist on the store proxy object. | ||
var IN_TESTS_UNDEFINED_KEYS = [// Ensures we don't blow up jest when running tests. Jest is trying to be “smart” about what global variables it should clean when those are mocked. | ||
// https://github.com/facebook/jest/blob/41bf2300895a2c00d0525d21260f0a392819871f/packages/jest-runtime/src/index.ts#L1180 | ||
'_isMockFunction']; | ||
var store = new Proxy(registry, { | ||
@@ -30,2 +37,15 @@ set: function set(target, key, value) { | ||
return true; | ||
}, | ||
get: function get(target, key) { | ||
if (_debug.TESTS_MODE && IN_TESTS_ENABLE_PLATFORM_FF) { | ||
(0, _debug.debug)('[%s]: The feature flags were enabled while running tests. The flag "%s" will be always enabled.', pkgName, key); | ||
if (IN_TESTS_UNDEFINED_KEYS.includes(key)) { | ||
return undefined; | ||
} | ||
return true; | ||
} | ||
return target[key]; | ||
} | ||
@@ -32,0 +52,0 @@ }); |
{ | ||
"name": "@atlaskit/platform-feature-flags", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"sideEffects": false | ||
} |
var _ref, _process, _process$env, _process2, _process2$env; | ||
const TESTS_MODE = (_ref = ((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === 'test') !== null && _ref !== void 0 ? _ref : false; | ||
export const TESTS_MODE = (_ref = ((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === 'test') !== null && _ref !== void 0 ? _ref : false; | ||
const DEBUG_MODE = !TESTS_MODE && ((_process2 = process) === null || _process2 === void 0 ? void 0 : (_process2$env = _process2.env) === null || _process2$env === void 0 ? void 0 : _process2$env.NODE_ENV) !== 'production'; | ||
@@ -5,0 +5,0 @@ export const debug = (...args) => { |
@@ -1,4 +0,11 @@ | ||
import { debug } from './debug'; | ||
var _ref, _process, _process$env; | ||
import { debug, TESTS_MODE } from './debug'; | ||
const pkgName = '@atlaskit/platform-feature-flags'; | ||
const registry = {}; | ||
const IN_TESTS_ENABLE_PLATFORM_FF = (_ref = ((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.ENABLE_PLATFORM_FF) === 'true') !== null && _ref !== void 0 ? _ref : false; // A list of property keys that are not allowed to exist on the store proxy object. | ||
const IN_TESTS_UNDEFINED_KEYS = [// Ensures we don't blow up jest when running tests. Jest is trying to be “smart” about what global variables it should clean when those are mocked. | ||
// https://github.com/facebook/jest/blob/41bf2300895a2c00d0525d21260f0a392819871f/packages/jest-runtime/src/index.ts#L1180 | ||
'_isMockFunction']; | ||
const store = new Proxy(registry, { | ||
@@ -21,2 +28,16 @@ set(target, key, value) { | ||
return true; | ||
}, | ||
get(target, key) { | ||
if (TESTS_MODE && IN_TESTS_ENABLE_PLATFORM_FF) { | ||
debug('[%s]: The feature flags were enabled while running tests. The flag "%s" will be always enabled.', pkgName, key); | ||
if (IN_TESTS_UNDEFINED_KEYS.includes(key)) { | ||
return undefined; | ||
} | ||
return true; | ||
} | ||
return target[key]; | ||
} | ||
@@ -23,0 +44,0 @@ |
{ | ||
"name": "@atlaskit/platform-feature-flags", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"sideEffects": false | ||
} |
var _ref, _process, _process$env, _process2, _process2$env; | ||
var TESTS_MODE = (_ref = ((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === 'test') !== null && _ref !== void 0 ? _ref : false; | ||
export var TESTS_MODE = (_ref = ((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === 'test') !== null && _ref !== void 0 ? _ref : false; | ||
var DEBUG_MODE = !TESTS_MODE && ((_process2 = process) === null || _process2 === void 0 ? void 0 : (_process2$env = _process2.env) === null || _process2$env === void 0 ? void 0 : _process2$env.NODE_ENV) !== 'production'; | ||
@@ -5,0 +5,0 @@ export var debug = function debug() { |
@@ -1,4 +0,11 @@ | ||
import { debug } from './debug'; | ||
var _ref, _process, _process$env; | ||
import { debug, TESTS_MODE } from './debug'; | ||
var pkgName = '@atlaskit/platform-feature-flags'; | ||
var registry = {}; | ||
var IN_TESTS_ENABLE_PLATFORM_FF = (_ref = ((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.ENABLE_PLATFORM_FF) === 'true') !== null && _ref !== void 0 ? _ref : false; // A list of property keys that are not allowed to exist on the store proxy object. | ||
var IN_TESTS_UNDEFINED_KEYS = [// Ensures we don't blow up jest when running tests. Jest is trying to be “smart” about what global variables it should clean when those are mocked. | ||
// https://github.com/facebook/jest/blob/41bf2300895a2c00d0525d21260f0a392819871f/packages/jest-runtime/src/index.ts#L1180 | ||
'_isMockFunction']; | ||
var store = new Proxy(registry, { | ||
@@ -21,2 +28,15 @@ set: function set(target, key, value) { | ||
return true; | ||
}, | ||
get: function get(target, key) { | ||
if (TESTS_MODE && IN_TESTS_ENABLE_PLATFORM_FF) { | ||
debug('[%s]: The feature flags were enabled while running tests. The flag "%s" will be always enabled.', pkgName, key); | ||
if (IN_TESTS_UNDEFINED_KEYS.includes(key)) { | ||
return undefined; | ||
} | ||
return true; | ||
} | ||
return target[key]; | ||
} | ||
@@ -23,0 +43,0 @@ }); |
{ | ||
"name": "@atlaskit/platform-feature-flags", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"sideEffects": false | ||
} |
@@ -0,1 +1,2 @@ | ||
export declare const TESTS_MODE: boolean; | ||
export declare const debug: (...args: unknown[]) => void; |
{ | ||
"name": "@atlaskit/platform-feature-flags", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "DO NOT USE", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -11,2 +11,3 @@ <!-- API Report Version: 2.3 --> | ||
- [Main Entry Types](#main-entry-types) | ||
- [Peer Dependencies](#peer-dependencies) | ||
@@ -28,1 +29,11 @@ ### Main Entry Types | ||
<!--SECTION END: Main Entry Types--> | ||
### Peer Dependencies | ||
<!--SECTION START: Peer Dependencies--> | ||
```json | ||
{} | ||
``` | ||
<!--SECTION END: Peer Dependencies--> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14001
259