We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test.meta
In last release (1.1.0) there was added test.meta feature.
I'd like to propose test.meta.currentTest which points to the current test instance. Use case:
test.meta.currentTest
-const compare = (t, entries, goal) => { +const compare = (entries, goal) => { + const t = test.meta.currentTest; if (Array.isArray(entries)) { entries = entries.map(entry => { t.true(typeof entry.expires === 'number'); return { address: entry.address, family: entry.family }; }); } else { delete entries.expires; } t.deepEqual(entries, goal); }; test('demo', t => { const entries = getEntries(); - compare(t, entries, [ + compare(entries, [ {address: '1.2.3.4', family: 4}, {address: } ]); });
The text was updated successfully, but these errors were encountered:
I don't think that would work for asynchronous tests: multiple tests would be running concurrently so there wouldn't be any one currentTest.
currentTest
Besides the code sample, could you elaborate on your use case?
Sorry, something went wrong.
Hmm, that's true, unfortunately.
You just need to pass the test instance every time, which is quite irritating. I often did compare(entries, ...) instead of compare(t, entries, ...).
compare(entries, ...)
compare(t, entries, ...)
We are open to being able to install additional assertions on t: #1094
t
@novemberborn That whould be the right thing :)
No branches or pull requests
In last release (1.1.0) there was added
test.meta
feature.I'd like to propose
test.meta.currentTest
which points to the current test instance. Use case:The text was updated successfully, but these errors were encountered: