Numerical simulations are performed to study the process of flame propagation through a small orifice and transition to detonation in a confined pre-chamber/main-chamber system. The numerical model solves the fully compressible Navier-Stokes equations by a high-order numerical algorithm on a dynamically adapting mesh, coupled with a single-step chemical-diffusive model for a stoichiometric ethylene-oxygen mixture. Four successive stages, namely laminar flame propagation, jet flame formation, flame distortion by shock waves, and transition to detonation, are observed. Parametric studies with varying nozzle diameters and initial temperatures are tested to investigate the effect of nozzle size and the stochasticity of deflagration-to-detonation transition (DDT). The results suggest that the case with a smaller nozzle size, d = 1.5 mm, requires a longer time for the flame to evolve and transition into a detonation. A small change in the initial temperature results in clear fluctuations of flame surface length in the turbulent flame regime. In addition, the case with the smaller orifice size is shown to be more sensitive to the initial temperature. Due to the stochastic nature of DDT, the time and location for detonation initiation vary in all cases. Nevertheless, the detonation mechanism remains the same and is independent of the small variations in the initial temperature or the orifice size.