feat(shipping-notice): 落地 XFA 拆分、版面签名、统一进度与处理域履约
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a9fbac2fc
commit
d2b3d74def
571 files changed
+78064
-24681
No files matched your search
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* frontend/vitest.setup.ts
|
||||
* 用途:为 jsdom 测试环境补齐 Web Crypto(subtle / randomUUID),与浏览器行为对齐。
|
||||
* 依赖:node:crypto webcrypto。
|
||||
* 逻辑:vitest.config 通过 setupFiles 注入;供 XFA 路径哈希等单测使用。
|
||||
*/
|
||||
import { webcrypto } from 'node:crypto';
|
||||
|
||||
/**
|
||||
* 将 Node webcrypto 挂到 globalThis.crypto,避免 jsdom 缺少 subtle 导致 async 哈希挂起或失败。
|
||||
*/
|
||||
function ensureWebCrypto(): void {
|
||||
const target = globalThis as typeof globalThis & { crypto?: Crypto };
|
||||
if (!target.crypto?.subtle?.digest) {
|
||||
Object.defineProperty(target, 'crypto', {
|
||||
value: webcrypto as Crypto,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ensureWebCrypto();
|
||||
Reference in new issue
Block a user