0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
Commit Graph

25 Commits

Author SHA1 Message Date
Rich Trott
ff001c12b0 test: move WPT to its own testing module
This is first in a hoped-for series of moves away from a monolithic
common.js that is loaded for every test and towards a more modular
approach. (In the end, common.js will hopefully contain checks for
variables leaking into the global space and perhaps some of the more
ubiquitous functions like common.mustCall().)

Move the WPT testing code to its own module.

PR-URL: https://github.com/nodejs/node/pull/12736
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2017-05-03 17:00:31 -07:00
Anna Henningsen
3d87eca1e5
test,doc: document crashOnUnhandledRejection()
Add documentation for `common.crashOnUnhandledRejection()`.

Ref: a9c2078a60 (r113737423)
PR-URL: https://github.com/nodejs/node/pull/12699
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-04-29 17:22:35 +02:00
Vse Mozhet Byt
b4fea2a3d6 doc: add eslint-plugin-markdown
* install eslint-plugin-markdown
* add doc/.eslintrc.yaml
* add `<!-- eslint-disable rule -->` or `<!-- eslint-disable -->`
  for the rest of problematic code
* .js files in doc folder added to .eslintignore
* update Makefile and vcbuild.bat

PR-URL: https://github.com/nodejs/node/pull/12563
Refs: https://github.com/nodejs/node/pull/12557#issuecomment-296015032
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-04-25 00:06:17 +03:00
Rich Trott
06c29a66d4 test: remove common.fail()
common.fail() was added to paste over issues with assert.fail() function
signature. assert.fail() has been updated to accept a single argument so
common.fail() is no longer necessary.

PR-URL: https://github.com/nodejs/node/pull/12293
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-12 14:25:33 -07:00
Timothy Gu
0c539faac3 test: add common.getArrayBufferViews(buf)
PR-URL: https://github.com/nodejs/node/pull/12223
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-04-12 10:03:14 -07:00
Jan Krems
1807080d3d
doc: update information on test/known_issues
* Since https://github.com/nodejs/node/pull/6559 known_issues
  does run on CI.
* Add some notes to explain the expectations around tests in
  known_issues.

PR-URL: https://github.com/nodejs/node/pull/12262
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-04-09 21:45:58 +03:00
JR McEntee
7a5d07c7fb doc: change Mac OS X to macOS
This update changes references to "Mac OS X", "OS X", and "OSX" in
markdown files to "macOS".

PR-URL: https://github.com/nodejs/node/pull/12106
Fixes: https://github.com/nodejs/node/issues/12086
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-04 10:14:24 -07:00
James M Snell
4f2e372716 test: add common.noop, default for common.mustCall()
Export a new common.noop no-operation function for general use.
Allow using common.mustCall() without a fn argument to simplify
test cases.

Replace various non-op functions throughout tests with common.noop

PR-URL: https://github.com/nodejs/node/pull/12027
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2017-03-26 12:47:15 -07:00
Vse Mozhet Byt
2dff3a22fe test: do not use more command on Windows
PR-URL: https://github.com/nodejs/node/pull/11953
Fixes: https://github.com/nodejs/node/issues/11469
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-03-23 05:52:35 +02:00
Ben Schmidt
3c92200d8b
tty: add ref() so process.stdin.ref() etc. work
Also squashed from:
* test: move tty-wrap isrefed test to pseudo-tty/
* test: test tty-wrap handle isrefed properly
* test: improve failure messages in isrefed tests

PR-URL: https://github.com/nodejs/node/pull/7360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell.gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-02-28 18:44:05 +01:00
Rich Trott
c2e838ee13 test: change common.expectsError() signature
One downside to `common.expectsError()` is that it increases the
abstractions people have to learn about in order to work with even
simple tests. Whereas before, all they had to know about is
`assert.throws()`, now they have to *also* know about
`common.expectsError()`. This is very different (IMO) from
`common.mustCall()` in that the latter has an intuitively understandable
name, accepts arguments as one would expect, and (in most cases) doesn't
actually require reading documentation or code to figure out what it's
doing. With `common.expectsError()`, there's a fair bit of magic. Like,
it's not obvious what the first argument would be. Or the second. Or the
third. You just have to know.

This PR changes the arguments accepted by `common.expectsError()` to a
single settings object. Someone coming across this has a hope of
understanding what's going on without reading source or docs:

```js
const validatorFunction = common.expectsError({code: 'ELOOP',
                                               type: Error,
                                               message: 'foo'});
```

This, by comparison, is harder to grok:

```js
const validatorFunction = common.expectsError('ELOOP',
                                               Error,
                                               'foo');
```

And this is especially wat-inducing:

```js
common.expectsError(undefined, undefined, 'looped doodad found');
```

It's likely that only people who work with tests frequently can be
expected to remember the three arguments and their order. By comparison,
remembering that the error code is `code` and the message is `message`
might be manageable.

