Skip to content

Commit 3ff6d74

Browse files
committed
make tests more reliable
1 parent 42f971e commit 3ff6d74

File tree

20 files changed

+60
-20
lines changed

20 files changed

+60
-20
lines changed

exercises/01.advanced-tools/01.problem.annotations/src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ async function setupClient({ capabilities = {} } = {}) {
3636
EPIC_ME_DB_PATH,
3737
async [Symbol.asyncDispose]() {
3838
await client.transport?.close()
39-
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
39+
// give things a moment to release locks and whatnot
40+
await new Promise((r) => setTimeout(r, 100))
41+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {}) // ignore missing file
4042
},
4143
}
4244
}

exercises/01.advanced-tools/01.solution.annotations/src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ async function setupClient({ capabilities = {} } = {}) {
3636
EPIC_ME_DB_PATH,
3737
async [Symbol.asyncDispose]() {
3838
await client.transport?.close()
39-
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
39+
// give things a moment to release locks and whatnot
40+
await new Promise((r) => setTimeout(r, 100))
41+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {}) // ignore missing file
4042
},
4143
}
4244
}

exercises/01.advanced-tools/02.problem.structured/src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ async function setupClient({ capabilities = {} } = {}) {
3636
EPIC_ME_DB_PATH,
3737
async [Symbol.asyncDispose]() {
3838
await client.transport?.close()
39-
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
39+
// give things a moment to release locks and whatnot
40+
await new Promise((r) => setTimeout(r, 100))
41+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {}) // ignore missing file
4042
},
4143
}
4244
}

exercises/01.advanced-tools/02.solution.structured/src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ async function setupClient({ capabilities = {} } = {}) {
3636
EPIC_ME_DB_PATH,
3737
async [Symbol.asyncDispose]() {
3838
await client.transport?.close()
39-
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
39+
// give things a moment to release locks and whatnot
40+
await new Promise((r) => setTimeout(r, 100))
41+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {}) // ignore missing file
4042
},
4143
}
4244
}

exercises/02.elicitation/01.problem/src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ async function setupClient({ capabilities = {} } = {}) {
3737
EPIC_ME_DB_PATH,
3838
async [Symbol.asyncDispose]() {
3939
await client.transport?.close()
40-
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
40+
// give things a moment to release locks and whatnot
41+
await new Promise((r) => setTimeout(r, 100))
42+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {}) // ignore missing file
4143
},
4244
}
4345
}

exercises/02.elicitation/01.solution/src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ async function setupClient({ capabilities = {} } = {}) {
3737
EPIC_ME_DB_PATH,
3838
async [Symbol.asyncDispose]() {
3939
await client.transport?.close()
40-
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
40+
// give things a moment to release locks and whatnot
41+
await new Promise((r) => setTimeout(r, 100))
42+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {}) // ignore missing file
4143
},
4244
}
4345
}

exercises/03.sampling/01.problem.simple/src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ async function setupClient({ capabilities = {} } = {}) {
4242
EPIC_ME_DB_PATH,
4343
async [Symbol.asyncDispose]() {
4444
await client.transport?.close()
45-
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
45+
// give things a moment to release locks and whatnot
46+
await new Promise((r) => setTimeout(r, 100))
47+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {}) // ignore missing file
4648
},
4749
}
4850
}

exercises/03.sampling/01.solution.simple/src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ async function setupClient({ capabilities = {} } = {}) {
4242
EPIC_ME_DB_PATH,
4343
async [Symbol.asyncDispose]() {
4444
await client.transport?.close()
45-
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
45+
// give things a moment to release locks and whatnot
46+
await new Promise((r) => setTimeout(r, 100))
47+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {}) // ignore missing file
4648
},
4749
}
4850
}

exercises/03.sampling/02.problem.advanced/src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ async function setupClient({ capabilities = {} } = {}) {
4242
EPIC_ME_DB_PATH,
4343
async [Symbol.asyncDispose]() {
4444
await client.transport?.close()
45-
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
45+
// give things a moment to release locks and whatnot
46+
await new Promise((r) => setTimeout(r, 100))
47+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {}) // ignore missing file
4648
},
4749
}
4850
}

exercises/03.sampling/02.solution.advanced/src/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ async function setupClient({ capabilities = {} } = {}) {
4242
EPIC_ME_DB_PATH,
4343
async [Symbol.asyncDispose]() {
4444
await client.transport?.close()
45-
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {})
45+
// give things a moment to release locks and whatnot
46+
await new Promise((r) => setTimeout(r, 100))
47+
await fs.unlink(EPIC_ME_DB_PATH).catch(() => {}) // ignore missing file
4648
},
4749
}
4850
}

0 commit comments

Comments
 (0)