MISC: Support JSX, TS, TSX script files (#1216)

This commit is contained in:
catloversg
2024-07-15 04:47:10 +07:00
committed by GitHub
parent 783120c886
commit 864613c616
38 changed files with 895 additions and 201 deletions
+1 -2
View File
@@ -72,7 +72,6 @@ describe("Netscript RAM Calculation/Generation Tests", function () {
extraLayerCost = 0,
) {
const code = `${fnPath.join(".")}();\n`.repeat(3);
const filename = "testfile.js" as ScriptFilePath;
const fnName = fnPath[fnPath.length - 1];
const server = "testserver";
@@ -80,7 +79,7 @@ describe("Netscript RAM Calculation/Generation Tests", function () {
expect(getRamCost(fnPath, true)).toEqual(expectedRamCost);
// Static ram check
const staticCost = calculateRamUsage(code, filename, new Map(), server).cost;
const staticCost = calculateRamUsage(code, `${fnName}.js` as ScriptFilePath, server, new Map()).cost;
expect(staticCost).toBeCloseTo(Math.min(baseCost + expectedRamCost + extraLayerCost, maxCost));
// reset workerScript for dynamic check