-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: run tests for
noir_wasm
in node under default resolver (#3020)
- Loading branch information
1 parent
e4389db
commit 9893dc7
Showing
5 changed files
with
37 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,2 @@ | ||
import { initializeResolver } from '@noir-lang/source-resolver'; | ||
import { compile } from '@noir-lang/noir_wasm'; | ||
|
||
export const noirSourcePath = '../../noir-script/src/main.nr'; | ||
export const nargoArtifactPath = '../../noir-script/target/noir_wasm_testing.json'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export async function compileNoirSource(noir_source: string): Promise<any> { | ||
console.log('Compiling Noir source...'); | ||
|
||
initializeResolver((id: string) => { | ||
console.log(`Resolving source ${id}`); | ||
|
||
const source = noir_source; | ||
|
||
if (typeof source === 'undefined') { | ||
throw Error(`Could not resolve source for '${id}'`); | ||
} else if (id !== '/main.nr') { | ||
throw Error(`Unexpected id: '${id}'`); | ||
} else { | ||
return source; | ||
} | ||
}); | ||
|
||
try { | ||
const compiled_noir = compile('main.nr'); | ||
|
||
console.log('Noir source compilation done.'); | ||
|
||
return compiled_noir; | ||
} catch (e) { | ||
console.log('Error while compiling:', e); | ||
} | ||
} |