FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node/test/node-api/test_async/test.js at main · fetchapi/node · GitHub
fetchapi
/
node
Public
forked from
nodejs/node
Notifications
You must be signed in to change notification settings
Fork
1
Star
0
Code
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
node
/
test
/
node-api
/
test_async
/
test.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (26 loc) · 994 Bytes
Breadcrumbs
node
/
test
/
node-api
/
test_async
/
test.js
Copy path
File metadata and controls
30 lines (26 loc) · 994 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict'
;
const
common
=
require
(
'../../common'
)
;
const
assert
=
require
(
'assert'
)
;
const
child_process
=
require
(
'child_process'
)
;
const
test_async
=
require
(
`./build/
${
common
.
buildType
}
/test_async`
)
;
const
testException
=
'test_async_cb_exception'
;
// Exception thrown from async completion callback.
// (Tested in a spawned process because the exception is fatal.)
if
(
process
.
argv
[
2
]
===
'child'
)
{
test_async
.
Test
(
1
,
{
}
,
common
.
mustCall
(
function
(
)
{
throw
new
Error
(
testException
)
;
}
)
)
;
return
;
}
const
p
=
child_process
.
spawnSync
(
process
.
execPath
,
[
__filename
,
'child'
]
)
;
assert
.
ifError
(
p
.
error
)
;
assert
.
ok
(
p
.
stderr
.
toString
(
)
.
includes
(
testException
)
)
;
// Successful async execution and completion callback.
test_async
.
Test
(
5
,
{
}
,
common
.
mustCall
(
function
(
err
,
val
)
{
assert
.
strictEqual
(
err
,
null
)
;
assert
.
strictEqual
(
val
,
10
)
;
process
.
nextTick
(
common
.
mustCall
(
)
)
;
}
)
)
;
// Async work item cancellation with callback.
test_async
.
TestCancel
(
common
.
mustCall
(
)
)
;
Back
|
FazBrowse Home
|
New Git URL