D
Deno

help

Sanitize multiple test steps

FFjordWarden7/9/2023
Is it possible to sanitize multiple steps inside of one test. I want to test my DB with somthing like this:
test('db', {permissions:{net:true,env:true},sanitizeOps:false,sanitizeResources:false}, async t=>{
await testDB(async sql => {
assertOk(await ddl(sql))
await sql`insert into task values ${sql(task)}`
t.step('popTask', async ()=>assertEquals((await popTask(sql)).ok[0], task))
t.step('upsertFiling', async ()=>assertOk(async()=>await upsertFiling(sql, {id:1})))
})
})
test('db', {permissions:{net:true,env:true},sanitizeOps:false,sanitizeResources:false}, async t=>{
await testDB(async sql => {
assertOk(await ddl(sql))
await sql`insert into task values ${sql(task)}`
t.step('popTask', async ()=>assertEquals((await popTask(sql)).ok[0], task))
t.step('upsertFiling', async ()=>assertOk(async()=>await upsertFiling(sql, {id:1})))
})
})
But I get this error Started test step while another test step with sanitizers was running:
FFjordWarden7/9/2023
GitHub
Deno.test t.step incorrectly identifies leaky async ops ยท Issue #19...
Deno.test tries to detect leaky async ops and error those out to the user. I believe I have found a case where deno outputs a false positive. The repro below will produce the following error Deno.t...
TTheYuriG7/10/2023
just making sure, are you awaiting the steps? actually seems like it from the code on the issue
FFjordWarden7/11/2023
No you are actually right I think, I've added the awaits and now ny sample is working
TTheYuriG7/11/2023
good to know it was an easy fix

Looking for more? Join the community!