Can group initialization be asynchronous?
See original GitHub issueIn my test case, I want to create multiple instances of a model in a database. And run a separate test for each:
test.group('Status code must mee 2xx or 3xx', async (group) => {
let links = await ShortLinkFactory.createMany(50)
links.forEach(link => {
test(link.id, async (assert) => {
await supertest(link.url)
.get('/')
.expect((res) => {
assert.isAbove(res.statusCode, 200)
assert.isBelow(res.statusCode, 400)
})
})
})
})
Of course I can do everything in one test, but then I do not get a beautiful and convenient log that conveniently displays which links returned the expected result and which failed
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Use synchronous or asynchronous initialization - Optimizely
Initializing a client asynchronously executes like the synchronous initialization, except the manager will first attempt to download the newest datafile.
Read more >c# - How to initialize an object using async-await pattern
And here comes the problem, with the initial value. Since the ImportantValue is calculated asynchronously, the class cannot be fully initialized in constructor....
Read more >Initialize Databases Asynchronously - Sybase Infocenter - SAP
The asynchronous initialization is performed by a service task that is started by the create database or alter database command. When it restarts,...
Read more >Use AsyncPackage to load VSPackages in the background
If the caller uses IAsyncServiceProvider to asynchronously query for your service, then your load and initialization will be done asynchronously ...
Read more >swift-evolution/0317-async-let.md at main - GitHub
While task groups are indeed very powerful, they are hard to use with heterogeneous results and step-by-step initialization patterns. The following example, an ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The groups cannot be asynchronous right now. Once, we all move to ESM + top level await, then this is will possible automatically without changing anything in Japa.
However, what you are trying to do is a better fit for datasets. Datasets are coming in the next version. Following is an example code for the same.
The above test will run for 50 times.
The newer version has datasets for this exact use case. Here are the docs https://japa.dev/datasets
Closing it for now.