From c837f559f4f65dfcfac5553e95bf4a436e8bc587 Mon Sep 17 00:00:00 2001 From: lonerapier Date: Thu, 29 Aug 2024 04:05:02 +0530 Subject: [PATCH] use pwd to get working director --- circuits/test/json/extractor/extractor.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/circuits/test/json/extractor/extractor.test.ts b/circuits/test/json/extractor/extractor.test.ts index 2a693ec..5f766b8 100644 --- a/circuits/test/json/extractor/extractor.test.ts +++ b/circuits/test/json/extractor/extractor.test.ts @@ -1,12 +1,18 @@ import { circomkit, WitnessTester, readInputFile } from "../../common"; -import { join } from "path"; +import { join, dirname } from "path"; import { spawn } from "child_process"; function executeCodegen(inputFilename: string, outputFilename: string) { return new Promise((resolve, reject) => { - const inputPath = join(__dirname, "..", "..", "..", "..", "examples", "json", "test", "codegen", inputFilename); + let rootDir = ""; + const pwd = spawn("pwd"); + pwd.stdout.on('data', (data) => { + console.log(`stdout: ${data}`); + rootDir = data; + }); + const inputPath = join(rootDir, "examples", "json", "test", "codegen", inputFilename); const codegen = spawn("cargo", ["run", "--bin", "codegen", "--", "--json-file", inputPath, "--output-filename", outputFilename]); codegen.stdout.on('data', (data) => {