diff --git a/test/badge.svg b/test/badge.svg
index 1a533fd..8b393b2 100644
--- a/test/badge.svg
+++ b/test/badge.svg
@@ -1,24 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/test/specs/testXmlNodeLabels.js b/test/specs/testXmlNodeLabels.js
index c799cc2..969eb96 100644
--- a/test/specs/testXmlNodeLabels.js
+++ b/test/specs/testXmlNodeLabels.js
@@ -23,130 +23,132 @@ const assert = require("assert"),
child_process = require("node:child_process"),
debug = require("debug")("apigeelint:xmldom-test");
-describe("xmldom related tests", function () {
- describe("path resolution verification", function () {
- const path = require("node:path"),
- fs = require("node:fs"),
- proxyDir = path.resolve(__dirname, "../fixtures/resources/issue481"),
- node_modules = path.resolve(proxyDir, "node_modules");
-
- before(function () {
- fs.rmSync(node_modules, { force: true, recursive: true });
- });
- after(function () {
- fs.rmSync(node_modules, { force: true, recursive: true });
- });
-
- it("should resolve to a path", function (done) {
- try {
- const p = lintUtil.getNodeModulesPathFor("@xmldom/xmldom");
- assert.ok(p);
- } catch (e) {
- assert.fail();
- }
- done();
- });
+describe("xmldom path resolution verification", function () {
+ const path = require("node:path"),
+ fs = require("node:fs"),
+ proxyDir = path.resolve(__dirname, "../fixtures/resources/issue481"),
+ node_modules = path.resolve(proxyDir, "node_modules");
+
+ before(function (done) {
+ // remove node_modules before the test runs. We want a clean install.
+ fs.rmSync(node_modules, { force: true, recursive: true });
+ done();
+ });
- it("should find xmldom", function (done) {
- this.timeout(22000);
+ after(function (done) {
+ // tidy up after the test runs.
+ this.timeout(8000);
+ fs.rmSync(node_modules, { force: true, recursive: true });
+ done();
+ });
- const opts = {
- cwd: proxyDir,
- encoding: "utf8",
- };
+ it("should resolve to a path", function (done) {
+ try {
+ const p = lintUtil.getNodeModulesPathFor("@xmldom/xmldom");
+ assert.ok(p);
+ } catch (e) {
+ assert.fail();
+ }
+ done();
+ });
- if (debug.enabled) {
- const r = child_process.spawnSync("which", ["node"], opts);
- debug(`node: ` + JSON.stringify(r));
- }
+ it("should find xmldom", function (done) {
+ this.timeout(22000);
+ const opts = {
+ cwd: proxyDir,
+ encoding: "utf8",
+ };
+
+ if (debug.enabled) {
+ const r = child_process.spawnSync("which", ["node"], opts);
+ debug(`node: ` + JSON.stringify(r));
+ }
+
+ child_process.exec("npm install", opts, (e, stdout, stderr) => {
+ assert.equal(e, null);
+ debug(stdout);
+ // copy current implementation over, to allow testing of it.
+ const srcPackageDir = path.resolve(__dirname, "../../lib/package"),
+ destPackageDir = path.resolve(node_modules, "apigeelint/lib/package");
+ // overwrite the installed apigeelint with the current (working) version
+ fs.cpSync(srcPackageDir, destPackageDir, { recursive: true });
- child_process.exec("npm install", opts, (e, stdout, stderr) => {
- assert.equal(e, null);
- debug(stdout);
- // copy current implementation over, to allow testing of it.
- const srcPackageDir = path.resolve(__dirname, "../../lib/package"),
- destPackageDir = path.resolve(node_modules, "apigeelint/lib/package");
- fs.cpSync(srcPackageDir, destPackageDir, { recursive: true });
-
- try {
- // run apigeelint after npm install
- const proc = child_process.spawn(
- "node",
- ["./node_modules/apigeelint/cli.js", "-s", "sample/apiproxy"],
- { ...opts, timeout: 20000 },
- );
- let stdout = [],
- stderr = [];
- proc.stdout.on("data", (data) => {
- stdout.push(data);
- debug(`stdout: ${data}`);
- });
- proc.stderr.on("data", (data) => {
- stderr.push(data);
- debug(`stderr: ${data}`);
- });
- proc.on("close", (code) => {
- debug(`child process exited with code ${code}`);
- if (code != 0) {
- //console.log(`stdout: ${stdout.join('\n')}`);
- console.log(`stderr: ${stderr.join("\n")}`);
- }
- assert.equal(code, 0);
- done();
- });
- } catch (ex1) {
- console.log(ex1.stack);
- assert.fail();
+ try {
+ // run apigeelint after npm install
+ const proc = child_process.spawn(
+ "node",
+ ["./node_modules/apigeelint/cli.js", "-s", "sample/apiproxy"],
+ { ...opts, timeout: 20000 },
+ );
+ let stdout = [],
+ stderr = [];
+ proc.stdout.on("data", (data) => {
+ stdout.push(data);
+ debug(`stdout: ${data}`);
+ });
+ proc.stderr.on("data", (data) => {
+ stderr.push(data);
+ debug(`stderr: ${data}`);
+ });
+ proc.on("close", (code) => {
+ debug(`child process exited with code ${code}`);
+ if (code != 0) {
+ console.log(`stderr: ${stderr.join("\n")}`);
+ }
+ assert.equal(code, 0, "return status code");
done();
- }
- });
+ });
+ } catch (ex1) {
+ console.log(ex1.stack);
+ assert.fail();
+ }
});
});
+});
- describe("element name tests", function () {
- let xml;
- const exampleXml = ``;
- before(function () {
- xml = new Dom().parseFromString(exampleXml);
- });
+describe("xmldom element name tests", function () {
+ let xml;
+ const exampleXml = ``;
+ before(function () {
+ xml = new Dom().parseFromString(exampleXml);
+ });
- it("should properly name the document node", function (done) {
- assert.ok(xml);
- const nodeTypeString = lintUtil.xmlNodeTypeAsString(xml.nodeType);
- assert.ok(nodeTypeString);
- assert.equal(nodeTypeString, "DOCUMENT_NODE");
- done();
- });
+ it("should properly name the document node", function (done) {
+ assert.ok(xml);
+ const nodeTypeString = lintUtil.xmlNodeTypeAsString(xml.nodeType);
+ assert.ok(nodeTypeString);
+ assert.equal(nodeTypeString, "DOCUMENT_NODE");
+ done();
+ });
- it("should properly name the root element node", function (done) {
- assert.ok(xml.documentElement.nodeType);
- const nodeTypeString = lintUtil.xmlNodeTypeAsString(
- xml.documentElement.nodeType,
- );
- assert.ok(nodeTypeString);
- assert.equal(nodeTypeString, "ELEMENT_NODE");
- done();
- });
+ it("should properly name the root element node", function (done) {
+ assert.ok(xml.documentElement.nodeType);
+ const nodeTypeString = lintUtil.xmlNodeTypeAsString(
+ xml.documentElement.nodeType,
+ );
+ assert.ok(nodeTypeString);
+ assert.equal(nodeTypeString, "ELEMENT_NODE");
+ done();
+ });
- it("should properly name the comment node", function (done) {
- const fc = xml.documentElement.firstChild;
- assert.ok(fc);
- const nodeTypeString = lintUtil.xmlNodeTypeAsString(fc.nodeType);
- assert.ok(nodeTypeString);
- assert.equal(nodeTypeString, "COMMENT_NODE");
- done();
- });
+ it("should properly name the comment node", function (done) {
+ const fc = xml.documentElement.firstChild;
+ assert.ok(fc);
+ const nodeTypeString = lintUtil.xmlNodeTypeAsString(fc.nodeType);
+ assert.ok(nodeTypeString);
+ assert.equal(nodeTypeString, "COMMENT_NODE");
+ done();
+ });
- it("should properly name the attribute node", function (done) {
- const attr = xml.documentElement.getAttributeNode("attr1");
- debug(`attrs(${attr})`);
- debug(`attrs(${util.format(attr)})`);
- assert.ok(attr);
- let nodeTypeString = lintUtil.xmlNodeTypeAsString(attr.nodeType);
- debug(`nodeTypeString(${nodeTypeString})`);
- assert.ok(nodeTypeString);
- assert.equal(nodeTypeString, "ATTRIBUTE_NODE");
- done();
- });
+ it("should properly name the attribute node", function (done) {
+ const attr = xml.documentElement.getAttributeNode("attr1");
+ debug(`attrs(${attr})`);
+ debug(`attrs(${util.format(attr)})`);
+ assert.ok(attr);
+ let nodeTypeString = lintUtil.xmlNodeTypeAsString(attr.nodeType);
+ debug(`nodeTypeString(${nodeTypeString})`);
+ assert.ok(nodeTypeString);
+ assert.equal(nodeTypeString, "ATTRIBUTE_NODE");
+ done();
});
});