Skip to content

Commit

Permalink
crossplatform testing support
Browse files Browse the repository at this point in the history
  • Loading branch information
cbunt committed Oct 23, 2024
1 parent cc2422e commit 314b224
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
26 changes: 19 additions & 7 deletions test/prepare_test.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require("fs");
const path = require("path");

console.log("=================================== SETTING UP THE TESTS ===========================================");

if (!fs.existsSync("..\\dist")) {
if (!fs.existsSync(path.join("..", "dist"))) {
console.error("ERROR: Cannot find 'dist' folder. Did you forget to build the plugin with 'npm run build'?");
process.exit(1);
}

console.log("Copying current build of plugin to node_modules for testing...");
const modulesDir = path.join("..", "node_modules", "typedoc-plugin-merge-modules");

fs.rm("..\\node_modules\\typedoc-plugin-merge-modules", { recursive: true, force: true }, (rmErr) => {
fs.rm(modulesDir, { recursive: true, force: true }, (rmErr) => {
if (rmErr) {
throw rmErr;
} else {
fs.mkdir("..\\node_modules\\typedoc-plugin-merge-modules\\dist", { recursive: true }, (mkDirErr) => {
}
fs.mkdir(
path.join(modulesDir, "dist"),
{ recursive: true },
(mkDirErr) => {
if (mkDirErr) {
throw mkDirErr;
} else {
fs.copyFileSync("..\\package.json", "..\\node_modules\\typedoc-plugin-merge-modules\\package.json");
fs.cpSync("..\\dist", "..\\node_modules\\typedoc-plugin-merge-modules\\dist", { recursive: true });
fs.copyFileSync(
path.join("..", "package.json"),
path.join(modulesDir, "package.json"),
);
fs.cpSync(
path.join("..", "dist"),
path.join(modulesDir, "dist"),
{ recursive: true },
);
}
});
}

});

console.log("DONE\n");
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const execOptions = { stdio: "inherit" };

console.log("===================================== TEST MERGE OFF ===============================================");
execSync("cd merge-off && npx typedoc", execOptions);
execSync("call npx cypress run --quiet --spec 'merge-off/test.cy.ts'", execOptions);
execSync("npx cypress run --quiet --spec 'merge-off/test.cy.ts'", execOptions);

console.log("=================================== TEST MERGE PROJECT =============================================");
execSync("cd merge-project && npx typedoc", execOptions);
Expand Down

0 comments on commit 314b224

Please sign in to comment.