| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2761859 commit 48a943e
22 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ var http = require('http'); | |||
| 5 | 5 | var fs = require('fs'); | |
| 6 | 6 | var fork = require('child_process').fork; | |
| 7 | 7 | var common = require('../common.js'); | |
| 8 | - var test = require('../../test/common.js'); | ||
| 8 | + var test = require('../../test/common'); | ||
| 9 | 9 | var pep = `${path.dirname(process.argv[1])}/_chunky_http_client.js`; | |
| 10 | 10 | var PIPE = test.PIPE; | |
| 11 | 11 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,18 +1,13 @@ | |||
| 1 | 1 | # Node.js Core Tests | |
| 2 | 2 | ||
| 3 | - This folder contains code and data used to test the Node.js implementation. | ||
| 3 | + This directory contains code and data used to test the Node.js implementation. | ||
| 4 | 4 | ||
| 5 | 5 | For a detailed guide on how to write tests in this | |
| 6 | 6 | directory, see [the guide on writing tests](../doc/guides/writing-tests.md). | |
| 7 | 7 | ||
| 8 | 8 | On how to run tests in this direcotry, see | |
| 9 | 9 | [the contributing guide](../CONTRIBUTING.md#step-5-test). | |
| 10 | 10 | ||
| 11 | - ## Table of Contents | ||
| 12 | - | ||
| 13 | - * [Test directories](#test-directories) | ||
| 14 | - * [Common module API](#common-module-api) | ||
| 15 | - | ||
| 16 | 11 | ## Test Directories | |
| 17 | 12 | ||
| 18 | 13 | <table> | |
@@ -48,6 +43,14 @@ On how to run tests in this direcotry, see | |||
| 48 | 43 | C++ test that is run as part of the build process. | |
| 49 | 44 | </td> | |
| 50 | 45 | </tr> | |
| 46 | + <tr> | ||
| 47 | + <td>common</td> | ||
| 48 | + <td></td> | ||
| 49 | + <td> | ||
| 50 | + Common modules shared among many tests. | ||
| 51 | + <a href="./common/README.md">[Documentation]</a> | ||
| 52 | + </td> | ||
| 53 | + </tr> | ||
| 51 | 54 | <tr> | |
| 52 | 55 | <td>debugger</td> | |
| 53 | 56 | <td>No</td> | |
@@ -158,277 +161,3 @@ On how to run tests in this direcotry, see | |||
| 158 | 161 | </tr> | |
| 159 | 162 | </tbody> | |
| 160 | 163 | </table> | |
| 161 | - | ||
| 162 | - ## Common module API | ||
| 163 | - | ||
| 164 | - The common.js module is used by tests for consistency across repeated | ||
| 165 | - tasks. It has a number of helpful functions and properties to help with | ||
| 166 | - writing tests. | ||
| 167 | - | ||
| 168 | - ### allowGlobals(...whitelist) | ||
| 169 | - * `whitelist` [<Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) Array of Globals | ||
| 170 | - * return [<Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | ||
| 171 | - | ||
| 172 | - Takes `whitelist` and concats that with predefined `knownGlobals`. | ||
| 173 | - | ||
| 174 | - ### arrayStream | ||
| 175 | - A stream to push an array into a REPL | ||
| 176 | - | ||
| 177 | - ### busyLoop(time) | ||
| 178 | - * `time` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | ||
| 179 | - | ||
| 180 | - Blocks for `time` amount of time. | ||
| 181 | - | ||
| 182 | - ### canCreateSymLink | ||
| 183 | - API to indicate whether the current running process can create | ||
| 184 | - symlinks. On Windows, this returns false if the process running | ||
| 185 | - doesn't have privileges to create symlinks (specifically | ||
| 186 | - [SeCreateSymbolicLinkPrivilege](https://msdn.microsoft.com/en-us/library/windows/desktop/bb530716(v=vs.85).aspx)). | ||
| 187 | - On non-Windows platforms, this currently returns true. | ||
| 188 | - | ||
| 189 | - ### crashOnUnhandledRejection() | ||
| 190 | - | ||
| 191 | - Installs a `process.on('unhandledRejection')` handler that crashes the process | ||
| 192 | - after a tick. This is useful for tests that use Promises and need to make sure | ||
| 193 | - no unexpected rejections occur, because currently they result in silent | ||
| 194 | - failures. | ||
| 195 | - | ||
| 196 | - ### ddCommand(filename, kilobytes) | ||
| 197 | - * return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | ||
| 198 | - | ||
| 199 | - Platform normalizes the `dd` command | ||
| 200 | - | ||
| 201 | - ### enoughTestMem | ||
| 202 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 203 | - | ||
| 204 | - Check if there is more than 1gb of total memory. | ||
| 205 | - | ||
| 206 | - ### expectsError(settings) | ||
| 207 | - * `settings` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | ||
| 208 | - with the following optional properties: | ||
| 209 | - * `code` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 210 | - expected error must have this value for its `code` property | ||
| 211 | - * `type` [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) | ||
| 212 | - expected error must be an instance of `type` | ||
| 213 | - * `message` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 214 | - or [<RegExp>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) | ||
| 215 | - if a string is provided for `message`, expected error must have it for its | ||
| 216 | - `message` property; if a regular expression is provided for `message`, the | ||
| 217 | - regular expression must match the `message` property of the expected error | ||
| 218 | - | ||
| 219 | - * return function suitable for use as a validation function passed as the second | ||
| 220 | - argument to `assert.throws()` | ||
| 221 | - | ||
| 222 | - The expected error should be [subclassed by the `internal/errors` module](https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md#api). | ||
| 223 | - | ||
| 224 | - ### expectWarning(name, expected) | ||
| 225 | - * `name` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 226 | - * `expected` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | ||
| 227 | - | ||
| 228 | - Tests whether `name` and `expected` are part of a raised warning. | ||
| 229 | - | ||
| 230 | - ## getArrayBufferViews(buf) | ||
| 231 | - * `buf` [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | ||
| 232 | - * return [<ArrayBufferView[]>](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) | ||
| 233 | - | ||
| 234 | - Returns an instance of all possible `ArrayBufferView`s of the provided Buffer. | ||
| 235 | - | ||
| 236 | - ### hasCrypto | ||
| 237 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 238 | - | ||
| 239 | - Checks for 'openssl'. | ||
| 240 | - | ||
| 241 | - ### hasFipsCrypto | ||
| 242 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 243 | - | ||
| 244 | - Checks `hasCrypto` and `crypto` with fips. | ||
| 245 | - | ||
| 246 | - ### hasIPv6 | ||
| 247 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 248 | - | ||
| 249 | - Checks whether `IPv6` is supported on this platform. | ||
| 250 | - | ||
| 251 | - ### hasMultiLocalhost | ||
| 252 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 253 | - | ||
| 254 | - Checks if there are multiple localhosts available. | ||
| 255 | - | ||
| 256 | - ### fileExists(pathname) | ||
| 257 | - * pathname [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 258 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 259 | - | ||
| 260 | - Checks if `pathname` exists | ||
| 261 | - | ||
| 262 | - ### fixturesDir | ||
| 263 | - * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 264 | - | ||
| 265 | - Path to the 'fixtures' directory. | ||
| 266 | - | ||
| 267 | - ### globalCheck | ||
| 268 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 269 | - | ||
| 270 | - Turn this off if the test should not check for global leaks. | ||
| 271 | - | ||
| 272 | - ### inFreeBSDJail | ||
| 273 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 274 | - | ||
| 275 | - Checks whether free BSD Jail is true or false. | ||
| 276 | - | ||
| 277 | - ### isAix | ||
| 278 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 279 | - | ||
| 280 | - Platform check for Advanced Interactive eXecutive (AIX). | ||
| 281 | - | ||
| 282 | - ### isAlive(pid) | ||
| 283 | - * `pid` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | ||
| 284 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 285 | - | ||
| 286 | - Attempts to 'kill' `pid` | ||
| 287 | - | ||
| 288 | - ### isFreeBSD | ||
| 289 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 290 | - | ||
| 291 | - Platform check for Free BSD. | ||
| 292 | - | ||
| 293 | - ### isLinux | ||
| 294 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 295 | - | ||
| 296 | - Platform check for Linux. | ||
| 297 | - | ||
| 298 | - ### isLinuxPPCBE | ||
| 299 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 300 | - | ||
| 301 | - Platform check for Linux on PowerPC. | ||
| 302 | - | ||
| 303 | - ### isOSX | ||
| 304 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 305 | - | ||
| 306 | - Platform check for macOS. | ||
| 307 | - | ||
| 308 | - ### isSunOS | ||
| 309 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 310 | - | ||
| 311 | - Platform check for SunOS. | ||
| 312 | - | ||
| 313 | - ### isWindows | ||
| 314 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 315 | - | ||
| 316 | - Platform check for Windows. | ||
| 317 | - | ||
| 318 | - ### isWOW64 | ||
| 319 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 320 | - | ||
| 321 | - Platform check for Windows 32-bit on Windows 64-bit. | ||
| 322 | - | ||
| 323 | - ### leakedGlobals | ||
| 324 | - * return [<Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | ||
| 325 | - | ||
| 326 | - Checks whether any globals are not on the `knownGlobals` list. | ||
| 327 | - | ||
| 328 | - ### localhostIPv4 | ||
| 329 | - * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 330 | - | ||
| 331 | - Gets IP of localhost | ||
| 332 | - | ||
| 333 | - ### localIPv6Hosts | ||
| 334 | - * return [<Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) | ||
| 335 | - | ||
| 336 | - Array of IPV6 hosts. | ||
| 337 | - | ||
| 338 | - ### mustCall([fn][, expected]) | ||
| 339 | - * fn [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) | ||
| 340 | - * expected [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1 | ||
| 341 | - * return [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) | ||
| 342 | - | ||
| 343 | - Returns a function that calls `fn`. If the returned function has not been called | ||
| 344 | - exactly `expected` number of times when the test is complete, then the test will | ||
| 345 | - fail. | ||
| 346 | - | ||
| 347 | - If `fn` is not provided, `common.noop` will be used. | ||
| 348 | - | ||
| 349 | - ### nodeProcessAborted(exitCode, signal) | ||
| 350 | - * `exitCode` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | ||
| 351 | - * `signal` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 352 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 353 | - | ||
| 354 | - Returns `true` if the exit code `exitCode` and/or signal name `signal` represent the exit code and/or signal name of a node process that aborted, `false` otherwise. | ||
| 355 | - | ||
| 356 | - ### noop | ||
| 357 | - | ||
| 358 | - A non-op `Function` that can be used for a variety of scenarios. | ||
| 359 | - | ||
| 360 | - For instance, | ||
| 361 | - | ||
| 362 | - <!-- eslint-disable strict, no-undef --> | ||
| 363 | - ```js | ||
| 364 | - const common = require('../common'); | ||
| 365 | - | ||
| 366 | - someAsyncAPI('foo', common.mustCall(common.noop)); | ||
| 367 | - ``` | ||
| 368 | - | ||
| 369 | - ### opensslCli | ||
| 370 | - * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | ||
| 371 | - | ||
| 372 | - Checks whether 'opensslCli' is supported. | ||
| 373 | - | ||
| 374 | - ### platformTimeout(ms) | ||
| 375 | - * `ms` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | ||
| 376 | - * return [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | ||
| 377 | - | ||
| 378 | - Platform normalizes timeout. | ||
| 379 | - | ||
| 380 | - ### PIPE | ||
| 381 | - * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 382 | - | ||
| 383 | - Path to the test sock. | ||
| 384 | - | ||
| 385 | - ### PORT | ||
| 386 | - * return [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = `12346` | ||
| 387 | - | ||
| 388 | - Port tests are running on. | ||
| 389 | - | ||
| 390 | - ### refreshTmpDir | ||
| 391 | - * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 392 | - | ||
| 393 | - Deletes the 'tmp' dir and recreates it | ||
| 394 | - | ||
| 395 | - ### rootDir | ||
| 396 | - * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 397 | - | ||
| 398 | - Path to the 'root' directory. either `/` or `c:\\` (windows) | ||
| 399 | - | ||
| 400 | - ### skip(msg) | ||
| 401 | - * `msg` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 402 | - | ||
| 403 | - Logs '1..0 # Skipped: ' + `msg` | ||
| 404 | - | ||
| 405 | - ### spawnPwd(options) | ||
| 406 | - * `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | ||
| 407 | - * return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | ||
| 408 | - | ||
| 409 | - Platform normalizes the `pwd` command. | ||
| 410 | - | ||
| 411 | - ### spawnSyncPwd(options) | ||
| 412 | - * `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | ||
| 413 | - * return [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | ||
| 414 | - | ||
| 415 | - Synchronous version of `spawnPwd`. | ||
| 416 | - | ||
| 417 | - ### tmpDir | ||
| 418 | - * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 419 | - | ||
| 420 | - The realpath of the 'tmp' directory. | ||
| 421 | - | ||
| 422 | - ### tmpDirName | ||
| 423 | - * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | ||
| 424 | - | ||
| 425 | - Name of the temp directory used by tests. | ||
| 426 | - | ||
| 427 | - ### WPT | ||
| 428 | - | ||
| 429 | - A port of parts of | ||
| 430 | - [W3C testharness.js](https://github.com/w3c/testharness.js) for testing the | ||
| 431 | - Node.js | ||
| 432 | - [WHATWG URL API](https://nodejs.org/api/url.html#url_the_whatwg_url_api) | ||
| 433 | - implementation with tests from | ||
| 434 | - [W3C Web Platform Tests](https://github.com/w3c/web-platform-tests). | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments