Skip to content

Commit

Permalink
chore: make paths in wasm tests absolute (noir-lang#3040)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored and Sakapoi committed Oct 19, 2023
1 parent 142ed4a commit b58c8d6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions compiler/wasm/test/node/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { compile } from '@noir-lang/noir_wasm';

async function getFileContent(path: string): Promise<string> {
return readFileSync(join(__dirname, path)).toString();
}
const absoluteNoirSourcePath = join(__dirname, noirSourcePath);
const absoluteNargoArtifactPath = join(__dirname, nargoArtifactPath);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
async function getPrecompiledSource(): Promise<any> {
const compiledData = await getFileContent(nargoArtifactPath);
const compiledData = readFileSync(absoluteNargoArtifactPath).toString();
return JSON.parse(compiledData);
}

describe('noir wasm compilation', () => {
it('matches nargos compilation', async () => {
const wasmCircuit = await compile(noirSourcePath);
const wasmCircuit = await compile(absoluteNoirSourcePath);
const cliCircuit = await getPrecompiledSource();

// We don't expect the hashes to match due to how `noir_wasm` handles dependencies
Expand Down

0 comments on commit b58c8d6

Please sign in to comment.