Skip to content

Commit

Permalink
remove unnecessary steps from test/prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpza committed Dec 22, 2024
1 parent e4ea98b commit b53e239
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions test/prepare.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
// @ts-check
import { existsSync } from "node:fs";
import { symlink } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { patch } from "ts-patch";

const __dirname = dirname(fileURLToPath(import.meta.url)); // https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules

async function symlinkTsNode() {
// we need to patch the root package node_modules in order for it to locate ts-node for the register tests.
// installing ts-node as a depenency in the root is not an option since it would create two copies of ts-node
// thus messing with the mocks in the tests
const target = resolve(__dirname, "node_modules/ts-node");
const path = resolve(__dirname, "../node_modules/ts-node");

if (!existsSync(path)) await symlink(target, path, "junction");
}

function patchTsModules() {
const rootDir = __dirname;

Expand All @@ -30,4 +18,3 @@ function patchTsModules() {
}

patchTsModules();
await symlinkTsNode();

0 comments on commit b53e239

Please sign in to comment.