approvals / approvals/Approvals.NodeJS
Callback or promise so I can wait until visual diff editor closes before moving on to the next test?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 125
- Forks
- 46
- Avg merge
- 2m
- Merged PRs (30d)
- 16
Description
When I run my test suite and an approval test fails, it opens my reporter (p4merge). While I'm reviewing the changes, the test suite continues. Before I get a chance to approve the new received snapshot, the next test completes (also failing) and p4merge now shows the new failure. Also, my clipboard now has the command to approve the second and not the first.
One way I could see to resolve this is to have approvals.verify return a Promise that doesn't resolve until I close p4merge. I could await it in the test suite -- I may have to set an unlimited timeout, but that's fine by me.
Or, am I just using approvals.verify wrong?
Setup
const approvals = require('approvals');
const MultiReporter = approvals.reporters.MultiReporter;
approvals.configure({
reporters: [
new MultiReporter(['p4merge', 'copycommand'])
]
});
Assertion (this.page is a Puppeteer page)
const screenshot = await this.page.screenshot({ fullPage: true })
approvals.verify('features/approvals', sanitizeName(approvalName), screenshot);
Also: thanks for this tool, it's awesome!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing approvals.verify and the p4merge reporter, using the provided asynchronous screenshot and verification flow as the entry point. Determine how the reporter signals that the visual diff editor has closed and how verification is sequenced. Done means callers can wait for one review to finish before the next test proceeds, without losing the corresponding approval command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100