(execStub)
| 166 | } |
| 167 | |
| 168 | function assertPrivateArchiveDownload(execStub) { |
| 169 | const downloadCall = execStub.calls.find((c) => c.bin === process.execPath); |
| 170 | assert.ok(downloadCall, 'fallback should download via the current node binary'); |
| 171 | |
| 172 | const downloaderScript = downloadCall.args[1]; |
| 173 | assert.match( |
| 174 | downloaderScript, |
| 175 | /fs\.createWriteStream\(dest,\{flags:'wx',mode:0o600\}\)/, |
| 176 | 'fallback downloader should create the archive exclusively with owner-only permissions', |
| 177 | ); |
| 178 | |
| 179 | const archivePath = downloadCall.args[3]; |
| 180 | const archiveDir = path.dirname(archivePath); |
| 181 | assert.equal(path.basename(archivePath), 'archive.tar.gz', |
| 182 | 'fallback should use a fixed archive name inside a private directory'); |
| 183 | assert.match(path.basename(archiveDir), /^\.evolver-update-archive-/, |
| 184 | 'fallback archive directory should be mkdtemp-created'); |
| 185 | assert.notEqual(archiveDir, os.tmpdir(), |
| 186 | 'fallback should not write the archive directly under os.tmpdir()'); |
| 187 | assert.doesNotMatch(path.basename(archivePath), /^\.evolver-update-\d+-\d+\.tar\.gz$/, |
| 188 | 'fallback should not use the old predictable top-level archive filename'); |
| 189 | assert.ok(!fs.existsSync(archiveDir), 'fallback should remove the private archive directory'); |
| 190 | } |
| 191 | |
| 192 | describe('executeForceUpdate: keep-list preserves user config files', () => { |
| 193 | before(() => { |
no outgoing calls
no test coverage detected