MCPcopy
hub / github.com/codeceptjs/CodeceptJS / saveData

Method saveData

lib/test-server.js:52–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50 }
51
52 saveData() {
53 if (this.readOnly) {
54 console.log('[Save] Skipping save - running in read-only mode')
55 return
56 }
57 try {
58 fs.writeFileSync(this.dbFile, JSON.stringify(this.data, null, 2))
59 console.log('[Save] Data saved to file')
60 // Force update modification time to ensure auto-reload works
61 const now = new Date()
62 fs.utimesSync(this.dbFile, now, now)
63 this.lastModified = now
64 console.log('[Save] File modification time updated')
65 } catch (err) {
66 console.warn(`[Save] Could not save data file ${this.dbFile}:`, err.message)
67 }
68 }
69
70 setupMiddleware() {
71 // Parse JSON bodies

Callers 1

setupRoutesMethod · 0.95

Calls 1

logMethod · 0.80

Tested by

no test coverage detected