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
Unit testing. For a node.js action, locally when i run jest --quiet, if I have some core.debug in my code, it will still print out to my console. I am guessing it is because jest doesn't recognize lower level logging. Is there a way that I can set some environment variable ACTION_LOG=false to disable that? I know that setting GitHub action secret can do that, but is there a equivalent locally?
Sorry to bump an old issue, but I think this guidance doesn't work since @actions/* has moved to ESM modules.
I get,
● Test suite failed to run
TypeError: Cannot assign to read only property 'info' of object '[object Module]'
at node_modules/jest-mock/build/index.js:622:31
There are some more details in jestjs/jest#10025. I've tried various workarounds that didn't work, and ultimately resorted to manual dependency injection.
Activity
bryanmacfarlane commentedon Oct 2, 2019
The current model is for the action to emit the output and the runner to conditionally add to logs based on setting.
Can you clarify whether you want a way to silence during E2E testing or unit testing etc...?
tianhaoz95 commentedon Oct 3, 2019
Unit testing. For a
node.jsaction, locally when i runjest --quiet, if I have somecore.debugin my code, it will still print out to my console. I am guessing it is because jest doesn't recognize lower level logging. Is there a way that I can set some environment variableACTION_LOG=falseto disable that? I know that setting GitHub action secret can do that, but is there a equivalent locally?xt0rted commentedon Oct 3, 2019
I think this is a duplicate of #118
tianhaoz95 commentedon Oct 3, 2019
@xt0rted I think you are right. What is the final decision? jest config or some alternative?
ericsciple commentedon Dec 16, 2019
would mocking the core module make more sense?
ericsciple commentedon Dec 16, 2019
Example here where core is mocked out specifically to capture info.
Example here where core is mocked out to control the function results.
Users can leverage mocking tools to fit their specific needs.
bryanmacfarlane commentedon Jan 4, 2020
Assigning to myself to update docs and guidance pointing to the examples ☝️
thboop commentedon Apr 29, 2021
dupe of #118
pbrisbin commentedon Mar 25, 2026
Sorry to bump an old issue, but I think this guidance doesn't work since
@actions/*has moved to ESM modules.I get,
When I use,
There are some more details in jestjs/jest#10025. I've tried various workarounds that didn't work, and ultimately resorted to manual dependency injection.