Test-setup helper that binds Sequelize models to an OFFLINE Sequelize
instance in replay mode — the constructor performs no I/O, so no live DB is required.
Why: in replay the original connect() is replayed from the snapshot, so the model is
never bound to a Sequelize instance and its isInitialized flag stays false — the
original static build() would throw ModelNotInitializedError during replay
reconstruction (see rebuildInstance).
The binding runs with the global mode temporarily switched to 'off' and restored
afterwards, because Model.init() internally invokes wrapped statics (e.g.
getTableName) which must NOT route into a replay lookup during setup.
Description
Test-setup helper that binds Sequelize models to an OFFLINE
Sequelizeinstance in replay mode — the constructor performs no I/O, so no live DB is required.Why: in replay the original
connect()is replayed from the snapshot, so the model is never bound to aSequelizeinstance and itsisInitializedflag staysfalse— the original staticbuild()would throwModelNotInitializedErrorduring replay reconstruction (see rebuildInstance).The binding runs with the global mode temporarily switched to
'off'and restored afterwards, becauseModel.init()internally invokes wrapped statics (e.g.getTableName) which must NOT route into a replay lookup during setup.No-op (returns
undefined) outside replay mode.Example