FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node/test/simple/test-cli-eval.js at reload · wave2future/node · GitHub
wave2future
node
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
node
/
test
/
simple
/
test-cli-eval.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (23 loc) · 847 Bytes
Breadcrumbs
node
/
test
/
simple
/
test-cli-eval.js
Copy path
File metadata and controls
28 lines (23 loc) · 847 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
assert
=
require
(
'assert'
)
;
child
=
require
(
'child_process'
)
;
nodejs
=
'"'
+
process
.
execPath
+
'"'
;
if
(
module
.
parent
)
{
// signal we've been loaded as a module
console
.
log
(
'Loaded as a module, exiting with status code 42.'
)
;
process
.
exit
(
42
)
;
}
// assert that the result of the final expression is written to stdout
child
.
exec
(
nodejs
+
' --eval "1337; 42"'
,
function
(
err
,
stdout
,
stderr
)
{
assert
.
equal
(
parseInt
(
stdout
)
,
42
)
;
}
)
;
// assert that module loading works
child
.
exec
(
nodejs
+
' --eval "require(\''
+
__filename
+
'\')"'
,
function
(
status
,
stdout
,
stderr
)
{
assert
.
equal
(
status
.
code
,
42
)
;
}
)
;
// module path resolve bug, regression test
child
.
exec
(
nodejs
+
' --eval "require(\'./test/simple/test-cli-eval.js\')"'
,
function
(
status
,
stdout
,
stderr
)
{
assert
.
equal
(
status
.
code
,
42
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL