mirror of
https://github.com/privacy-scaling-explorations/zk-kit.git
synced 2026-04-22 03:00:15 -04:00
fix js ts modules with jest
This commit is contained in:
2433
package-lock.json
generated
2433
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -29,10 +29,14 @@
|
||||
},
|
||||
"homepage": "https://github.com/appliedzkp/libsemaphore#readme",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.15.8",
|
||||
"@babel/preset-env": "^7.15.8",
|
||||
"@babel/preset-typescript": "^7.15.0",
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/node": "^16.10.8",
|
||||
"@typescript-eslint/eslint-plugin": "^5.1.0",
|
||||
"@typescript-eslint/parser": "^5.1.0",
|
||||
"babel-jest": "^27.3.1",
|
||||
"bigint-conversion": "^2.1.12",
|
||||
"eslint": "^8.0.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
@@ -40,7 +44,7 @@
|
||||
"jest-config": "^27.2.5",
|
||||
"lerna": "^4.0.0",
|
||||
"prettier": "^2.3.2",
|
||||
"ts-jest": "^27.0.6",
|
||||
"ts-jest": "^27.0.7",
|
||||
"ts-node": "^10.4.0",
|
||||
"tslib": "^2.3.1",
|
||||
"typescript": "^4.4.4"
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"transform": {
|
||||
"\\.(ts|tsx)": "ts-jest"
|
||||
},
|
||||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
||||
"moduleFileExtensions": ["ts", "js"],
|
||||
"coveragePathIgnorePatterns": ["/node_modules/", "/test/"],
|
||||
"collectCoverageFrom": ["src/**/*.{js,ts}"]
|
||||
}
|
||||
15
packages/protocols/jest.config.ts
Normal file
15
packages/protocols/jest.config.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export default {
|
||||
globals: {
|
||||
extensionsToTreatAsEsm: ['.ts', '.js'],
|
||||
'ts-jest': {
|
||||
useESM: true
|
||||
}
|
||||
},
|
||||
|
||||
preset: 'ts-jest/presets/js-with-ts-esm',
|
||||
|
||||
// from https://stackoverflow.com/a/57916712/15076557
|
||||
transformIgnorePatterns: [
|
||||
'node_modules/(?!(module-that-needs-to-be-transformed)/)'
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable no-undef */
|
||||
const builder = async(code, options) => {
|
||||
export const builder = async(code, options) => {
|
||||
|
||||
options = options || {};
|
||||
|
||||
@@ -270,12 +270,12 @@ function flatArray(a) {
|
||||
}
|
||||
|
||||
function fnvHash(str) {
|
||||
const uint64_max = BigInt(2) ** BigInt(64);
|
||||
const uint64_max = Number(BigInt(2)) ** Number(BigInt(64));
|
||||
let hash = BigInt("0xCBF29CE484222325");
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
hash ^= BigInt(str[i].charCodeAt());
|
||||
hash *= BigInt(0x100000001B3);
|
||||
hash %= uint64_max;
|
||||
hash %= BigInt(uint64_max);
|
||||
}
|
||||
let shash = hash.toString(16);
|
||||
let n = 16 - shash.length;
|
||||
@@ -283,6 +283,4 @@ function fnvHash(str) {
|
||||
return shash;
|
||||
}
|
||||
|
||||
export {
|
||||
builder
|
||||
}
|
||||
// export * as builder from ".";
|
||||
|
||||
@@ -36,7 +36,7 @@ describe("Semaphore", () => {
|
||||
|
||||
expect(typeof witness).toBe("object")
|
||||
})
|
||||
it.skip("Should generate semaphore full proof", async () => {
|
||||
it("Should generate semaphore full proof", async () => {
|
||||
/**
|
||||
* Compiled semaphore circuits are needed to run this test, so it's being skipped in hooks
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"declarationDir": "./dist/types",
|
||||
"composite": true,
|
||||
"checkJs": false,
|
||||
"esModuleInterop": true,
|
||||
},
|
||||
"include": ["src/**/*", "../../build"],
|
||||
"exclude": ["node_modules/**", "tests/**"]
|
||||
|
||||
Reference in New Issue
Block a user