Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit bf8d4b2

Browse files
Merge pull request #5400 from trufflesuite/remove-warning-jest-fast-check
Remove jest-fast-check warning
2 parents e9d45a5 + c46b3f3 commit bf8d4b2

File tree

12 files changed

+45
-32
lines changed

12 files changed

+45
-32
lines changed

packages/abi-utils/.eslintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": ["../../.eslintrc.package.json"],
3+
"overrides": [
4+
{
5+
"files": ["./lib/**/*.test.[tj]s"],
6+
"env": {
7+
"jest": true
8+
}
9+
}
10+
]
11+
}

packages/abi-utils/lib/arbitrary.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { testProp } from "jest-fast-check";
1+
import { testProp } from "@fast-check/jest";
22
import * as abiSchema from "@truffle/contract-schema/spec/abi.spec.json";
33
import { matchers } from "jest-json-schema";
44

packages/abi-utils/lib/arbitrary.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ export const ConstructorEntry = () =>
148148
type: fc.constant("constructor"),
149149
inputs: fc.array(Parameter(), { maxLength: 10 }).filter(inputs => {
150150
// names that are not blank should be unique
151-
const names = inputs.map(({ name }) => name).filter(name => name !== "");
151+
const names = inputs
152+
.map(({ name }) => name)
153+
.filter(name => name !== "");
152154
return names.length === new Set(names).size;
153155
})
154156
}),
@@ -248,7 +250,7 @@ const Type: fc.Memo<string> = fc.memo(n =>
248250

249251
const ArrayFixed = fc.memo(n =>
250252
fc
251-
.tuple(Type(n - 1), fc.integer(1, 256))
253+
.tuple(Type(n - 1), fc.integer({ min: 1, max: 256 }))
252254
.map(([type, length]) => `${type}[${length}]`)
253255
);
254256

@@ -405,7 +407,7 @@ const fakerToArb = (template: string, transform = camelCase) => {
405407
};
406408

407409
const ParameterName = () =>
408-
fc.frequency(
410+
fc.oneof(
409411
{ arbitrary: fakerToArb("{{hacker.noun}}"), weight: 9 },
410412
{ arbitrary: fc.constant(""), weight: 1 }
411413
);

packages/abi-utils/lib/normalize.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import "jest-extended";
2-
import { testProp } from "jest-fast-check";
2+
import { testProp } from "@fast-check/jest";
33

44
import * as Arbitrary from "./arbitrary";
55

@@ -48,9 +48,7 @@ describe("normalize", () => {
4848

4949
expect(
5050
abi.filter(({ type }) => type !== "event" && type !== "error")
51-
).toSatisfyAll(
52-
entry => "stateMutability" in entry
53-
);
51+
).toSatisfyAll(entry => "stateMutability" in entry);
5452
}
5553
);
5654

packages/abi-utils/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
"dependencies": {
2727
"change-case": "3.0.2",
2828
"faker": "5.5.3",
29-
"fast-check": "2.15.1"
29+
"fast-check": "3.1.1"
3030
},
3131
"devDependencies": {
32+
"@fast-check/jest": "^1.0.1",
3233
"@truffle/contract-schema": "^3.4.8",
3334
"@types/faker": "^5.1.2",
3435
"@types/jest": "27.4.1",
3536
"@types/jest-json-schema": "^2.1.2",
3637
"jest": "28.1.3",
3738
"jest-extended": "^0.11.5",
38-
"jest-fast-check": "2.0.0",
3939
"jest-json-schema": "^2.1.0",
4040
"ts-jest": "28.0.7",
4141
"ts-node": "10.7.0",

packages/abi-utils/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
4848
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
4949
// "typeRoots": [], /* List of folders to include type definitions from. */
50-
// "types": [], /* Type declaration files to be included in compilation. */
50+
"types": ["node", "jest"], /* Type declaration files to be included in compilation. */
5151
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
5252
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
5353
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */

packages/db/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"web3-utils": "1.7.4"
5959
},
6060
"devDependencies": {
61+
"@fast-check/jest": "^1.0.1",
6162
"@gql2ts/from-schema": "^2.0.0-4",
6263
"@graphql-tools/utils": "^8.5.5",
6364
"@truffle/compile-common": "^0.7.32",
@@ -73,11 +74,10 @@
7374
"@types/pouchdb-adapter-leveldb": "^6.1.3",
7475
"@types/web3": "^1.0.20",
7576
"change-case": "3.0.2",
76-
"fast-check": "2.15.1",
77+
"fast-check": "3.1.1",
7778
"ganache": "7.4.0",
7879
"hkts": "^0.3.1",
7980
"jest": "28.1.3",
80-
"jest-fast-check": "2.0.0",
8181
"madge": "^5.0.1",
8282
"ts-jest": "28.0.7",
8383
"ts-node": "10.7.0",

packages/db/src/network/test/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { logger } from "@truffle/db/logger";
22
const debug = logger("db:network:test");
33

44
import gql from "graphql-tag";
5-
import { testProp } from "jest-fast-check";
5+
import { testProp } from "@fast-check/jest";
66
import * as fc from "fast-check";
77

88
import * as Arbitrary from "test/arbitraries/networks";

packages/db/test/arbitraries/networks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const Networks = (): fc.Arbitrary<Model> =>
118118
.tuple(
119119
Commands.AddNetwork(),
120120
fc.array(
121-
fc.frequency(
121+
fc.oneof(
122122
{
123123
arbitrary: Commands.AddNetwork(),
124124
weight: 1

packages/encoder/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"web3-utils": "1.7.4"
3939
},
4040
"devDependencies": {
41+
"@fast-check/jest": "^1.0.1",
4142
"@truffle/abi-utils": "^0.2.15",
4243
"@truffle/box": "^2.1.54",
4344
"@truffle/config": "^1.3.34",
@@ -56,11 +57,10 @@
5657
"@types/utf8": "^2.1.6",
5758
"@types/web3": "^1.0.20",
5859
"chai": "^4.2.0",
59-
"fast-check": "2.15.1",
60+
"fast-check": "3.1.1",
6061
"fs-extra": "^9.1.0",
6162
"ganache": "7.4.0",
6263
"jest": "28.1.3",
63-
"jest-fast-check": "2.0.0",
6464
"jest-transform-stealthy-require": "^1.0.0",
6565
"ts-jest": "28.0.7",
6666
"typescript": "^4.1.4",

0 commit comments

Comments
 (0)