-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
14 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,39 @@ | ||
import { access } from 'node:fs/promises' | ||
import { join } from 'path' | ||
import { join, sep } from 'path' | ||
|
||
import { Fixture } from '@netlify/testing' | ||
import test from 'ava' | ||
|
||
test('Build removes blobs directory before starting', async (t) => { | ||
const fixture = await new Fixture('./fixtures/with_preexisting_blobs').withCopyRoot({ git: false }) | ||
const fixture = await new Fixture('./fixtures/with_preexisting_blobs') | ||
.withFlags({ debug: false, timeline: 'dev' }) | ||
.withCopyRoot() | ||
|
||
const blobsDir = join(fixture.repositoryRoot, '.netlify', 'deploy', 'v1', 'blobs', 'deploy') | ||
|
||
await t.notThrowsAsync(access(blobsDir)) | ||
|
||
const { | ||
success, | ||
logs: { stdout }, | ||
} = await fixture | ||
.withFlags({ | ||
cwd: fixture.repositoryRoot, | ||
}) | ||
.runBuildProgrammatic() | ||
const output = await fixture.runDev(() => {}) | ||
|
||
t.true(success) | ||
t.true(stdout.join('\n').includes('Cleaning up leftover files from previous builds')) | ||
t.true(output.includes('Cleaning up leftover files from previous builds')) | ||
t.true(output.includes(`Cleaned up .netlify${sep}deploy${sep}v1${sep}blobs${sep}deploy`)) | ||
|
||
await t.throwsAsync(access(blobsDir)) | ||
}) | ||
|
||
test('Build removes legacy blobs directory before starting', async (t) => { | ||
const fixture = await new Fixture('./fixtures/with_preexisting_legacy_blobs').withCopyRoot({ git: false }) | ||
const fixture = await new Fixture('./fixtures/with_preexisting_legacy_blobs') | ||
.withFlags({ debug: false, timeline: 'dev' }) | ||
.withCopyRoot() | ||
|
||
const blobsDir = join(fixture.repositoryRoot, '.netlify', 'blobs', 'deploy') | ||
|
||
await t.notThrowsAsync(access(blobsDir)) | ||
|
||
const { | ||
success, | ||
logs: { stdout }, | ||
} = await fixture | ||
.withFlags({ | ||
cwd: fixture.repositoryRoot, | ||
}) | ||
.runBuildProgrammatic() | ||
|
||
t.true(success) | ||
t.true(stdout.join('\n').includes('Cleaning up leftover files from previous builds')) | ||
const output = await fixture.runDev(() => {}) | ||
|
||
t.true(output.includes('Cleaning up leftover files from previous builds')) | ||
t.true(output.includes(`Cleaned up .netlify${sep}blobs${sep}deploy`)) | ||
|
||
await t.throwsAsync(access(blobsDir)) | ||
}) |