Comments (11)
It is also possible to mock this globally in the jest.config.js
:
const processStdoutWrite = process.stdout.write.bind(process.stdout)
process.stdout.write = (str, encoding, cb) => {
// Note: this will soon change to ::
if (!str.match(/^\#\#/)) {
return processStdoutWrite(str, encoding, cb)
}
}
from toolkit.
@ericsciple I don't think it's just as simple as mocking core. I'm using the tool-cache module and getting all the debug messages triggered by tool-cache. I can't mock @actions/core because tool-cache has its own copy of the module. (@actions/core isn't de-duped in my node_modules tree; but even if it were, that would be a pretty fragile mock to assume they would always de-dupe)
from toolkit.
Thanks for logging this issue! We will implement this (we also take PRs ;) )
from toolkit.
These log messages from tests are now causing annotations to be created when they shouldn't be. You can see an example of this in my most recent action run here https://github.com/xt0rted/slash-command-action/pull/34/checks?check_run_id=259915650#step:8:9 and here https://github.com/xt0rted/slash-command-action/pull/34/checks?check_run_id=259915650#step:8:63.
from toolkit.
@xt0rted - not related to mocking but I think proper annotations support will fix your issue. I can prioritize the first half of that work (ensuring logging warning / error output doesn't create an annotation). That's a bug and I can fix. Sound ok? #186
from toolkit.
@bryanmacfarlane I meant to post that on #163, both issues a pretty similar in their end goal.
from toolkit.
would mocking the command module make more sense?
from toolkit.
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.
from toolkit.
@jasonkarns good point regarding dedupe
from toolkit.
This is what we do in setup-go tests to mock it.
https://github.com/actions/setup-go/blob/master/__tests__/setup-go.test.ts#L49
So, you're not mocking core wit a need for understanding internal. You're getting console writes so mock that.
It's not the toolkit's role to add mocking for stdout. There's plenty of mocking frameworks that are capable of mocking stdout (as per above). Action authors should use the testing and mocking framework that suits them.
from toolkit.
Closing this as workarounds are identified and we are unlikely to add it to the toolkit in the near future.
from toolkit.
Related Issues (20)
- Tracking
- @actions/artefacts weighs 100mb. this cant be right
- Bug: `context.job` fails to take into account `jobs.<job_id>.name` value HOT 2
- https://www.facebook.com/nara.istri.jisung
- `continue-on-error` should not return `success` in ` needs_job_result`
- Make uploadZipToBlobStorage() log raw and compressed sizes ?
- Annotations using environment files
- amin HOT 1
- npm i @actions/glob
- Bug
- Spacextool
- @actions/cache tar doesn't specify --xattrs
- @actions/github hasn't been published in 8 months
- Support storing and restoring cache entries as buffers. HOT 1
- mkdir service-selling-app cd service-selling-app HOT 1
- mkdir service-selling-app
- @actions/core: Add support for full width tables and column width
- BornNk
- Plan for transition to ESM?
- actions/exec: Allow timeout on running a process
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toolkit.