@ianmenethil/zp-devicefp 0.1.0 → 0.2.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.
- package/README.md +173 -103
- package/dist/cdn/zp.dfp.esm.js +294 -84
- package/dist/cdn/zp.dfp.js +287 -84
- package/dist/cdn/zp.dfp.manifest.json +17 -17
- package/dist/cdn/zp.dfp.min.js +1 -1
- package/dist/cdn/zp.dfp.obf.js +1 -1
- package/dist/npm/index.cjs +301 -84
- package/dist/npm/index.d.ts +21 -8
- package/dist/npm/index.mjs +294 -84
- package/docs/api-reference.md +520 -472
- package/docs/architecture.md +171 -40
- package/docs/privacy.md +20 -20
- package/docs/signals.md +425 -383
- package/docs/testing.md +54 -32
- package/package.json +3 -3
package/docs/testing.md
CHANGED
|
@@ -1,32 +1,54 @@
|
|
|
1
|
-
# Testing
|
|
2
|
-
|
|
3
|
-
The project uses
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
# Testing
|
|
2
|
+
|
|
3
|
+
The project uses **bun test** (`bun test --coverage`) as its test runner. Tests are written in TypeScript with bun's built-in test module.
|
|
4
|
+
|
|
5
|
+
## Current coverage
|
|
6
|
+
|
|
7
|
+
92 tests across 24 files, 94.9% line coverage, 82.3% function coverage.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
All files | 82.26% funcs | 94.92% lines
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Coverage intent
|
|
14
|
+
|
|
15
|
+
The included tests focus on:
|
|
16
|
+
|
|
17
|
+
- deterministic canonicalization
|
|
18
|
+
- stable hashing
|
|
19
|
+
- anomaly scoring
|
|
20
|
+
- storage and WebRTC collector behavior
|
|
21
|
+
- audio and media-device collector behavior
|
|
22
|
+
- client sync collection
|
|
23
|
+
- parallel async collection
|
|
24
|
+
- abort and timeout paths
|
|
25
|
+
- warning isolation between runs
|
|
26
|
+
- built-artifact smoke loading
|
|
27
|
+
|
|
28
|
+
## Test layout
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
tests/
|
|
32
|
+
├── unit/ # Unit tests (antiSpoof, canonicalize, hash, events, browser)
|
|
33
|
+
├── integration/ # Client orchestration tests (collect, collectSync, events)
|
|
34
|
+
└── signals/ # Collector tests (21 signal test files)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Run locally
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Run tests
|
|
41
|
+
bun test
|
|
42
|
+
|
|
43
|
+
# Run tests with coverage
|
|
44
|
+
bun test --coverage
|
|
45
|
+
|
|
46
|
+
# Run the full build pipeline (lint → typecheck → knip → jscpd → tests → esbuild → CDN)
|
|
47
|
+
bun run build
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Suggested next expansion
|
|
51
|
+
|
|
52
|
+
- Add browser-matrix tests in Playwright for Chromium, Firefox, and WebKit.
|
|
53
|
+
- Add snapshot tests for collector outputs in privacy-hardened environments.
|
|
54
|
+
- Add server-side reconciliation tests once an API consumer is introduced.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ianmenethil/zp-devicefp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Async-first browser and device fingerprinting library with explainable signals and anomaly scoring.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/npm/index.cjs",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"bun": ">=1.3.0",
|
|
27
27
|
"node": ">=22"
|
|
28
28
|
},
|
|
29
|
-
"prepublishOnly": "bun run build",
|
|
30
29
|
"scripts": {
|
|
30
|
+
"prepublishOnly": "bun run build",
|
|
31
31
|
"build": "bun run check && bun run test:coverage && bun -e \"await import('./.scripts/build.ts')\"",
|
|
32
32
|
"test": "bun test",
|
|
33
33
|
"test:coverage": "bun test --coverage",
|
|
34
|
-
"release": "sh -c '
|
|
34
|
+
"release": "sh -c 'npm version \"${1:-minor}\" -m \"chore: release %s\" && bun publish --access public && rm -rf \"F:/_ZP-Main/apps/CDN-server/public/devicefp\" && mkdir -p \"F:/_ZP-Main/apps/CDN-server/public/devicefp\" && cp -r dist/cdn/* \"F:/_ZP-Main/apps/CDN-server/public/devicefp/\" && git push --follow-tags' --",
|
|
35
35
|
"release:minor": "bun run release minor",
|
|
36
36
|
"release:patch": "bun run release patch",
|
|
37
37
|
"release:major": "bun run release major",
|