(/** @type {IFs} */ fs)
| 138 | }; |
| 139 | |
| 140 | const createFsInfo = (/** @type {IFs} */ fs) => { |
| 141 | /** @type {import("../lib/logging/Logger").Logger & Record<string, (...args: unknown[]) => unknown>} */ |
| 142 | const logger = |
| 143 | /** @type {import("../lib/logging/Logger").Logger & Record<string, (...args: unknown[]) => unknown>} */ ( |
| 144 | /** @type {unknown} */ ({ |
| 145 | error: (/** @type {unknown[]} */ ...args) => { |
| 146 | throw new Error(util.format(...args)); |
| 147 | } |
| 148 | }) |
| 149 | ); |
| 150 | /** @type {import("../lib/FileSystemInfo") & Record<string, unknown>} */ |
| 151 | const fsInfo = |
| 152 | /** @type {import("../lib/FileSystemInfo") & Record<string, unknown>} */ ( |
| 153 | new FileSystemInfo( |
| 154 | /** @type {import("../lib/util/fs").InputFileSystem} */ ( |
| 155 | /** @type {unknown} */ (fs) |
| 156 | ), |
| 157 | { |
| 158 | logger, |
| 159 | unmanagedPaths, |
| 160 | managedPaths, |
| 161 | immutablePaths, |
| 162 | hashFunction: "sha256" |
| 163 | } |
| 164 | ) |
| 165 | ); |
| 166 | for (const method of ["warn", "info", "log", "debug"]) { |
| 167 | fsInfo.logs = []; |
| 168 | fsInfo[method] = []; |
| 169 | logger[method] = (/** @type {unknown[]} */ ...args) => { |
| 170 | const msg = util.format(...args); |
| 171 | /** @type {string[]} */ (fsInfo[method]).push(msg); |
| 172 | /** @type {string[]} */ (fsInfo.logs).push(`[${method}] ${msg}`); |
| 173 | }; |
| 174 | } |
| 175 | fsInfo.addFileTimestamps(new Map(ignored.map((i) => [i, "ignore"]))); |
| 176 | return fsInfo; |
| 177 | }; |
| 178 | |
| 179 | const createSnapshot = ( |
| 180 | /** @type {IFs} */ fs, |
no test coverage detected