Removes a duplicate from the upload script and its backups

The script body had been saved twice, so a production upload would have run
twice and left web.config backups on the host. Browser tests also get longer
limits on the slow CI runner; the page behaves the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 23:47:56 +01:00
co-authored by Claude Opus 5.5
parent 79b1a66b97
commit 2006fa01d9
5 changed files with 82 additions and 71 deletions
+44 -1
View File
@@ -531,7 +531,7 @@ describe.skipIf(toolsMissing || lftpMissing)('upload-production.sh', () => {
// De volgorde zelf volgt uit de rondes hierboven (na ronde 1 staat er
// nog geen HTML); hier alleen dat het script ze in die volgorde doet
const rounds = [...run.stdout.matchAll(/^== Ronde (d)/gm)].map(
const rounds = [...run.stdout.matchAll(/^== Ronde (\d)/gm)].map(
(match) => match[1],
);
expect(rounds).toEqual(['1', '2', '3']);
@@ -540,6 +540,17 @@ describe.skipIf(toolsMissing || lftpMissing)('upload-production.sh', () => {
expect(await tree(target)).toEqual(expected);
});
it('laat bij een tweede deploy geen back-upbestanden met ~ achter', async () => {
const { dist, target } = await setup();
expect((await upload(dist, target)).code).toBe(0);
// Nu bestaat web.config al op de host, en alles wordt overschreven
await write(dist, 'robots.txt', 'nieuwe inhoud');
expect((await upload(dist, target)).code).toBe(0);
const files = await tree(target);
expect(files.filter((file) => file.includes('~'))).toEqual([]);
expect(files).toContain('web.config');
});
it('weigert een ongeldige build en uploadt dan niets', async () => {
const { dist, target } = await setup();
await rm(join(dist, 'index.html'));
@@ -624,6 +635,38 @@ touch '${slash(marker)}'
},
);
it('zet in elke lftp-sessie de back-ups uit en de TLS-eisen aan', async () => {
const dist = await makeDist();
const bin = await makeTemp('andreaslop-fakebin-');
const log = join(bin, 'opdrachten');
await writeFile(
join(bin, 'lftp'),
`#!/bin/sh
printf '%s\\n' "$2" >> '${slash(log)}'
`,
{ mode: 0o755 },
);
const run = await runScript(
'upload-production.sh',
[basename(dist), 'wwwroot'],
{
PATH: `${bin}${delimiter}${process.env.PATH ?? ''}`,
LFTP_OPEN: 'file:///',
},
dirname(dist),
);
expect(run.code).toBe(0);
const sessions = (await readFile(log, 'utf8'))
.split('\n')
.filter(Boolean);
// Ronde 1, web.config, ronde 2 (HTML) en ronde 3
expect(sessions).toHaveLength(4);
for (const commands of sessions) {
expect(commands).toContain('set xfer:make-backup no;');
expect(commands).toContain('set ftp:ssl-force true;');
}
});
it.each(['wwwroot', 'sites/andreaslop.nl', '/srv/site', 'wwwroot/'])(
'laat de doelmap %j door',
async (remote) => {