mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
705c977fc9
* 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
77 lines
1.7 KiB
TypeScript
77 lines
1.7 KiB
TypeScript
|
|
jest.mock(
|
|
'internal:constants',
|
|
() => jest.requireActual('../cocos/core/default-constants'),
|
|
{ virtual: true, },
|
|
);
|
|
|
|
jest.mock(
|
|
'pal/audio',
|
|
() => jest.requireActual('../pal/audio/web/player'),
|
|
{ virtual: true, },
|
|
);
|
|
|
|
jest.mock(
|
|
'pal/minigame',
|
|
() => jest.requireActual('../pal/minigame/non-minigame'),
|
|
{ virtual: true, },
|
|
);
|
|
|
|
jest.mock(
|
|
'pal/system-info',
|
|
() => jest.requireActual('../pal/system-info/web/system-info'),
|
|
{ virtual: true, },
|
|
);
|
|
|
|
jest.mock(
|
|
'pal/screen-adapter',
|
|
() => jest.requireActual('../pal/screen-adapter/web/screen-adapter'),
|
|
{ virtual: true, },
|
|
);
|
|
|
|
jest.mock(
|
|
'pal/input',
|
|
() => jest.requireActual('../pal/input/web/index'),
|
|
{ virtual: true, },
|
|
);
|
|
|
|
jest.mock('../cocos/core/platform/debug', () => {
|
|
const result = {
|
|
__esModule: true, // Use it when dealing with esModules
|
|
...jest.requireActual('../cocos/core/platform/debug'),
|
|
};
|
|
if (result.warnID) {
|
|
result.warnID = jest.fn();
|
|
}
|
|
return result;
|
|
});
|
|
|
|
jest.mock(
|
|
'cc',
|
|
() => jest.requireActual('../exports/base'),
|
|
{ virtual: true, },
|
|
);
|
|
|
|
jest.mock('serialization-test-helper/run-test', () => {
|
|
return require('../tests/core/serialization/run-test');
|
|
}, {
|
|
virtual: true,
|
|
});
|
|
|
|
import '../exports/base';
|
|
import { DebugMode } from "../cocos/core/platform/debug";
|
|
import { game, IGameConfig } from '../exports/base';
|
|
|
|
const canvas = document.createElement('canvas');
|
|
const div = document.createElement('div');
|
|
const config: IGameConfig = {
|
|
debugMode: DebugMode.INFO,
|
|
renderMode: 0,
|
|
adapter: {
|
|
canvas: canvas,
|
|
frame: div,
|
|
container: div
|
|
}
|
|
}
|
|
game.init(config);
|
|
game.run(); |