1
- // Flags: --expose-internals
1
+ // Flags: --expose-internals --no-warnings
2
2
'use strict' ;
3
3
4
- const common = require ( '../common' ) ;
4
+ const { hasCrypto } = require ( '../common' ) ;
5
5
6
6
// This tests that the accessor properties do not raise assertions
7
7
// when called with incompatible receivers.
8
8
9
9
const assert = require ( 'assert' ) ;
10
+ const { test } = require ( 'node:test' ) ;
10
11
11
12
// Objects that call StreamBase::AddMethods, when setting up
12
13
// their prototype
13
14
const { internalBinding } = require ( 'internal/test/binding' ) ;
14
- const TTY = internalBinding ( 'tty_wrap' ) . TTY ;
15
- const UDP = internalBinding ( 'udp_wrap' ) . UDP ;
15
+ const { TTY } = internalBinding ( 'tty_wrap' ) ;
16
+ const { UDP } = internalBinding ( 'udp_wrap' ) ;
16
17
17
- {
18
- // Should throw instead of raise assertions
18
+ test ( 'Should throw instead of raise assertions' , ( ) => {
19
19
assert . throws ( ( ) => {
20
20
UDP . prototype . fd ; // eslint-disable-line no-unused-expressions
21
21
} , TypeError ) ;
@@ -36,20 +36,20 @@ const UDP = internalBinding('udp_wrap').UDP;
36
36
'typeof property descriptor ' + property + ' is not \'object\''
37
37
) ;
38
38
} ) ;
39
+ } ) ;
39
40
40
- if ( common . hasCrypto ) { // eslint-disable-line node-core/crypto-check
41
- // There are accessor properties in crypto too
42
- const crypto = internalBinding ( 'crypto' ) ;
41
+ test ( 'There are accessor properties in crypto too' , { skip : ! hasCrypto } , ( ) => {
42
+ // There are accessor properties in crypto too
43
+ const crypto = internalBinding ( 'crypto' ) ; // eslint-disable-line node-core/crypto-check
43
44
44
- assert . throws ( ( ) => {
45
- // eslint-disable-next-line no-unused-expressions
46
- crypto . SecureContext . prototype . _external ;
47
- } , TypeError ) ;
45
+ assert . throws ( ( ) => {
46
+ // eslint-disable-next-line no-unused-expressions
47
+ crypto . SecureContext . prototype . _external ;
48
+ } , TypeError ) ;
48
49
49
- assert . strictEqual (
50
- typeof Object . getOwnPropertyDescriptor (
51
- crypto . SecureContext . prototype , '_external' ) ,
52
- 'object'
53
- ) ;
54
- }
55
- }
50
+ assert . strictEqual (
51
+ typeof Object . getOwnPropertyDescriptor (
52
+ crypto . SecureContext . prototype , '_external' ) ,
53
+ 'object'
54
+ ) ;
55
+ } ) ;
0 commit comments