PR-URL: https://github.com/nodejs/node/pull/11512
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-02-27 12:29:49 -08:00
Joyee Cheung
736814e064 doc: improve test/README.md
* Add description about the test directory
* Add link to the test writing guide and the contributing guide
* Use table to describe the directory layout and CI info

PR-URL: https://github.com/nodejs/node/pull/11237
Fixes: https://github.com/nodejs/node/issues/11190
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
2017-02-17 23:50:42 +08:00
Rich Trott
b5c8852ab5 doc: add missing function to test common doc
Add documentation for `common.expectsError()` to `test/README.md`.

PR-URL: https://github.com/nodejs/node/pull/11382
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-02-16 12:46:14 -08:00
Rich Trott
3fffebbde3 doc: add common.WPT to test README
PR-URL: https://github.com/nodejs/node/pull/11127
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-05 21:17:32 -08:00
Gibson Fahnestock
dd2d3d3f9d test: use realpath for NODE_TEST_DIR in common.js
If you don't specify NODE_TEST_DIR, common.tmpDir will resolve to the
realpath of `node/test`.

If you do specify NODE_TEST_DIR (with the environment variable or by
running or by running tools/test.py --test-dir=x), common.tmpDir (which
is resolved from testRoot) uses the symbolic path (doesn't resolve
symlinks). This uses fs.realpathSync() to fix that.

PR-URL: https://github.com/nodejs/node/pull/10723
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-01-12 13:32:02 -08:00
Hitesh Kanwathirtha
ee9df357ff test, win: fix up symlink tests
On Windows, creating a symlink requires admin privileges.
There were two tests which created symlinks which were failing when run
as non-admin.

test-fs-symlink.js already had a check for privileges on Windows
but it had a couple issues:
1. It assumed that whoami was the one that came with windows.
   However, whoami also ships with Win32 Unix utility ports
   like the distribution with git, which can cause this to get check
   tripped up.
2. On failure, the check would just return from the callback instead of
   exiting
3. whoami was executed asynchronously so the test would run regardless
   of privilege state.

test-fs-options-immutable had no check.

As part of this change, I refactored the privilege checking to
a function in common, and changed both above tests to use the
refactored function.

Also documented this function in test\README.md

PR-URL: https://github.com/nodejs/node/pull/10477
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2016-12-31 22:45:23 +02:00
Rich Trott
9cfeccec45 doc: improve common.mustCall() explanation
PR-URL: https://github.com/nodejs/node/pull/10390
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Julian Duque <julianduquej@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-23 13:46:35 -08:00
Rich Trott
561eade317 test: refactor common.js
* remove unused common.faketimeCli
* remove mosly-unused common.testDir
* assert.ok(false...) -> fail()
* alphabetize list of known globals
* .indexOf() -> .includes()

PR-URL: https://github.com/nodejs/node/pull/9732
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-11-25 20:23:12 -08:00
Sam Roberts
3cbb553df8 tools: disallow trailing whitespace for markdown
markdown had a dispensation because 2 or more trailing spaces triggers a
new paragraph. There are no examples of that usage in Node, all trailing
whitespace found were mistakes, and the dispensation is now removed.

See: https://github.com/nodejs/node/pull/9620
PR-URL: https://github.com/nodejs/node/pull/9676
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2016-11-21 09:04:29 -08:00
Rich Trott
eed8b0525c test: move tick-processor tests to own directory
The tick-processor tests are inherently non-deterministic. They
therefore have false negatives from time to time. They also
sometimes leave extra processes running.

Move them to their own directory until these issues are sorted. Note
that this means that the tests will not be run in CI. Like the inspector
tests and other tests, they will have to be run manually when they are
wanted.

PR-URL: https://github.com/nodejs/node/pull/9506
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Matthew Loring <mattloring@google.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2016-11-09 19:34:56 -08:00
Rich Trott
3f05b67984 test: remove unused common.libDir
PR-URL: https://github.com/nodejs/node/pull/9124
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-10-18 15:25:45 -07:00
Paul Grock
2cfd7fd8f9 doc: add documentation for test common module
Alphabetized list of methods and properties for the common.js module.
Add table of contents to the top of the readme.

PR-URL: https://github.com/nodejs/node/pull/8840
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-10-03 15:26:10 -07:00
Eugene Ostroukhov
b4a249f66b inspector: introduce a smoke test
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>
2016-09-19 12:40:16 -07:00
Ali Ijaz Sheikh
b73e1b3c5a test: fix another flaky stringbytes test
Avoid depending on precise timing of when an object will be collected
by GC. This test was missed by #6039 as it happened to be in a
different directory than the rest.

Ref: https://github.com/nodejs/node/pull/6039
PR-URL: https://github.com/nodejs/node/pull/6073
Reviewed-By: Trott - Rich Trott <rtrott@gmail.com>
2016-04-06 06:22:40 -07:00
Michael Barrett
96af4741cd doc: document directories in test directory
PR-URL: https://github.com/nodejs/node/pull/5557
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-03-07 13:10:43 -08:00