Skip to content

Commit 117166d

Browse files
committed
tests(console): add tests for PR #300
1 parent 747c642 commit 117166d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/js/util-module.simple

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @file util-module.simple
3+
* Simple test for the builtin util module
4+
* @author Tom Tang <[email protected]>
5+
* @date March 2024
6+
*/
7+
8+
const util = require('util');
9+
10+
// https://github.com/Distributive-Network/PythonMonkey/pull/300
11+
const err = new TypeError();
12+
if (err.propertyIsEnumerable('stack'))
13+
throw new Error('The stack property should not be enumerable.');
14+
err.anything = 123;
15+
err.stack = 'abc';
16+
if (!err.propertyIsEnumerable('stack'))
17+
throw new Error('In SpiderMonkey, the stack property should be enumerable after changing it.');
18+
const output = util.format(err);
19+
if (output.match(/abc/g).length !== 1) // should only be printed once
20+
throw new Error('The stack property should not be printed along with other enumerable properties');

0 commit comments

Comments
 (0)