File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed
recipes/tape-to-node-test/tests/nested-test-async Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
Original file line number Diff line number Diff line change 11import test from "tape" ;
22
33async function fetchValue ( ) {
4- return Promise . resolve ( 1 ) ;
4+ return Promise . resolve ( 1 ) ;
55}
66
77test ( "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} ) ;
You can’t perform that action at this time.
0 commit comments