import { readFileSync } from 'node:fs' import vm from 'node:vm' import { MAP_LABEL_STYLE, mapLabelText } from '../../../src/modules/cockpit/domain/mapLabelStyle.js' // Read the pre-edit snapshot; reproduce the existing T45 harness failure without rewriting source. const source = readFileSync(new URL('../implementation/t22/before/src__modules__cockpit__services__cesiumEngine.js', import.meta.url), 'utf8') const extract = (name) => source.match(new RegExp(`(?:export )?function ${name}\\([^]*?\\n\\}`))[0].replace(/^export /, '') const context = vm.createContext({ pointMarkerSource: () => ({ entities: { removeAll() {}, add() {} } }), Cartesian3: { fromDegrees() {} }, Cartesian2: class {}, HeightReference: {}, VerticalOrigin: {}, Color: { WHITE: {}, BLACK: { withAlpha: (alpha) => ({ alpha }) }, fromCssColorString: () => ({ withAlpha: (alpha) => ({ alpha }) }) }, LabelStyle: {}, viewer: {}, MAP_LABEL_STYLE, mapLabelText, }) vm.runInContext(extract('mapTextLabel'), context) vm.runInContext(extract('syncPointMarkers'), context) try { vm.runInContext("syncPointMarkers(viewer,[{key:'monitoring-point|P',code:'P',kind:'monitoring-point',name:'城南监测点',longitude:1,latitude:2}],()=>'color',()=>'image')", context) throw new Error('Expected the pre-existing T45 harness failure') } catch (error) { if (error.message !== 'markerEntityIndex is not defined') throw error console.log(`Confirmed pre-edit T45 harness failure: ${error.message}`) }