details: https://hg.nginx.org/njs/rev/9a6a79e21822 branches: changeset: 2241:9a6a79e21822 user: Dmitry Volyntsev <xei...@nginx.com> date: Wed Nov 29 18:43:37 2023 -0800 description: Tests: detection when "xml" module is disabled.
diffstat: test/harness/compatXml.js | 11 ++++++++++- test/xml/external_entity_ignored.t.js | 3 +-- test/xml/saml_verify.t.js | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diffs (44 lines): diff -r 6a72cee054f6 -r 9a6a79e21822 test/harness/compatXml.js --- a/test/harness/compatXml.js Mon Nov 27 18:43:36 2023 -0800 +++ b/test/harness/compatXml.js Wed Nov 29 18:43:37 2023 -0800 @@ -4,5 +4,14 @@ if (typeof require == 'function' && typeof njs == 'object' && typeof njs.version == 'string') { - xml = require('xml'); + try { + xml = require('xml'); + + } catch (e) { + // ignore + } } + +function has_xml() { + return xml; +} diff -r 6a72cee054f6 -r 9a6a79e21822 test/xml/external_entity_ignored.t.js --- a/test/xml/external_entity_ignored.t.js Mon Nov 27 18:43:36 2023 -0800 +++ b/test/xml/external_entity_ignored.t.js Wed Nov 29 18:43:37 2023 -0800 @@ -11,8 +11,7 @@ let data = `<?xml version="1.0"?> <root>&c;</root> `; -if (has_njs()) { - const xml = require('xml'); +if (has_njs() && has_xml()) { let doc = xml.parse(data); assert.sameValue(doc.$root.$text, ""); } diff -r 6a72cee054f6 -r 9a6a79e21822 test/xml/saml_verify.t.js --- a/test/xml/saml_verify.t.js Mon Nov 27 18:43:36 2023 -0800 +++ b/test/xml/saml_verify.t.js Wed Nov 29 18:43:37 2023 -0800 @@ -280,7 +280,7 @@ function p(args, default_opts) { let saml_verify_tsuite = { name: "SAML verify", - skip: () => (!has_njs() || !has_fs() || !has_webcrypto()), + skip: () => (!has_njs() || !has_fs() || !has_webcrypto() || !has_xml()), T: verify, prepare_args: p, opts: { _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel