Skip to content

Commit

Permalink
test: Fixed issue affecting running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nonara committed Dec 9, 2022
1 parent f5e0016 commit f854433
Show file tree
Hide file tree
Showing 4 changed files with 829 additions and 772 deletions.
1 change: 1 addition & 0 deletions test/package.json
Expand Up @@ -12,6 +12,7 @@
"typescript": "latest",
"ts-patch": "link:../node_modules/ts-patch",
"ts-node": "link:../node_modues/ts-node",
"tsp1": "npm:ts-patch@1.*.*",
"@nrwl/cli": "^15.0.0",
"@nrwl/js": "^15.0.0",
"@nrwl/node": "^15.0.0",
Expand Down
9 changes: 6 additions & 3 deletions test/prepare.js
@@ -1,6 +1,7 @@
const fs = require("fs");
const path = require("path");
const tsPatch = require("ts-patch");
const tsp1 = require('tsp1');

/* ****************************************************************************************************************** *
* Config
Expand All @@ -13,12 +14,14 @@ const tsDirs = ["typescript-three", "typescript-four-seven", "typescript"];
* Patch TS Modules
* ****************************************************************************************************************** */

const baseDirs = new Set();
const baseDirs = new Map();

for (const tsDirName of tsDirs) {
const mainDir = path.resolve(rootDir, "node_modules", tsDirName);
if (!fs.existsSync(path.join(mainDir, "lib-backup"))) baseDirs.add(mainDir);
if (!fs.existsSync(path.join(mainDir, "lib-backup"))) baseDirs.set(tsDirName, mainDir);
}

// Patch discovered modules
for (const dir of baseDirs) tsPatch.patch(["tsc.js", "typescript.js"], { basedir: dir });
for (const [ dirName, dir ] of baseDirs)
if (dirName === 'typescript-three') tsp1.patch(["tsc.js", "typescript.js"], { basedir: dir })
else tsPatch.patch(["tsc.js", "typescript.js"], { dir });

0 comments on commit f854433

Please sign in to comment.