Skip to content

Commit f56fd19

Browse files
committed
fixup! test: add unit and e2e tests for monorepo symlinked assets
1 parent ccfabe3 commit f56fd19

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

  • packages
    • angular_devkit/build_angular/src/builders/browser/tests/options
    • angular/build/src/builders/application/tests/options

‎packages/angular/build/src/builders/application/tests/options/assets_spec.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
508508
.content.toBe('shared nested asset');
509509
});
510510

511-
it('copies a symlinked file pointing outside the workspace root', async () => {
511+
it('does not copy a symlinked file pointing outside the workspace root by default', async () => {
512512
const symlinkPath = harness.resolvePath('src/external-file.txt');
513513
await fs.symlink(path.join(externalDir, 'shared-root.txt'), symlinkPath, 'file');
514514

@@ -519,6 +519,21 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
519519

520520
const { result } = await harness.executeOnce();
521521

522+
expect(result?.success).toBe(true);
523+
harness.expectFile('dist/browser/external-file.txt').toNotExist();
524+
});
525+
526+
it('copies a symlinked file pointing outside the workspace root with followSymlinks: true', async () => {
527+
const symlinkPath = harness.resolvePath('src/external-file.txt');
528+
await fs.symlink(path.join(externalDir, 'shared-root.txt'), symlinkPath, 'file');
529+
530+
harness.useTarget('build', {
531+
...BASE_OPTIONS,
532+
assets: [{ glob: 'external-file.txt', input: 'src', output: '.', followSymlinks: true }],
533+
});
534+
535+
const { result } = await harness.executeOnce();
536+
522537
expect(result?.success).toBe(true);
523538
harness.expectFile('dist/browser/external-file.txt').content.toBe('shared root asset');
524539
});

‎packages/angular_devkit/build_angular/src/builders/browser/tests/options/assets_spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
import assert from 'node:assert';
10-
import * as fs from 'node:fs/promises';
11-
import * as path from 'node:path';
10+
import fs from 'node:fs/promises';
11+
import path from 'node:path';
1212
import { buildWebpackBrowser } from '../../index';
1313
import { BASE_OPTIONS, BROWSER_BUILDER_INFO, describeBuilder } from '../setup';
1414

0 commit comments

Comments
 (0)