MCPcopy Index your code
hub / github.com/nodejs/node / writeFile

Method writeFile

lib/internal/test_runner/snapshot.js:118–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116 }
117
118 writeFile() {
119 try {
120 const keys = ArrayPrototypeSort(ObjectKeys(this.snapshots));
121 const snapshotStrings = ArrayPrototypeMap(keys, (key) => {
122 return `exports[\`${key}\`] = \`${this.snapshots[key]}\`;\n`;
123 });
124 const output = ArrayPrototypeJoin(snapshotStrings, '\n');
125 mkdirSync(dirname(this.snapshotFile), { __proto__: null, recursive: true });
126 writeFileSync(this.snapshotFile, output, 'utf8');
127 } catch (err) {
128 throwWriteError(err, this.snapshotFile);
129 }
130 }
131}
132
133class SnapshotManager {

Callers 1

writeSnapshotFilesMethod · 0.45

Calls 4

dirnameFunction · 0.85
writeFileSyncFunction · 0.85
throwWriteErrorFunction · 0.85
mkdirSyncFunction · 0.50

Tested by

no test coverage detected