FjordWarden
FjordWarden2y ago

Sanitize multiple test steps

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:
4 Replies
FjordWarden
FjordWardenOP2y ago
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...
TheYuriG
TheYuriG2y ago
just making sure, are you awaiting the steps? actually seems like it from the code on the issue
FjordWarden
FjordWardenOP2y ago
No you are actually right I think, I've added the awaits and now ny sample is working
TheYuriG
TheYuriG2y ago
good to know it was an easy fix

Did you find this page helpful?