Antoine du Hamel
3a26db9697
net: make server.address() return an integer for family
...
`dns.lookup` options only accepts integer for `family` options,
having a string doesn't really make sense here.
PR-URL: https://github.com/nodejs/node/pull/41431
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-04-12 05:50:09 +02:00
Michaël Zasso
508890d795
test: use assert.match instead of regexp.test
...
PR-URL: https://github.com/nodejs/node/pull/39928
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
2021-08-31 18:50:16 +02:00
Luigi Pinca
152d675cc6
os: add os.devNull
...
Provides the platform-specific file path of the null device.
PR-URL: https://github.com/nodejs/node/pull/38569
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-06-01 21:06:18 +02:00
Wael Almattar
a43a140ef5
test: os, replace custom flatten method with built-in Array.flat
...
PR-URL: https://github.com/nodejs/node/pull/38770
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-05-25 13:35:37 -07:00
Rongjian Zhang
35b445d089
test: improve coverage of lib/os.js
...
PR-URL: https://github.com/nodejs/node/pull/38653
Refs: https://coverage.nodejs.org/coverage-52e4fb5b23157222/lib/os.js.html#L96
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michael Dawson <midawson@redhat.com >
2021-05-14 16:07:15 -04:00
Juan José Arboleda
c1e672595f
src: create a getter for kernel version
...
PR-URL: https://github.com/nodejs/node/pull/31732
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-03-09 12:44:16 +01:00
Xu Meng
262c66a851
test: skip the unsupported test cases for IBM i
...
This is a following PR of #30714 .
PR-URL: https://github.com/nodejs/node/pull/30819
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-12-25 23:11:02 +01:00
Joyee Cheung
51cea618e2
os: do not call into JS to push values to an array in GetCPUInfo
...
Instead of calling into JS from C++ to push values into an array,
use the new Array::New API that takes a pointer and a length
directly.
PR-URL: https://github.com/nodejs/node/pull/24264
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-11-14 02:59:45 +08:00
Ruben Bridgewater
9bcb744ee5
os: improve networkInterfaces performance
...
This algorithm uses less data transformations and is therefore
significantly faster than the one before.
PR-URL: https://github.com/nodejs/node/pull/22359
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-08-20 16:10:20 +02:00
Weijia Wang
254058109f
tools: add 'spaced-comment' into eslint rules
...
PR-URL: https://github.com/nodejs/node/pull/19596
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2018-04-01 22:33:13 +08:00
Tobias Nießen
e890344d18
test: fix spelling in test case comments
...
PR-URL: https://github.com/nodejs/node/pull/18018
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
2018-01-11 16:49:38 +01:00
Mithun Sasidharan
b681d8d1a1
test: use Number.isNaN instead of global isNaN
...
PR-URL: https://github.com/nodejs/node/pull/17515
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2017-12-08 14:16:27 -05:00
Gibson Fahnestock
b5569dbe8d
test: handle blank shells in test-os.js
...
The shell in /etc/passwd can be blank, in which case the user is given
the default shell. Handle this by only checking the shell contains a
path separator if the string isn't empty.
PR-URL: https://github.com/nodejs/node/pull/16287
Fixes: https://github.com/nodejs/node/issues/15684
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2017-10-22 22:58:37 +01:00
kuroljov
7069e633ca
test: increase test coverage for os.js
...
PR-URL: https://github.com/nodejs/node/pull/14098
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-10-02 13:47:39 -04:00
Mudit Ameta
4a6b678070
os: add CIDR support
...
This patch adds support for CIDR notation to the output of the
`networkInterfaces()` method
PR-URL: https://github.com/nodejs/node/pull/14307
Fixes: https://github.com/nodejs/node/issues/14006
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
2017-08-14 15:43:10 -04:00
Rich Trott
2923ed10bb
test: improve check in test-os
...
The check for `os.networkInterfaces()` in `test-os.js` may be too
strict. It's apparently possible for a machine to be configured with
multiple IPv4 loopback interfaces. Increase specificity of filter to
check on only the object we expect.
PR-URL: https://github.com/nodejs/node/pull/14655
Fixes: https://github.com/nodejs/node/issues/14654
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-08-09 18:46:20 -07:00
Rich Trott
aa6fac68da
test: adjust indentation for stricter linting
...
ESLint 4.x has stricter linting than previous versions. We are currently
using the legacy indentation rules in the test directory. This commit
changes the indentation of files to comply with the stricter 4.x linting
and enable stricter linting in the test directory.
PR-URL: https://github.com/nodejs/node/pull/14431
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2017-07-27 09:24:20 -07:00
章礼平
fb37922cf3
test: change isAix to isAIX
...
This makes the naming more consistent with existing properties like
isFreeBSD where the capitalization of the property name is consistent
with the conventional styling of the operating system.
PR-URL: https://github.com/nodejs/node/pull/14263
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Bryan English <bryan@bryanenglish.com >
2017-07-16 02:24:47 -07:00
Vse Mozhet Byt
8b76c3e60c
test: reduce string concatenations
...
PR-URL: https://github.com/nodejs/node/pull/12735
Refs: https://github.com/nodejs/node/pull/12455
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
2017-05-05 17:39:05 +03:00
Rich Trott
a180259e42
test,lib,doc: use function declarations
...
Replace function expressions with function declarations in preparation
for a lint rule requiring function declarations.
PR-URL: https://github.com/nodejs/node/pull/12711
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
2017-05-01 15:56:58 -07:00
James M Snell
23fc082409
test: remove extra console output from test-os.js
...
PR-URL: https://github.com/nodejs/node/pull/12654
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-05-01 11:45:02 -07:00
James M Snell
473572ea25
os: refactor os structure, add Symbol.toPrimitive
...
Refactor the structure of the os module to use more efficient
module.exports = {} pattern.
Add Symbol.toPrimitive support to os methods that return simple
primitives. This is a minor tweak that makes using these slightly
more friendly when doing things like:
```js
var m = `${os.tmpdir}/foo`
```
PR-URL: https://github.com/nodejs/node/pull/12654
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2017-05-01 11:44:56 -07:00
James M Snell
98e54b0bd4
meta: restore original copyright header
...
A prior io.js era commit inappropriately removed the
original copyright statements from the source. This
restores those in any files still remaining from that
edit.
Ref: https://github.com/nodejs/TSC/issues/174
Ref: https://github.com/nodejs/node/pull/10599
PR-URL: https://github.com/nodejs/node/pull/10155
Note: This PR was required, reviewed-by and approved
by the Node.js Foundation Legal Committee and the TSC.
There is no `Approved-By:` meta data.
2017-03-10 11:23:48 -08:00
Rich Trott
a68987c154
benchmark,lib,test: adjust for linting
...
Formatting changes for upcoming linter update.
PR-URL: https://github.com/nodejs/node/pull/10561
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
2017-01-06 14:36:01 -08:00
jBarz
1c3c75dac2
os: fix os.release() for aix and add test
...
PR-URL: https://github.com/nodejs/node/pull/10245
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-12-27 14:01:49 -08:00
Mike Woods
f5d997c476
test: cleanup/update test-os.js
...
Replaced `==` with `===
Replaced `indexOf(...) !== -1` with `includes()`
PR-URL: https://github.com/nodejs/node/pull/8761
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
2016-09-30 10:57:19 -07:00
delvedor
66df5d147f
test: cleanup test-os.js
...
Moved from var to const.
Moved from .equal to .strictEqual.
Added more checks about the type of the returned values.
PR-URL: https://github.com/nodejs/node/pull/8606
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
2016-09-21 03:50:54 +03:00
Santiago Gimeno
dee0e3a333
test: use common platform helpers everywhere
...
Use the common.isWindows, common.isFreeBSD and common.isSunOS where
possible.
Add common.isOSX and common.isLinux.
Fix `test-fs-read-file-sync-hostname` as in its current form was not
being run anywhere.
PR-URL: https://github.com/nodejs/node/pull/7845
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-07-27 08:25:26 +02:00
Rich Trott
a7335bd1f0
test,benchmark: use deepStrictEqual()
...
In preparation for a lint rule that will enforce
assert.deepStrictEqual() over assert.deepEqual(), change tests and
benchmarks accordingly. For tests and benchmarks that are testing or
benchmarking assert.deepEqual() itself, apply a comment to ignore the
upcoming rule.
PR-URL: https://github.com/nodejs/node/pull/6213
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2016-04-22 14:38:09 -07:00
cjihrig
d6e56fd843
os: add userInfo() method
...
os.userInfo() calls libuv's uv_os_get_passwd() function. It returns
an object containing the current effective user's username, uid,
gid, shell, and home directory. On Windows, the uid and gid are
-1, and the shell is null.
Refs: https://github.com/nodejs/node/issues/5582
PR-URL: https://github.com/nodejs/node/pull/6104
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-04-12 17:21:29 -04:00
Rich Trott
7caeda26c8
test: fix var redeclarations in test-os
...
PR-URL: https://github.com/nodejs/node/pull/4990
Reviewed-By: Michaël Zasso <mic.besace@gmail.com >
Reviewed-By: Roman Klauke <romaaan.git@gmail.com >
Reviewed-By: Johan Bergström <bugs@bergstroem.nu >
Reviewed-By: James M Snell <jasnell@gmail.com >
2016-02-02 08:50:16 -08:00
cjihrig
6e78e5feaa
os: add homedir()
...
os.homedir() calls libuv's uv_os_homedir() to retrieve the current
user's home directory.
PR-URL: https://github.com/nodejs/io.js/pull/1791
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Rod Vagg <rod@vagg.org >
2015-06-05 22:58:14 -04:00
Roman Reiss
f29762f4dd
test: enable linting for tests
...
Enable linting for the test directory. A number of changes was made so
all tests conform the current rules used by lib and src directories. The
only exception for tests is that unreachable (dead) code is allowed.
test-fs-non-number-arguments-throw had to be excluded from the changes
because of a weird issue on Windows CI.
PR-URL: https://github.com/nodejs/io.js/pull/1721
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2015-05-19 21:21:27 +02:00
cjihrig
76937051f8
os: refine tmpdir() trailing slash stripping
...
os.tmpdir() began stripping trailing slashes in
b57cc51d8d . This causes problems if
the temp directory is simply '/'. It also stripped trailing
slashes without first determining which slash type is used by
the current operating system. This commit only strips trailing
slashes if another character precedes the slash. On Windows, it
checks for ':', as not to strip slashes from something like 'C:\'.
It also only strips slashes that are appropriate for the user's
operating system.
Fixes: https://github.com/iojs/io.js/issues/1669
PR-URL: https://github.com/iojs/io.js/pull/1673
Reviewed-By: Rod Vagg <rod@vagg.org >
Reviewed-By: Christian Tellnes <christian@tellnes.no >
2015-05-13 10:16:44 -04:00
Christian Tellnes
b57cc51d8d
os: remove trailing slash from os.tmpdir()
...
This commit makes `os.tmpdir()` behave consistently on all platforms. It
changes `os.tmpdir()` to always return a path without trailing slash.
Semver: major
Fixes: https://github.com/iojs/io.js/issues/715
PR-URL: https://github.com/iojs/io.js/pull/747
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2015-04-28 14:38:14 -07:00
isaacs
3e1b1dd4a9
Remove excessive copyright/license boilerplate
...
The copyright and license notice is already in the LICENSE file. There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00
Fedor Indutny
0e19476595
test: split test in parallel/sequential
...
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
PR-URL: https://github.com/iojs/io.js/pull/172
Fix : iojs/io.js#139
2014-12-17 20:45:02 +07:00