The object that you want to block from being converted into a trackable dynamic object
The original value
// This is a valid "extension", but it is technically an object
// So when included in the config.extensions it WILL be cloned and then
// converted into a dynamic object, where all of its properties will become
// get/set object properties and will be tracked. While this WILL still
// function, when attempt to use a mocking framework on top of this the
// functions are now technically get accessors which return a function
// and this can cause some mocking frameworks to fail.
let mockChannel = {
pause: () => { },
resume: () => { },
teardown: () => { },
flush: (async: any, callBack: any) => { },
processTelemetry: (env: any) => { },
setNextPlugin: (next: any) => { },
initialize: (config: any, core: any, extensions: any) => { },
identifier: "testChannel",
priority: 1003
};
Mark the provided value so that if it's included into the configuration it will NOT have its properties converted into a dynamic (reactive) object. If the object is not a plain object or an array (ie. a class) this function has not affect as only Objects and Arrays are converted into dynamic objects in the dynamic configuration.
When you have tagged a value as both forceDynamicConversion and blocked force will take precedence.
You should only need to use this function, if you are creating dynamic "classes" from objects which confirm to the require interface. A common case for this is during unit testing where it's easier to create mock extensions.
If
value
is falsy (null / undefined / 0 / empty string etc) it will not be tagged and if there is an exception adding the property to the value (because its frozen etc) the exception will be swallowed