Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: migrated test/message to JS fixture tests #47868

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ tools/test.py child-process
```

You can also execute the tests in a test suite directory
(such as `test/message`):
(such as `test/report`):

```bash
tools/test.py test/message
```text
$ tools/test.py test/report
```

If you want to check the other options, please refer to the help by using
Expand All @@ -347,7 +347,7 @@ tools/test.py --help
```

> Note: On Windows you should use `python3` executable.
> Example: `python3 tools/test.py test/message`
> Example: `python3 tools/test.py test/report`

You can usually run tests directly with node:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

require('../common');
require('../../common');
const assert = require('assert').strict;

assert.throws(() => { throw new Error('foo'); }, { bar: true });
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
- Comparison {
- bar: true
- }
at Object.<anonymous> (*assert_throws_stack.js:*:*)
at *
at *
at *
at *
at *
Expand All @@ -19,16 +20,16 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: Error: foo
at assert.throws.bar (*assert_throws_stack.js:*)
at getActual (node:assert:*)
at Function.throws (node:assert:*)
at Object.<anonymous> (*assert_throws_stack.js:*:*)
at *
at *
at *
at *
at *
at *,
at *
at *
at *
at *
at node:internal*main*run_main_module:*:*,
expected: { bar: true },
operator: 'throws'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

// Flags: --expose-internals
require('../common');
require('../../common');

const assert = require('internal/assert');
assert(false);
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
node:internal/assert:*
node:internal*assert:*
throw new ERR_INTERNAL_ASSERTION(message);
^

Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
Please open an issue with this stack trace at https:*github.com*nodejs*node*issues

at new NodeError (node:internal/errors:*:*)
at assert (node:internal/assert:*:*)
at * (*test*message*internal_assert.js:7:1)
at *
at *
at *
at *
at *
at *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

// Flags: --expose-internals
require('../common');
require('../../common');

const assert = require('internal/assert');
assert.fail('Unreachable!');
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
node:internal/assert:*
node:internal*assert:*
throw new ERR_INTERNAL_ASSERTION(message);
^

Error [ERR_INTERNAL_ASSERTION]: Unreachable!
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
Please open an issue with this stack trace at https:*github.com*nodejs*node*issues

at new NodeError (node:internal/errors:*:*)
at Function.fail (node:internal/assert:*:*)
at * (*test*message*internal_assert_fail.js:7:8)
at *
at *
at *
at *
at *
at *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
require('../common');
require('../../common');
MoLow marked this conversation as resolved.
Show resolved Hide resolved
Error.stackTraceLimit = 3;

const punycode = require('punycode');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

'use strict';

require('../common');
require('../../common');

const spawn = require('child_process').spawn;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

'use strict';

require('../common');
require('../../common');

const spawn = require('child_process').spawn;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

require('../common');
require('../../common');
Error.stackTraceLimit = 4;

const assert = require('assert');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ node:assert:*
^

AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
at z (*if-error-has-good-stack.js:*:*
at z (*if-error-has-good-stack.js:*:*)
at y (*if-error-has-good-stack.js:*:*)
at x (*if-error-has-good-stack.js:*:*)
at Object.<anonymous> (*if-error-has-good-stack.js:*:*)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Flags: --no-extra-info-on-fatal-exception

'use strict';
require('../common');
require('../../common');
Error.stackTraceLimit = 1;

throw new Error('foo');
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';
require('../common');

require('../../common');

throw { // eslint-disable-line no-throw-literal
get stack() {
throw new Error('weird throw but ok');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
require('../../common');

// eslint-disable-next-line no-throw-literal
throw null;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
require('../../common');

// eslint-disable-next-line no-throw-literal
throw undefined;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
require('../../common');

setTimeout(function() {
// eslint-disable-next-line no-undef,no-unused-expressions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
require('../../common');
const vm = require('vm');

console.error('before');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

require('../common');
require('../../common');

const { inspect } = require('util');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

require('../common');
require('../../common');
const util = require('util');

const err = new Error('foo\nbar');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{ err:
Error: foo
bar
at *util_inspect_error*
at *
at *
at *
at *
at *
at *
at node:internal*main*run_main_module:*:*,
nested:
{ err:
Error: foo
bar
at *util_inspect_error*
at *
at *
at *
at *
at *
at *
at node:internal*main*run_main_module:*:* } }
{
err: Error: foo
bar
at *util_inspect_error*
at *
at *
at *
at *
at *
at *
at node:internal*main*run_main_module:*:*,
nested: {
err: Error: foo
bar
at *util_inspect_error*
at *
at *
at *
at *
Expand All @@ -43,7 +43,7 @@
}
{ Error: foo
bar
at *util_inspect_error*
at *
at *
at *
at *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

require('../common');
require('../../common');

function AsmModule() {
'use asm';
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/map/source_map_enclosing_function.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Flags: --enable-source-maps
MoLow marked this conversation as resolved.
Show resolved Hide resolved

'use strict';
require('../../common');
Error.stackTraceLimit = 5;

require('../source-map/enclosing-call-site-min.js');
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
throw err
^


Error: an error!
at functionD (*enclosing-call-site.js:16:17)
at functionC (*enclosing-call-site.js:10:3)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Flags: --enable-source-maps

'use strict';
require('../common');
require('../../common');
Error.stackTraceLimit = 2;

require('../fixtures/source-map/tabs.js');
require('../source-map/tabs.js');
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Flags: --enable-source-maps

'use strict';
require('../common');
require('../../common');
Error.stackTraceLimit = 2;

try {
require('../fixtures/source-map/typescript-sourcemapping_url_string');
require('../source-map/typescript-sourcemapping_url_string');
} catch (err) {
setTimeout(() => {
console.info(err);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Flags: --enable-source-maps

'use strict';
require('../common');
require('../../common');
Error.stackTraceLimit = 2;

try {
require('../fixtures/source-map/typescript-throw');
require('../source-map/typescript-throw');
} catch (err) {
setTimeout(() => {
console.info(err);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Flags: --enable-source-maps

'use strict';
require('../common');
require('../../common');
Error.stackTraceLimit = 2;

require('../fixtures/source-map/icu');
require('../source-map/icu');
5 changes: 5 additions & 0 deletions test/fixtures/map/source_map_throw_set_immediate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Flags: --enable-source-maps

'use strict';
require('../../common');
require('../source-map/uglify-throw');
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Flags: --unhandled-rejections=warn-with-error-code
'use strict';

require('../common');
require('../../common');
const assert = require('assert');

Promise.reject(new Error('alas'));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Flags: --trace-warnings --unhandled-rejections=warn
'use strict';
require('../common');
require('../../common');
const p = Promise.reject(new Error('This was rejected'));
setImmediate(() => p.catch(() => {}));
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
require('../../common');

process.maxTickDepth = 10;
let i = 20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
require('../../common');

process.nextTick(function() {
process.nextTick(function() {
Expand Down
Loading