diff --git a/test/common/README.md b/test/common/README.md index 3e1e1bbe9c96af..f418115ce31805 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -106,6 +106,16 @@ Checks for 'openssl'. Checks `hasCrypto` and `crypto` with fips. +### hasIntl +* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +Checks if [internationalization] is supported. + +### hasSmallICU +* return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) + +Checks `hasIntl` and `small-icu` is supported. + ### hasIPv6 * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) @@ -322,3 +332,4 @@ implementation with tests from [W3C Web Platform Tests](https://github.com/w3c/web-platform-tests). [MDN-Function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Normal_objects_and_functions +[internationalization]: https://github.com/nodejs/node/wiki/Intl diff --git a/test/common/index.js b/test/common/index.js index 75a1edd447a534..765e7c8aa18c99 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -689,6 +689,12 @@ Object.defineProperty(exports, 'hasIntl', { } }); +Object.defineProperty(exports, 'hasSmallICU', { + get: function() { + return process.binding('config').hasSmallICU; + } +}); + // Useful for testing expected internal/error objects exports.expectsError = function expectsError({code, type, message}) { return function(error) { diff --git a/test/parallel/test-icu-data-dir.js b/test/parallel/test-icu-data-dir.js index 07a4391505b1e2..3882acb92c767c 100644 --- a/test/parallel/test-icu-data-dir.js +++ b/test/parallel/test-icu-data-dir.js @@ -1,5 +1,9 @@ 'use strict'; -require('../common'); +const common = require('../common'); +if (!(common.hasIntl && common.hasSmallICU)) { + common.skip('missing Intl'); + return; +} const assert = require('assert'); const { spawnSync } = require('child_process'); diff --git a/test/parallel/test-url-domain-ascii-unicode.js b/test/parallel/test-url-domain-ascii-unicode.js index 9c288cb6e29c38..2be8ac7f5fec8b 100644 --- a/test/parallel/test-url-domain-ascii-unicode.js +++ b/test/parallel/test-url-domain-ascii-unicode.js @@ -1,6 +1,10 @@ 'use strict'; -require('../common'); +const common = require('../common'); +if (!common.hasIntl) { + common.skip('missing Intl'); + return; +} const strictEqual = require('assert').strictEqual; const url = require('url'); diff --git a/test/parallel/test-url-format-whatwg.js b/test/parallel/test-url-format-whatwg.js index f9e5691ae5cc04..f7363fdbb998b0 100644 --- a/test/parallel/test-url-format-whatwg.js +++ b/test/parallel/test-url-format-whatwg.js @@ -1,6 +1,10 @@ 'use strict'; const common = require('../common'); +if (!common.hasIntl) { + common.skip('missing Intl'); + return; +} const assert = require('assert'); const url = require('url'); const URL = url.URL;