Skip to content

Commit 15cd45c

Browse files
committed
test: fix tests for non-crypto builds
Fix running the tests when node was compiled without crypto support. Some of these are cleanup after 52bae22, where common was used before it was required. PR-URL: #7056 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent d9e0d8b commit 15cd45c

22 files changed

+101
-20
lines changed

test/parallel/test-async-wrap-check-providers.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
49
const assert = require('assert');
510
const crypto = require('crypto');
611
const dgram = require('dgram');

test/parallel/test-async-wrap-post-did-throw.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
22

3-
require('../common');
3+
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
49
const assert = require('assert');
510
const async_wrap = process.binding('async_wrap');
611
var asyncThrows = 0;

test/parallel/test-async-wrap-throw-from-callback.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
22

3-
require('../common');
3+
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
49
const async_wrap = process.binding('async_wrap');
510
const assert = require('assert');
611
const crypto = require('crypto');

test/parallel/test-crypto-rsa-dsa.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
var common = require('../common');
33
var assert = require('assert');
44
var fs = require('fs');
5-
var constants = require('crypto').constants;
65

76
if (!common.hasCrypto) {
87
common.skip('missing crypto');
98
return;
109
}
10+
var constants = require('crypto').constants;
1111
var crypto = require('crypto');
1212

1313
// Test certificates

test/parallel/test-http-invalid-urls.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
22

3-
require('../common');
3+
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
49
const assert = require('assert');
510
const http = require('http');
611
const https = require('https');

test/parallel/test-https-agent-getname.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
22

3-
require('../common');
3+
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
49
const assert = require('assert');
510
const https = require('https');
611

test/parallel/test-https-connect-address-family.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
'use strict';
22
const common = require('../common');
3+
if (!common.hasCrypto) {
4+
common.skip('missing crypto');
5+
return;
6+
}
7+
38
const assert = require('assert');
49
const https = require('https');
510

test/parallel/test-https-resume-after-renew.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
'use strict';
2-
var common = require('../common');
2+
const common = require('../common');
3+
if (!common.hasCrypto) {
4+
common.skip('missing crypto');
5+
return;
6+
}
7+
38
var fs = require('fs');
49
var https = require('https');
510
var crypto = require('crypto');

test/parallel/test-net-access-byteswritten.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
'use strict';
22

3-
require('../common');
3+
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
48
const assert = require('assert');
59
const net = require('net');
610
const tls = require('tls');

test/parallel/test-npm-install.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
'use strict';
22
const common = require('../common');
3+
if (!common.hasCrypto) {
4+
common.skip('missing crypto');
5+
return;
6+
}
37

48
const path = require('path');
59
const spawn = require('child_process').spawn;

test/parallel/test-stream-base-no-abort.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
'use strict';
22

3+
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
39
const async_wrap = process.binding('async_wrap');
410
const uv = process.binding('uv');
511
const assert = require('assert');
6-
const common = require('../common');
712
const dgram = require('dgram');
813
const fs = require('fs');
914
const net = require('net');

test/parallel/test-tls-async-cb-after-socket-end.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
'use strict';
22

3-
var common = require('../common');
4-
5-
var path = require('path');
6-
var fs = require('fs');
7-
const SSL_OP_NO_TICKET = require('crypto').constants.SSL_OP_NO_TICKET;
8-
3+
const common = require('../common');
94
if (!common.hasCrypto) {
105
common.skip('missing crypto');
116
return;
127
}
138

9+
const path = require('path');
10+
const fs = require('fs');
11+
const SSL_OP_NO_TICKET = require('crypto').constants.SSL_OP_NO_TICKET;
12+
1413
var tls = require('tls');
1514

1615
var options = {

test/parallel/test-tls-basic-validations.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
22

3-
require('../common');
3+
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
49
const assert = require('assert');
510
const tls = require('tls');
611

test/parallel/test-tls-connect-address-family.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
'use strict';
22
const common = require('../common');
3+
if (!common.hasCrypto) {
4+
common.skip('missing crypto');
5+
return;
6+
}
7+
38
const assert = require('assert');
49
const tls = require('tls');
510

test/parallel/test-tls-connect-stream-writes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
'use strict';
22
const common = require('../common');
3+
if (!common.hasCrypto) {
4+
common.skip('missing crypto');
5+
return;
6+
}
7+
38
const assert = require('assert');
49
const fs = require('fs');
510
const tls = require('tls');

test/parallel/test-tls-npn-server-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
2+
const common = require('../common');
23
if (!process.features.tls_npn) {
34
common.skip('node compiled without OpenSSL or ' +
45
'with old OpenSSL version.');
56
return;
67
}
78

8-
const common = require('../common');
99
const assert = require('assert');
1010
const fs = require('fs');
1111

test/parallel/test-tls-parse-cert-string.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
'use strict';
2+
const common = require('../common');
3+
if (!common.hasCrypto) {
4+
common.skip('missing crypto');
5+
return;
6+
}
27

3-
require('../common');
48
const assert = require('assert');
59
const tls = require('tls');
610

test/parallel/test-tls-securepair-fiftharg.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
49
const assert = require('assert');
510
const fs = require('fs');
611
const tls = require('tls');

test/parallel/test-tls-sni-option.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
2+
const common = require('../common');
23
if (!process.features.tls_sni) {
34
common.skip('node compiled without OpenSSL or ' +
45
'with old OpenSSL version.');
56
return;
67
}
78

8-
const common = require('../common');
99
const assert = require('assert');
1010
const fs = require('fs');
1111

test/parallel/test-tls-sni-server-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
2+
const common = require('../common');
23
if (!process.features.tls_sni) {
34
common.skip('node compiled without OpenSSL or ' +
45
'with old OpenSSL version.');
56
return;
67
}
78

8-
const common = require('../common');
99
const assert = require('assert');
1010
const fs = require('fs');
1111

test/parallel/test-tls-two-cas-one-string.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
22

33
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
49
const tls = require('tls');
510
const fs = require('fs');
611

test/parallel/test-tls-wrap-no-abort.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
22

3-
require('../common');
3+
const common = require('../common');
4+
if (!common.hasCrypto) {
5+
common.skip('missing crypto');
6+
return;
7+
}
8+
49
const util = require('util');
510
const TLSWrap = process.binding('tls_wrap').TLSWrap;
611

0 commit comments

Comments
 (0)