|
1 | 1 | import { access } from 'node:fs/promises'
|
2 |
| -import { join } from 'path' |
| 2 | +import { join, sep } from 'path' |
3 | 3 |
|
4 | 4 | import { Fixture } from '@netlify/testing'
|
5 | 5 | import test from 'ava'
|
6 | 6 |
|
7 | 7 | test('Build removes blobs directory before starting', async (t) => {
|
8 |
| - const fixture = await new Fixture('./fixtures/with_preexisting_blobs').withCopyRoot({ git: false }) |
| 8 | + const fixture = await new Fixture('./fixtures/with_preexisting_blobs') |
| 9 | + .withFlags({ debug: false, timeline: 'dev' }) |
| 10 | + .withCopyRoot() |
9 | 11 |
|
10 | 12 | const blobsDir = join(fixture.repositoryRoot, '.netlify', 'deploy', 'v1', 'blobs', 'deploy')
|
11 | 13 |
|
12 | 14 | await t.notThrowsAsync(access(blobsDir))
|
13 | 15 |
|
14 |
| - const { |
15 |
| - success, |
16 |
| - logs: { stdout }, |
17 |
| - } = await fixture |
18 |
| - .withFlags({ |
19 |
| - cwd: fixture.repositoryRoot, |
20 |
| - }) |
21 |
| - .runBuildProgrammatic() |
| 16 | + const output = await fixture.runDev(() => {}) |
22 | 17 |
|
23 |
| - t.true(success) |
24 |
| - t.true(stdout.join('\n').includes('Cleaning up leftover files from previous builds')) |
| 18 | + t.true(output.includes('Cleaning up leftover files from previous builds')) |
| 19 | + t.true(output.includes(`Cleaned up .netlify${sep}deploy${sep}v1${sep}blobs${sep}deploy`)) |
25 | 20 |
|
26 | 21 | await t.throwsAsync(access(blobsDir))
|
27 | 22 | })
|
28 | 23 |
|
29 | 24 | test('Build removes legacy blobs directory before starting', async (t) => {
|
30 |
| - const fixture = await new Fixture('./fixtures/with_preexisting_legacy_blobs').withCopyRoot({ git: false }) |
| 25 | + const fixture = await new Fixture('./fixtures/with_preexisting_legacy_blobs') |
| 26 | + .withFlags({ debug: false, timeline: 'dev' }) |
| 27 | + .withCopyRoot() |
31 | 28 |
|
32 | 29 | const blobsDir = join(fixture.repositoryRoot, '.netlify', 'blobs', 'deploy')
|
33 | 30 |
|
34 | 31 | await t.notThrowsAsync(access(blobsDir))
|
35 | 32 |
|
36 |
| - const { |
37 |
| - success, |
38 |
| - logs: { stdout }, |
39 |
| - } = await fixture |
40 |
| - .withFlags({ |
41 |
| - cwd: fixture.repositoryRoot, |
42 |
| - }) |
43 |
| - .runBuildProgrammatic() |
44 |
| - |
45 |
| - t.true(success) |
46 |
| - t.true(stdout.join('\n').includes('Cleaning up leftover files from previous builds')) |
| 33 | + const output = await fixture.runDev(() => {}) |
| 34 | + |
| 35 | + t.true(output.includes('Cleaning up leftover files from previous builds')) |
| 36 | + t.true(output.includes(`Cleaned up .netlify${sep}blobs${sep}deploy`)) |
47 | 37 |
|
48 | 38 | await t.throwsAsync(access(blobsDir))
|
49 | 39 | })
|
0 commit comments