forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular-devkit/build-angular):
deleteOutputPath
when using `es…
…build-builder` Prior to this change the `deleteOutputPath` was not being used in the esbuild-builder. Closes angular#26308
- Loading branch information
1 parent
49f503b
commit adc0db2
Showing
3 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...ar_devkit/build_angular/src/builders/application/tests/options/delete-output-path_spec.ts
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import { buildApplication } from '../../index'; | ||
import { APPLICATION_BUILDER_INFO, BASE_OPTIONS, describeBuilder } from '../setup'; | ||
|
||
describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => { | ||
describe('Option: "deleteOutputPath"', () => { | ||
beforeEach(async () => { | ||
// Application code is not needed for asset tests | ||
await harness.writeFile('src/main.ts', 'console.log("TEST");'); | ||
|
||
// Add file in output | ||
await harness.writeFile('dist/dummy.txt', ''); | ||
}); | ||
|
||
it(`should delete the output files when 'deleteOutputPath' is true`, async () => { | ||
harness.useTarget('build', { | ||
...BASE_OPTIONS, | ||
deleteOutputPath: true, | ||
}); | ||
|
||
const { result } = await harness.executeOnce(); | ||
expect(result?.success).toBeTrue(); | ||
harness.expectFile('dist/dummy.txt').toNotExist(); | ||
}); | ||
|
||
it(`should delete the output files when 'deleteOutputPath' is not set`, async () => { | ||
harness.useTarget('build', { | ||
...BASE_OPTIONS, | ||
deleteOutputPath: undefined, | ||
}); | ||
|
||
const { result } = await harness.executeOnce(); | ||
expect(result?.success).toBeTrue(); | ||
harness.expectFile('dist/dummy.txt').toNotExist(); | ||
}); | ||
|
||
it(`should delete the output files when 'deleteOutputPath' is false`, async () => { | ||
harness.useTarget('build', { | ||
...BASE_OPTIONS, | ||
deleteOutputPath: false, | ||
}); | ||
|
||
const { result } = await harness.executeOnce(); | ||
expect(result?.success).toBeTrue(); | ||
harness.expectFile('dist/dummy.txt').toExist(); | ||
}); | ||
}); | ||
}); |
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
55 changes: 55 additions & 0 deletions
55
...evkit/build_angular/src/builders/browser-esbuild/tests/options/delete-output-path_spec.ts
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import { buildEsbuildBrowser } from '../../index'; | ||
import { BASE_OPTIONS, BROWSER_BUILDER_INFO, describeBuilder } from '../setup'; | ||
|
||
describeBuilder(buildEsbuildBrowser, BROWSER_BUILDER_INFO, (harness) => { | ||
describe('Option: "deleteOutputPath"', () => { | ||
beforeEach(async () => { | ||
// Application code is not needed for asset tests | ||
await harness.writeFile('src/main.ts', 'console.log("TEST");'); | ||
|
||
// Add file in output | ||
await harness.writeFile('dist/dummy.txt', ''); | ||
}); | ||
|
||
it(`should delete the output files when 'deleteOutputPath' is true`, async () => { | ||
harness.useTarget('build', { | ||
...BASE_OPTIONS, | ||
deleteOutputPath: true, | ||
}); | ||
|
||
const { result } = await harness.executeOnce(); | ||
expect(result?.success).toBeTrue(); | ||
harness.expectFile('dist/dummy.txt').toNotExist(); | ||
}); | ||
|
||
it(`should delete the output files when 'deleteOutputPath' is not set`, async () => { | ||
harness.useTarget('build', { | ||
...BASE_OPTIONS, | ||
deleteOutputPath: undefined, | ||
}); | ||
|
||
const { result } = await harness.executeOnce(); | ||
expect(result?.success).toBeTrue(); | ||
harness.expectFile('dist/dummy.txt').toNotExist(); | ||
}); | ||
|
||
it(`should delete the output files when 'deleteOutputPath' is false`, async () => { | ||
harness.useTarget('build', { | ||
...BASE_OPTIONS, | ||
deleteOutputPath: false, | ||
}); | ||
|
||
const { result } = await harness.executeOnce(); | ||
expect(result?.success).toBeTrue(); | ||
harness.expectFile('dist/dummy.txt').toExist(); | ||
}); | ||
}); | ||
}); |