You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (type: Boolean) - If this expression is truthy, mocking would be enabled You can use environment variables expression, for example: ${MOCKING_ENABLED}
The mocking will not be enabled. The boolean value will be checked according to how YAML works. So things like Yes, No, y, n, true, false, etc will work as expected.
However, this really only works at 'build' time and is not dynamic during runtime as the documentation seems to indicate.
I'm not sure if the intent of these plugins is supposed to be a runtime or a build time only situation. However, for me runtime is much more useful than build time as I want to be able to toggle mocking on and off with environment variables like we do with the endpoint URL specifications in handlers.
In the api documentation for the mock plugin. The document refers to the 'if' block as follows:
if (type: Boolean) - If this expression is truthy, mocking would be enabled You can use environment variables expression, for example: ${MOCKING_ENABLED}
The YAML type here is Boolean and the plugin evaluates this data but doesn't work for expressions:
const configIf = config != null && 'if' in config ? config.if : true;
So where does that leave us?
With this config:
The mocking will not be enabled. The boolean value will be checked according to how YAML works. So things like Yes, No, y, n, true, false, etc will work as expected.
However, this really only works at 'build' time and is not dynamic during runtime as the documentation seems to indicate.
With this config:
The string interpolation works for the 'build' but is hardcoded to a
string
specified in the environment variable during the build step.Results
So the result of all this is that putting ${MOCKING_ENABLED} into the yaml (as the documents say) means:
The text was updated successfully, but these errors were encountered: