Skip to content

Commit 2630241

Browse files
update
1 parent fc28208 commit 2630241

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { test } from 'node:test';
2+
import assert from 'node:assert';
3+
4+
async function fetchValue() {
5+
return Promise.resolve(1);
6+
}
7+
8+
test("nested async tests", async (t) => {
9+
const value = await fetchValue();
10+
assert.strictEqual(value, 1, "outer assertion");
11+
await t.test("inner async", async (st) => {
12+
const inner = await fetchValue();
13+
assert.strictEqual(inner, 1, "inner assertion");
14+
});
15+
});
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import test from "tape";
22

33
async function fetchValue() {
4-
return Promise.resolve(1);
4+
return Promise.resolve(1);
55
}
66

77
test("nested async tests", async (t) => {
8-
const value = await fetchValue();
9-
t.equal(value, 1, "outer assertion");
10-
await t.test("inner async", async (st) => {
11-
const inner = await fetchValue();
12-
st.equal(inner, 1, "inner assertion");
13-
});
8+
const value = await fetchValue();
9+
t.equal(value, 1, "outer assertion");
10+
await t.test("inner async", async (st) => {
11+
const inner = await fetchValue();
12+
st.equal(inner, 1, "inner assertion");
13+
});
1414
});

0 commit comments

Comments
 (0)