summaryrefslogtreecommitdiff
path: root/test/parallel/test-vm-cached-data.js
Commit message (Collapse)AuthorAgeFilesLines
* test: refactor common.expectsErrorRuben Bridgewater2019-12-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This completely refactors the `expectsError` behavior: so far it's almost identical to `assert.throws(fn, object)` in case it was used with a function as first argument. It had a magical property check that allowed to verify a functions `type` in case `type` was passed used in the validation object. This pattern is now completely removed and `assert.throws()` should be used instead. The main intent for `common.expectsError()` is to verify error cases for callback based APIs. This is now more flexible by accepting all validation possibilites that `assert.throws()` accepts as well. No magical properties exist anymore. This reduces surprising behavior for developers who are not used to the Node.js core code base. This has the side effect that `common` is used significantly less frequent. PR-URL: https://github.com/nodejs/node/pull/31092 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
* errors: improve ERR_INVALID_ARG_TYPERuben Bridgewater2019-12-201-1/+1
| | | | | | | | | | | | | | ERR_INVALID_ARG_TYPE is the most common error used throughout the code base. This improves the error message by providing more details to the user and by indicating more precisely which values are allowed ones and which ones are not. It adds the actual input to the error message in case it's a primitive. If it's a class instance, it'll print the class name instead of "object" and "falsy" or similar entries are not named "type" anymore. PR-URL: https://github.com/nodejs/node/pull/29675 Reviewed-By: Rich Trott <rtrott@gmail.com>
* vm: allow `cachedData` to also be TypedArray|DataViewBenjamin Chen2018-11-021-7/+9
| | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/22921 Refs: https://github.com/nodejs/node/issues/1826 Refs: https://github.com/nodejs/node/pull/22921#issuecomment-422350213 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
* vm: move options checks from C++ to JSMichaël Zasso2018-04-031-3/+7
| | | | | | | | | | Also introduces stronger type validations for options passed to vm functions. PR-URL: https://github.com/nodejs/node/pull/19398 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* test: remove `require('buffer')` from 4 test filesXadillaX2017-06-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | We don't use the global Buffer throughout the lib/ to avoid circular dependency issues in core, but we actually don't need to require it on test files. So remove them on: + test/parallel/test-stream-uint8array.js + test/parallel/test-stream2-finish-pipe.js + test/parallel/test-tls-session-cache.js + test/parallel/test-vm-cached-data.js Refs: https://github.com/nodejs/node/issues/13836 PR-URL: https://github.com/nodejs/node/pull/13844 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* test: reduce string concatenationsVse Mozhet Byt2017-05-051-1/+1
| | | | | | | 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>
* tools: add unescaped regexp dot rule to linterBrian White2017-03-291-1/+1
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/11834 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
* test: improve test-vm-cached-data.jsNick Peleh2017-03-241-1/+1
| | | | | | | | | | * verify error message by adding 2nd argument to throws in test-assert PR-URL: https://github.com/nodejs/node/pull/11974 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* test: s/assert.equal/assert.strictEqual/Gibson Fahnestock2017-01-111-3/+3
| | | | | | | | | | | | | Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: https://github.com/nodejs/node/pull/10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
* test: use const for all require() callscjihrig2017-01-021-2/+2
| | | | | PR-URL: https://github.com/nodejs/node/pull/10550 Reviewed-By: Rich Trott <rtrott@gmail.com>
* test: remove unneeded escaping in template stringsRich Trott2016-10-181-1/+1
| | | | | | | | | | | The no-useless-escape rule in ESLint did not previously flag certain unnecessary escaping in template strings. These will be flagged in ESLint 3.8.0. PR-URL: https://github.com/nodejs/node/pull/9112 Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
* test: fix test-vm-cached-data to work with old v8Myles Borins2016-05-111-1/+2
| | | | | | | | | | | | | While `let` no longer needs to run in `strict mode` in v8 5.x it throws in v8 4. This modification will make the test-vm-cached-data work in older version of node. Refs: https://github.com/nodejs/node/pull/6280 PR-URL: https://github.com/nodejs/node/pull/6317 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
* test: spawn new processes in vm-cached-dataFedor Indutny2016-04-201-9/+26
| | | | | | | | | | | | V8 may start caching scripts from the first run soon. Preventively execute scripts in another process to ensure no test failures due to an update in the future. See: #6258 PR-URL: https://github.com/nodejs/node/pull/6280 Reviewed-By: Jochen Eisinger <jochen@chromium.org> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
* vm: fix `produceCachedData`Jiho Choi2016-02-211-1/+10
| | | | | | | | | | | Fix segmentation faults when compiling the same code with `produceCachedData` option. V8 ignores the option when the code is in its compilation cache and does not return cached data. Added `cachedDataProduced` property to `v8.Script` to denote whether the cached data is produced successfully. PR-URL: https://github.com/nodejs/node/pull/5343 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* contextify: use offset/length from Uint8ArrayFedor Indutny2016-01-291-19/+47
| | | | | | | | | | | | | Do not blindly take data from underlying `ArrayBuffer`, use `ByteOffset`/`ByteLength` of `Uint8Array` itself. Additionally, fix tests that weren't actually properly running because of V8's internal code cache. The code should be different, otherwise the cached data won't be used at all. Fix: #4939 PR-URL: https://github.com/nodejs/node/pull/4947 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* vm: introduce `cachedData`/`produceCachedData`Fedor Indutny2016-01-241-0/+37
Introduce `cachedData`/`produceCachedData` options for `v8.Script`. Could be used to consume/produce V8's code cache for speeding up compilation of known code. PR-URL: https://github.com/nodejs/node/pull/4777 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>