summaryrefslogtreecommitdiff
path: root/test/fixtures
Commit message (Collapse)AuthorAgeFilesLines
* crypto: add cert check issued by StartCom/WoSignShigeki Ohtsu2017-03-0821-0/+390
| | | | | | | | | | | | | | | | | | | When tls client connects to the server with certification issued by either StartCom or WoSign listed in StartComAndWoSignData.inc, check notBefore of the server certificate and CERT_REVOKED error returns if it is after 00:00:00 on October 21, 2016. See for details in https://blog.mozilla.org/security/2016/10/24/distrusting-new-wosign-and-startcom-certificates/, https://security.googleblog.com/2016/10/distrusting-wosign-and-startcom.html and https://support.apple.com/en-us/HT204132 Fixes: https://github.com/nodejs/node/issues/9434 PR-URL: https://github.com/nodejs/node/pull/9469 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* repl: allow autocompletion for scoped packagesEvan Lucas2017-01-311-0/+1
| | | | | | | | | | | | | Previously, autocompletion of scoped packages was not supported by the repl due to not including the `@` character in the regular expression. PR-URL: https://github.com/nodejs/node/pull/10296 Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
* test: improvements in test fixtures symlinkedAdrian Estrada2017-01-311-6/+6
| | | | | | | | | | - using strictEqual instead equal - common dependency should be the first one - using path.join instead relative path PR-URL: https://github.com/nodejs/node/pull/10182 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>
* doc: rework tls for accuracy and claritySam Roberts2017-01-311-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Document all TLSSocket options: - All the secure context options are valid options to a secureContext - isServer modifies the default value of requestCert Describe all tls.connect() variants: - tls.connect(path) was undocumented - tls.connect(port) was underdocumented, and its relationship to tls.connect(options) was obscure Socket passed to tls.connect is user managed: - Replace https://github.com/nodejs/node/pull/8996 Add documentation to: - describe and add tests for the pfx and key variants, and describe how and when passphrase is used. - describe tls cert and ca options - describe buffer forms of tls crl option - describe tls cipher option and defaults - fix link to Crypto Constants - describe that honorCipherOrder sets SSL_OP_CIPHER_SERVER_PREFERENCE. - describe tls ecdhCurve/dhparam options - describe tls secureProtocol option - describe tls secureOptions - describe tls sessionIdContext De-deduplicate secure context docs: The secure context options were documented 4 times, making it difficult to understand where the options come from, where they are supported, and under what conditions they are used. The multiple copies were inconsistent and contradictory in their descriptions of the options, and also inconsistent in whether the options would be documented at all. Cut through this gordian knot by linking all APIs that use the secureContext options to the single source of truth about the options. PR-URL: https://github.com/nodejs/node/pull/9800 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* test: invalid package.json causes error when require()ing in directorySam Shull2016-12-262-0/+2
| | | | | | | | | | Requiring a file from a directory that contains an invalid package.json file should throw an error. PR-URL: https://github.com/nodejs/node/pull/10044 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* test: move module out of fixture directoryRich Trott2016-11-111-62/+0
| | | | | | | | | | | | | | | | | | tick-processor-base.js is a module used by three other tests. It is not a test fixture so move it out of the fixture directory. (One downside to having it in the fixture directory is that fixture code is not currently linted.) It is possible that the code in tick-processor-base.js should be integrated into common.js. This can potentially happen subsequently (and might make a reasonable good first contribution for a new contributor). PR-URL: https://github.com/nodejs/node/pull/9022 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* test: run faster and cleanup after runWyatt Preul2016-10-111-9/+15
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/8848 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Matthew Loring <mattloring@google.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
* path: fallback to process cwd when resolving drive cwdJason Ginchereau2016-10-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | The `path.resolve()` function when given just a drive letter such as "C:" tries to get a drive-specific CWD, but that isn't available in cases when the process is not launched via cmd.exe and the process CWD has not been explicitly set on that drive. This change adds a fallback to the process CWD, if the process CWD happens to be on the resolved drive letter. If the process CWD is on another drive, then a drive-specific CWD cannot be resolved and defaults to the drive's root as before. Based on experimentation, the fixed behavior matches that of other similar path resolution implementations on Windows I checked: .NET's `System.IO.Path.GetFullPath()` and Python's `os.path.abspath()`. In the automated path test cases the issue doesn't occur when the tests are run normally from cmd.exe. But it did cause an assertion when running the tests from PowerShell, that is fixed by this change. PR-URL: https://github.com/nodejs/node/pull/8541 Fixes: https://github.com/nodejs/node/issues/7215 Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* test: make test-tick-processor.js non-flakyFedor Indutny2016-10-111-0/+56
| | | | | | | | | Wait for a sought-for symbol to appear instead of just hard-killing subprocesses at 2s timeout. Fix: #4427 PR-URL: https://github.com/nodejs/node/pull/8542 Reviewed-By: Rich Trott <rtrott@gmail.com>
* inspector: introduce a smoke testEugene Ostroukhov2016-09-301-0/+10
| | | | | | | This test executes a simple debug session over the inspector protocol. PR-URL: https://github.com/nodejs/node/pull/8429 Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
* test: make crypto.timingSafeEqual test less flakynot-an-aardvark2016-09-131-0/+17
| | | | | | | | | | | | | | The `crypto.timingSafeEqual` test still seems to be a bit flaky. This makes a few changes to the test: * Separates the basic usage and the benchmarking into different tests * Moves the timing-sensitive benchmark function into a separate module, and reparses the module on every iteration of the loop to avoid shared state between timing measurements. PR-URL: https://github.com/nodejs/node/pull/8456 Reviewed-By: James M Snell <jasnell@gmail.com>
* test: increase _debugger coverageRich Trott2016-09-131-0/+18
| | | | | | | | | | | The uncaught exception test for `_debugger.js` was not exercising some code (particularly concerning `interface_.child`) because of the synchronous nature of the test. This adds an asynchronous version to increase test coverage. PR-URL: https://github.com/nodejs/node/pull/8403 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* test: refactor test-debug-signal-clusterRich Trott2016-09-091-7/+8
| | | | | | | | | | | | | Notable changes include removing one (but not all) hard-coded ports, using `common.fail()`, and tidying conditionals and assertions. PR-URL: https://github.com/nodejs/node/pull/8289 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Conflicts: test/parallel/test-debug-signal-cluster.js
* util: fix deprecated class prototypeBryan English2016-08-201-0/+3
| | | | | | | | | | | | | | | | Ensure the wrapped class prototype is exactly the unwrapped class prototype, rather than an object whose prototype is the unwrapped class prototype. This ensures that instances of the unwrapped class are instances of the wrapped class. This is useful when both a wrapped class and a factory for the unwrapped class are both exposed. Ref: https://github.com/nodejs/node/pull/8103 PR-URL: https://github.com/nodejs/node/pull/8105 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* test: add uncaught exception test for debuggerRich Trott2016-08-201-0/+16
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/8087 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com> Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
* util: support classes in util.deprecate()vladimir2016-08-102-0/+31
| | | | | | | | | | | Classes cannot be instantiated without new, but util.deprecate() uses Function.prototype.apply(). This commit uses new.target to detect constructor calls, allowing classes to be deprecated. PR-URL: https://github.com/nodejs/node/pull/7690 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* test: ensure stream preprocessing orderVse Mozhet Byt2016-08-102-0/+6
| | | | | | | | | | | | | | | Sometimes it is necessary to preprocess some initial bit of a stream data before giving the entire stream to the main processing function. Sometimes this bit should be extracted from the stream before the main processing; sometimes it should be returned to the stream. This test checks an order of stream modes, methods and events for a possible preprocessing algorithm. Stream BOM stripping is selected as a use case. See https://github.com/nodejs/help/issues/221 as the prehistory. PR-URL: https://github.com/nodejs/node/pull/7741 Reviewed-By: Anna Henningsen <anna@addaleax.net>
* test: add known issue test for #7788cjihrig2016-07-211-0/+2
| | | | | | | | | | | | | 15157c3c3d7594cefb7f5941cbe925657e7d88bd changed the CLI REPL to default to useGlobal: false by default. This caused the regression seen in https://github.com/nodejs/node/issues/7788. This commit adds a known issue test while a proper resolution is determined. Refs: https://github.com/nodejs/node/pull/5703 Refs: https://github.com/nodejs/node/issues/7788 PR-URL: https://github.com/nodejs/node/pull/7793 Reviewed-By: Rich Trott <rtrott@gmail.com>
* test: remove modifcation to common.PORTRich Trott2016-06-021-1/+1
| | | | | | | | | | | | | | | | | A possibly-buggy fixture server uses `common.PORT+1000` for its port rather than `common.PORT`. That could result in it clashing with other ports if tests are run in parallel. The test runner increments `common.PORT` by 100 for each running instance for tests. Change to use common.PORT and have the tests that use the fixture start with common.PORT+1 for anything they need. PR-URL: https://github.com/nodejs/node/pull/6990 Refs: https://github.com/nodejs/node/issues/6989 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* tools: make sure doctool anchors respect includesAnna Henningsen2016-06-023-0/+8
| | | | | | | | | | | | | | | | | Previously, output files which were created using includes (notably, the single-page all.html) had basically broken internal links all over the place because references like `errors.html#errors_class_error` are being used, yet `id` attributes were generated that looked like `all_class_error`. This PR adds generation of comments from the include preprocessor that indicate from which file the current markdown bits come and lets the HTML output generation take advantage of that so that more appropriate `id` attributes can be generated. PR-URL: https://github.com/nodejs/node/pull/6943 Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: Daniel Wang <wangyang0123@gmail.com>
* test: fix test-debugger-repl-termRich Trott2016-05-171-1/+1
| | | | | | | | | | test-debugger-repl-term had incorrect expected output and so was failing. It was likely dependent on previous bugs in the debugger. The fixture file has been modified so that the output is as expected. PR-URL: https://github.com/nodejs/node/pull/6682 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Ben Noorhduis <info@bnoordhuis.nl>
* tools: allow multiple added: version entriesAnna Henningsen2016-05-171-0/+9
| | | | | | | | | | | | | | | | Allow multiple `added:` version entries, since semver-minors can trickle down to previous major versions, and thus features may have been added in multiple versions. Also include `deprecated:` entries and apply the same logic to them for consistency. Stylize the added HTML as `Added in:` and `Deprecated since:`. PR-URL: https://github.com/nodejs/node/pull/6495 Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* test,tools: test yaml parsing of doctoolAnna Henningsen2016-05-171-0/+21
| | | | | | | | | Add checks that make sure the doctool parses metadata correctly. PR-URL: https://github.com/nodejs/node/pull/6495 Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* test: add failing url parse tests as known_issueJames M Snell2016-05-031-0/+4230
| | | | | | | | | | | | | url resolve and parse do not currently adhere to the same url spec parsing rules that browsers use, which leads to some issues. This addition to test/known_issues creates a set of tests based on the w3c/whatwg test suite from: Refs: https://github.com/w3c/web-platform-tests/tree/master/url PR-URL: https://github.com/nodejs/node/pull/5885 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* tools: add tests for the doctoolIan Kronquist2016-05-032-0/+14
| | | | | | | | | | | | | | * Test the toHTML function in html.js. Check that given valid markdown it produces the expected html. One test case will prevent regressions of #5873. * Check that when given valid markdown toJSON produces valid JSON with the expected schema. * Add doctool to the list of built in tests so it runs in CI. PR-URL: https://github.com/nodejs/node/pull/6031 Fixes: https://github.com/nodejs/node/issues/5955 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rich Trott <rtrott@gmail.com>
* module: preserve symlinks when requiringAlex Lamar2016-04-266-0/+20
| | | | | | | | | | | | | | | | | | | | Currently, required modules use the real location of the package/file as their __filename and __dirname, instead of the symlinked path if it exists. This behaviour is undocumented (it even goes against documentation in certain scenarios), creating hard-to-debug problems for developers who wish to leverage filesystem abstractions to lay out their application. This patch resolves all required modules to their canonical path while still preserving any symlinks within the path, instead of resolving to their canonical realpath. The one special case observed is when the main module is loaded -- in this case, the realpath does need to be used in order for the main module to load properly. PR-URL: https://github.com/nodejs/node/pull/5950 Reviewed-By: James M Snell <jasnell@gmail.com>
* module: fix resolution of filename with trailing slashMichaël Zasso2016-04-262-0/+4
| | | | | | | | | | | | A recent optimization of module loading performance [1] forgot to check that extensions were set in a certain code path. [1] https://github.com/nodejs/node/pull/5172/commits/ae18bbef48d87d9c641df85369f62cfd5ed8c250 Fixes: https://github.com/nodejs/node/issues/6214 PR-URL: https://github.com/nodejs/node/pull/6215 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* debugger: run last command on presssing enterRich Trott2016-04-261-0/+7
| | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/6090 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Fixes: https://github.com/nodejs/node/issues/2895
* test: update test-repl-require for local pathsMyles Borins2016-03-291-0/+1
| | | | | | | | | | | | Currently we are not testing that resolution of local paths is resolved first in the repl. This addition to `test-repl-require` adds an additional fixture an ensures we won't regress in the future PR-URL: https://github.com/nodejs/node/pull/5689 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* process: add 'warning' event and process.emitWarning()James M Snell2016-03-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In several places throughout the code we write directly to stderr to report warnings (deprecation, possible eventemitter memory leak). The current design of simply dumping the text to stderr is less than ideal. This PR introduces a new "process warnings" mechanism that emits 'warning' events on the global process object. These are invoked with a `warning` argument whose value is an Error object. By default, these warnings will be printed to stderr. This can be suppressed using the `--no-warnings` and `--no-deprecation` command line flags. For warnings, the 'warning' event will still be emitted by the process, allowing applications to handle the warnings in custom ways. The existing `--no-deprecation` flag will continue to supress all deprecation output generated by the core lib. The `--trace-warnings` command line flag will tell Node.js to print the full stack trace of warnings as part of the default handling. The existing `--no-deprecation`, `--throw-deprecation` and `--trace-deprecation` flags continue to work as they currently do, but the exact output of the warning message is modified to occur on process.nextTick(). The stack trace for the warnings and deprecations preserve and point to the correct call site. A new `process.emitWarning()` API is provided to permit userland to emit warnings and deprecations using the same consistent mechanism. Test cases and documentation are included. PR-URL: https://github.com/nodejs/node/pull/4782 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Wyatt Preul <wpreul@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* zlib: Fix handling of gzip magic bytes mid-fileAnna Henningsen2016-03-232-0/+0
| | | | | | | | | | | | | | | | | | | Only treat the gzip magic bytes, when encountered within the file after reading a single block, as the start of a new member when the previous member has ended. Add test files that reliably reproduce #5852. The gzipped file in test/fixtures/pseudo-multimember-gzip.gz contains the gzip magic bytes exactly at the position that node encounters after having read a single block, leading it to believe that a new data member is starting. Fixes: https://github.com/nodejs/node/issues/5852 PR-URL: https://github.com/nodejs/node/pull/5863 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* test: strip non-free icc profile from person.jpgJérémy Lal2016-03-212-0/+0
| | | | | | | | Fixes: https://github.com/nodejs/node/issues/5749 PR-URL: https://github.com/nodejs/node/pull/5813 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
* lib: simplify code with String.prototype.repeat()Jackson Tian2016-03-211-6/+1
| | | | | | | | | use String.prototype.repeat() to simplify code, less code, more semantically. PR-URL: https://github.com/nodejs/node/pull/5359 Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* buffer: add .from(), .alloc() and .allocUnsafe()James M Snell2016-03-162-2/+2
| | | | | | | | | | | | | | | Several changes: * Soft-Deprecate Buffer() constructors * Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()` * Add `--zero-fill-buffers` command line option * Add byteOffset and length to `new Buffer(arrayBuffer)` constructor * buffer.fill('') previously had no effect, now zero-fills * Update the docs PR-URL: https://github.com/nodejs/node/pull/4682 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
* crypto: Improve control of FIPS modeStefan Budeanu2016-02-252-0/+24
| | | | | | | | | | | | | Default to FIPS off even in FIPS builds. Add JS API to check and control FIPS mode. Add command line arguments to force FIPS on/off. Respect OPENSSL_CONF variable and read the config. Add testing for new features. Fixes: https://github.com/nodejs/node/issues/3819 PR-URL: https://github.com/nodejs/node/pull/5181 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-by: Michael Dawson <michael_dawson@ca.ibm.com>
* test: enable to work pkcs12 test in FIPS modeShigeki Ohtsu2016-02-092-0/+1
| | | | | | | | | | | The pfx file created by pkcs12 command of openssl causes an error in FIPS mode because its certificate is encrypted with RC2 by default. Adding `-descert` option resolves the error. Fix: https://github.com/nodejs/node/pull/5144 Fix: https://github.com/nodejs/node/pull/5109 PR-URL: https://github.com/nodejs/node/pull/5150 Reviewed-By: Rich Trott <rtrott@gmail.com>
* node_contextify: do not incept debug contextMyles Borins2016-02-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Currently a debug context is created for various calls to util. If the node debugger is being run the main context is the debug context. In this case node_contextify was freeing the debug context and causing everything to explode. This change moves around the logic and no longer frees the context. There is a concern about the dangling pointer The regression test was adapted from code submitted by @3y3 in #4815 Fixes: https://github.com/nodejs/node/issues/4440 Fixes: https://github.com/nodejs/node/issues/4815 Fixes: https://github.com/nodejs/node/issues/4597 Fixes: https://github.com/nodejs/node/issues/4952 PR-URL: https://github.com/nodejs/node/issues/4815 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Rich Trott <rtrott@gmail.com>
* node: allow preload modules with -iEvan Lucas2016-01-181-0/+1
| | | | | | | | | | This gives us the ability to preload when using the node repl. This can be useful for doing things like creating aliases. Fixes: https://github.com/nodejs/node/issues/4661 PR-URL: https://github.com/nodejs/node/pull/4696 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* module: cache stat() results more aggressivelyBen Noordhuis2016-01-122-0/+18
| | | | | | | | | | | | | | | | | | | Reduce the number of stat() system calls that require() makes by caching the results more aggressively. To avoid unbounded growth without implementing a LRU cache, scope the cache to the lifetime of the first call to require(). Recursive calls (i.e. require() calls in the included code) transparently profit from the cache. The benchmarked application is the loopback-sample-app[0] and it sees the number of stat calls at start-up go down by 40%, from 4736 to 2810. [0] https://github.com/strongloop/loopback-sample-app PR-URL: https://github.com/nodejs/node/pull/4575 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* repl: Fixed node repl history edge case.Mudit Ameta2015-12-221-0/+0
| | | | | | | | | | | | | | | If the deprecated NODE_REPL_HISTORY_FILE is set to default node history file path ($HOME/.node_repl_history) and the file doesn't exist, then node creates the file and then crashes when it tries to parse that file as JSON thinking that it's an older JSON formatted history file. This fixes that bug. This patch also prevents node repl from throwing if the old history file is empty or if $HOME/.node_repl_history is empty. Fixes: https://github.com/nodejs/node/issues/4102 PR-URL: https://github.com/nodejs/node/pull/4108 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* crypto: load PFX chain the same way as regular oneFedor Indutny2015-12-172-0/+8
| | | | | | | | | Load the certificate chain from the PFX file the same as we do it for a regular certificate chain. Fix: #4127 PR-URL: https://github.com/nodejs/node/pull/4165 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* test: add test for debugging one line filescjihrig2015-12-161-0/+1
| | | | | | | | | | This commit adds a regression test for debugging of single line files. Refs: https://github.com/nodejs/node/issues/4297 PR-URL: https://github.com/nodejs/node/pull/4298 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
* repl: fix require('3rdparty') regressionBen Noordhuis2015-12-091-0/+2
| | | | | | | | | | | | | | Fix module loading of third-party modules in the REPL by inheriting module.paths from the REPL's parent module. Commit ee72ee7 ("module,repl: remove repl require() hack") introduced a regression where require() of modules in node_modules directories no longer worked in the REPL (and fortunately only in the REPL.) It turns out we didn't have test coverage for that but we do now. Fixes: https://github.com/nodejs/node/issues/4208 PR-URL: https://github.com/nodejs/node/pull/4215 Reviewed-By: Roman Reiss <me@silverwind.io>
* src: don't print garbage errorscjihrig2015-12-051-0/+5
| | | | | | | | | | | | | If JS throws an object whose toString() method throws, then Node attempts to print an empty message, but actually prints garbage. This commit checks for this case, and prints a message instead. Fixes: https://github.com/nodejs/node/issues/4079 PR-URL: https://github.com/nodejs/node/pull/4112 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
* module: fix column offsets in errorsTristian Flanagan2015-11-201-0/+1
| | | | | | | | | | | | | Because Node modules are wrapped, errors on the first line of a file leak the wrapper to the user and report the wrong column number. This commit adds a line break to the module wrapper so that the first line is treated the same as all other lines. To compensate for the additional line, a line offset of -1 is also applied to errors. Fixes: https://github.com/nodejs/node/issues/2860 PR-URL: https://github.com/nodejs/node/pull/2867 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* test: add test for invalid DSA key sizeStefan Budeanu2015-11-144-1/+43
| | | | | | | | | Check that invalid DSA key sizes are rejected in FIPS mode. PR-URL: https://github.com/nodejs/node/pull/3756 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp> Reviewed-By: James M Snell <jasnell@gmail.com>
* test: stronger crypto in test fixturesStefan Budeanu2015-11-1315-147/+139
| | | | | | | | | | Several test fixtures use use weak crypto (e.g. RC4 or MD5). Rgenerated the test fixtures to be compatible with FIPS mode. PR-URL: https://github.com/nodejs/node/pull/3759 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
* src: wrap source before doing syntax checkEvan Lucas2015-10-291-0/+3
| | | | | | | | | | | | | | | | | | This is to ensure that it is evaluated the same way it would be if it were to be run by node or required. Before, the following would pass if run by node, but fail if run via the syntax check flag: if (true) { return; } Now, this will pass the syntax check PR-URL: https://github.com/nodejs/node/pull/3587 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* util: Remove p, has been deprecated for yearsWyatt Preul2015-10-191-1/+1
| | | | | | | | | Update deprecation test to use another method. Ref: https://github.com/nodejs/node/pull/2529 PR-URL: https://github.com/nodejs/node/pull/3432 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* tls: add `options` argument to createSecurePairКоренберг Марк2015-10-171-0/+0
| | | | | | | | | | | Helps in implementation of #6204, where some options passed to `createSecurePair()` are ignored before this patch. These options are very helpful if someone wants to pass `options.servername` or `options.SNICallback` to securepair. PR-URL: https://github.com/nodejs/node/pull/2441 Reviewed-By: Fedor Indutny <fedor@indutny.com>