pabst-checker 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +232 -0
  3. package/dist/build-spec.d.ts +2 -0
  4. package/dist/build-spec.js +46 -0
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +119 -0
  7. package/dist/codegen.d.ts +6 -0
  8. package/dist/codegen.js +30 -0
  9. package/dist/desugar.d.ts +5 -0
  10. package/dist/desugar.js +136 -0
  11. package/dist/discover.d.ts +16 -0
  12. package/dist/discover.js +113 -0
  13. package/dist/domains.d.ts +47 -0
  14. package/dist/domains.js +130 -0
  15. package/dist/emit.d.ts +2 -0
  16. package/dist/emit.js +74 -0
  17. package/dist/envelope.d.ts +29 -0
  18. package/dist/envelope.js +28 -0
  19. package/dist/equations.d.ts +8 -0
  20. package/dist/equations.js +256 -0
  21. package/dist/errors.d.ts +9 -0
  22. package/dist/errors.js +9 -0
  23. package/dist/extract.d.ts +21 -0
  24. package/dist/extract.js +177 -0
  25. package/dist/formula-ast.d.ts +26 -0
  26. package/dist/formula-ast.js +18 -0
  27. package/dist/formula-lexer.d.ts +31 -0
  28. package/dist/formula-lexer.js +191 -0
  29. package/dist/formula-parser.d.ts +2 -0
  30. package/dist/formula-parser.js +122 -0
  31. package/dist/free-idents.d.ts +6 -0
  32. package/dist/free-idents.js +60 -0
  33. package/dist/ir.d.ts +45 -0
  34. package/dist/ir.js +1 -0
  35. package/dist/issue.d.ts +26 -0
  36. package/dist/issue.js +18 -0
  37. package/dist/lower.d.ts +12 -0
  38. package/dist/lower.js +37 -0
  39. package/dist/parse-formula.d.ts +12 -0
  40. package/dist/parse-formula.js +78 -0
  41. package/dist/prefix-parser.d.ts +7 -0
  42. package/dist/prefix-parser.js +188 -0
  43. package/dist/qualified-name.d.ts +5 -0
  44. package/dist/qualified-name.js +11 -0
  45. package/dist/range.d.ts +5 -0
  46. package/dist/range.js +152 -0
  47. package/dist/regex-guard.d.ts +28 -0
  48. package/dist/regex-guard.js +100 -0
  49. package/dist/run.d.ts +26 -0
  50. package/dist/run.js +50 -0
  51. package/dist/runtime.d.ts +25 -0
  52. package/dist/runtime.js +62 -0
  53. package/dist/seed.d.ts +7 -0
  54. package/dist/seed.js +20 -0
  55. package/package.json +67 -0
package/dist/seed.js ADDED
@@ -0,0 +1,20 @@
1
+ import { randomInt } from "node:crypto";
2
+ import { PabstError } from "./errors.js";
3
+ /** A fresh 32-bit unsigned integer, suitable as a fast-check seed. */
4
+ export function randomSeed() {
5
+ return randomInt(0, 2 ** 32);
6
+ }
7
+ /**
8
+ * Parse and validate a `--seed` CLI argument. fast-check seeds are 32-bit
9
+ * integers, so we require a non-negative integer below 2^32.
10
+ */
11
+ export function parseSeed(raw) {
12
+ if (!/^\d+$/.test(raw)) {
13
+ throw new PabstError(`invalid --seed '${raw}': must be a non-negative integer`);
14
+ }
15
+ const n = Number(raw);
16
+ if (!Number.isInteger(n) || n < 0 || n >= 2 ** 32) {
17
+ throw new PabstError(`--seed '${raw}' out of range: must be 0..${2 ** 32 - 1}`);
18
+ }
19
+ return n;
20
+ }
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "pabst-checker",
3
+ "version": "0.12.0",
4
+ "description": "Property-based testing from @ensures annotations, powered by fast-check.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/jessealama/pabst.git"
8
+ },
9
+ "homepage": "https://github.com/jessealama/pabst#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/jessealama/pabst/issues"
12
+ },
13
+ "keywords": [
14
+ "property-based-testing",
15
+ "fast-check",
16
+ "vitest",
17
+ "jsdoc",
18
+ "ensures",
19
+ "testing"
20
+ ],
21
+ "type": "module",
22
+ "engines": {
23
+ "node": ">=24"
24
+ },
25
+ "bin": {
26
+ "pabst": "dist/cli.js"
27
+ },
28
+ "exports": {
29
+ "./runtime": {
30
+ "types": "./dist/runtime.d.ts",
31
+ "default": "./dist/runtime.js"
32
+ }
33
+ },
34
+ "files": [
35
+ "dist"
36
+ ],
37
+ "scripts": {
38
+ "build": "tsc -p tsconfig.json",
39
+ "typecheck": "tsc -p tsconfig.tests.json",
40
+ "prepublishOnly": "npm run build && npm run typecheck && npm test",
41
+ "test": "vitest run",
42
+ "test:watch": "vitest",
43
+ "format": "prettier --write .",
44
+ "format:check": "prettier --check .",
45
+ "coverage": "vitest run --coverage",
46
+ "mutation": "stryker run"
47
+ },
48
+ "license": "MIT",
49
+ "dependencies": {
50
+ "typescript": "^6.0.3",
51
+ "vitest": "^4.1.9"
52
+ },
53
+ "peerDependencies": {
54
+ "@fast-check/vitest": "^0.4.1",
55
+ "fast-check": "^4.8.0"
56
+ },
57
+ "devDependencies": {
58
+ "@fast-check/vitest": "^0.4.1",
59
+ "fast-check": "^4.8.0",
60
+ "@stryker-mutator/core": "^9.6.1",
61
+ "@stryker-mutator/vitest-runner": "^9.6.1",
62
+ "@types/node": "^26.1.0",
63
+ "@vitest/coverage-v8": "^4.1.9",
64
+ "ajv": "^8.20.0",
65
+ "prettier": "3.9.5"
66
+ }
67
+ }