mirror of
https://github.com/cocos/cocos-engine.git
synced 2026-09-07 08:09:13 +08:00
* Binary serialization * Update snapshots * Update * rename option ccon -> useCCON * Missing script * encodeCCONJson: chunks -> chunkURLs * Update * (de)serializeSymbol -> (de)serializeTag; * CustomizedSerializable -> CustomSerializable * _deserializePrimitiveObject -> _fillPlainObject * Unify CCClass CCClassConstructor * encodeCCONJson -> parseCCONJson * Custom serializable * Move (de)serializeSuper(This) from context into global * property -> read(write)Property; (de)serializeThis(Super) -> (read)writeThis(Super) * CI and lint * Mock cc env
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
|
|
import ps from 'path';
|
|
import { getCaseName } from './utils';
|
|
|
|
export interface Port {
|
|
name: string;
|
|
serializeOptions: {
|
|
compiled?: boolean;
|
|
useCCON?: boolean;
|
|
};
|
|
deserializeOptions: {
|
|
};
|
|
}
|
|
|
|
export const PORT_DYNAMIC: Readonly<Port> = {
|
|
name: 'Dynamic',
|
|
serializeOptions: {},
|
|
deserializeOptions: {},
|
|
};
|
|
|
|
export const PORT_COMPILED: Readonly<Port> = {
|
|
name: 'Compiled',
|
|
serializeOptions: {
|
|
compiled: true,
|
|
},
|
|
deserializeOptions: {},
|
|
};
|
|
|
|
export const PORT_CCOB: Readonly<Port> = {
|
|
name: 'CCON',
|
|
serializeOptions: {
|
|
useCCON: true,
|
|
},
|
|
deserializeOptions: {
|
|
},
|
|
};
|
|
|
|
export const PORTS_BOTH_DYNAMIC_COMPILED: Readonly<Port[]> = [
|
|
PORT_DYNAMIC,
|
|
// PORT_COMPILED,
|
|
];
|
|
|
|
export function calculatePortSnapshotPath (caseModulePath: string, portName: string) {
|
|
const caseName = getCaseName(caseModulePath);
|
|
return ps.join(__dirname, '__snapshots__', `case-${caseName}_port-${portName}.json`);
|
|
}
|
|
|
|
export function testEachPort (ports: ReadonlyArray<Port>, fn: (port: Port) => Promise<void>) {
|
|
const table = ports.map((port) => {
|
|
return [port.name, port] as [string, Readonly<Port>];
|
|
});
|
|
test.each(table)(`%s`, async (_, port) => {
|
|
await fn(port);
|
|
});
|
|
}
|