diff --git a/test/cypress/support/constants.js b/test/cypress/support/constants.js index 96ce3e6..1b604aa 100644 --- a/test/cypress/support/constants.js +++ b/test/cypress/support/constants.js @@ -1,4 +1,4 @@ -export const contentSelector = ".col-content"; -export const descriptionSelector = ".tsd-description .tsd-comment:first-child p"; -export const returnSelector = ".tsd-description .tsd-returns-title+p"; -export const parameterSelector = ".col-content .tsd-parameters p"; +export const contentSelector = ".col-content"; +export const descriptionSelector = ".tsd-description .tsd-comment:first-child p"; +export const returnSelector = ".tsd-description .tsd-returns-title+p"; +export const parameterSelector = ".col-content .tsd-parameters p"; diff --git a/test/test.js b/test/test.js index 3cb3291..004b3e7 100644 --- a/test/test.js +++ b/test/test.js @@ -1,37 +1,37 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ -const { execSync } = require("child_process"); -const fs = require("fs"); - -console.log("=================================== SETTING UP THE TESTS ==========================================="); - -if (!fs.existsSync("..\\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..."); - -fs.rm("..\\node_modules\\typedoc-plugin-replace-text", { recursive: true, force: true }); -fs.mkdirSync("..\\node_modules\\typedoc-plugin-replace-text\\dist", { recursive: true }); -fs.copyFileSync("..\\package.json", "..\\node_modules\\typedoc-plugin-replace-text\\package.json"); -fs.cpSync("..\\dist", "..\\node_modules\\typedoc-plugin-replace-text\\dist", { recursive: true }); - -console.log("DONE\n"); - -console.log("============================= REPLACE ONLY IN CODE COMMENT TEXT ===================================="); -execSync("npx typedoc --options replace-only-in-code-comment-text/typedoc.json", { stdio: "inherit" }); -execSync("npx cypress run --quiet --spec 'replace-only-in-code-comment-text/test.cy.ts'", { stdio: "inherit" }); - -console.log("============================= REPLACE ONLY IN CODE COMMENT TAGS ===================================="); -execSync("npx typedoc --options replace-only-in-code-comment-tags/typedoc.json", { stdio: "inherit" }); -execSync("npx cypress run --quiet --spec 'replace-only-in-code-comment-tags/test.cy.ts'", { stdio: "inherit" }); - -console.log("=============================== REPLACE ONLY IN INCLUDED FILES ====================================="); -execSync("npx typedoc --options replace-only-in-included-files/typedoc.json", { stdio: "inherit" }); -execSync("npx cypress run --quiet --spec 'replace-only-in-included-files/test.cy.ts'", { stdio: "inherit" }); - -console.log("=================================== REPLACE WITH FUNCTION =========================================="); -execSync("npx typedoc --options replace-with-function/typedoc.config.cjs", { stdio: "inherit" }); -execSync("npx cypress run --quiet --spec 'replace-with-function/test.cy.ts'", { stdio: "inherit" }); - -console.log("======================================== FINISHED =================================================="); +/* eslint-disable @typescript-eslint/no-var-requires */ +const { execSync } = require("child_process"); +const fs = require("fs"); + +console.log("=================================== SETTING UP THE TESTS ==========================================="); + +if (!fs.existsSync("..\\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..."); + +fs.rm("..\\node_modules\\typedoc-plugin-replace-text", { recursive: true, force: true }); +fs.mkdirSync("..\\node_modules\\typedoc-plugin-replace-text\\dist", { recursive: true }); +fs.copyFileSync("..\\package.json", "..\\node_modules\\typedoc-plugin-replace-text\\package.json"); +fs.cpSync("..\\dist", "..\\node_modules\\typedoc-plugin-replace-text\\dist", { recursive: true }); + +console.log("DONE\n"); + +console.log("============================= REPLACE ONLY IN CODE COMMENT TEXT ===================================="); +execSync("npx typedoc --options replace-only-in-code-comment-text/typedoc.json", { stdio: "inherit" }); +execSync("npx cypress run --quiet --spec 'replace-only-in-code-comment-text/test.cy.ts'", { stdio: "inherit" }); + +console.log("============================= REPLACE ONLY IN CODE COMMENT TAGS ===================================="); +execSync("npx typedoc --options replace-only-in-code-comment-tags/typedoc.json", { stdio: "inherit" }); +execSync("npx cypress run --quiet --spec 'replace-only-in-code-comment-tags/test.cy.ts'", { stdio: "inherit" }); + +console.log("=============================== REPLACE ONLY IN INCLUDED FILES ====================================="); +execSync("npx typedoc --options replace-only-in-included-files/typedoc.json", { stdio: "inherit" }); +execSync("npx cypress run --quiet --spec 'replace-only-in-included-files/test.cy.ts'", { stdio: "inherit" }); + +console.log("=================================== REPLACE WITH FUNCTION =========================================="); +execSync("npx typedoc --options replace-with-function/typedoc.config.cjs", { stdio: "inherit" }); +execSync("npx cypress run --quiet --spec 'replace-with-function/test.cy.ts'", { stdio: "inherit" }); + +console.log("======================================== FINISHED ==================================================");