Skip to content

Asset.fingerprint() does not handle excludes correctly #7718

@christophgysin

Description

@christophgysin

When creating an asset from a directory with certain exclude options, the fingerprint does not change even if the files change.

Reproduction Steps

Add to packages/@aws-cdk/assets/test/fs/test.fs-fingerprint.ts

'considers negated exclude patterns for fingerprint'(test: Test) {
  // GIVEN
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'fingerprint-tests'));
  const options = {path: dir, exclude: ['**', '!file.txt'], sourcePath: dir};

  // WHEN
  const f1 = libfs.fingerprint(dir, options);
  fs.writeFileSync(path.join(dir, 'file.txt'), 'data');
  const f2 = libfs.fingerprint(dir, options);

  // THEN
  test.notDeepEqual(f1, f2);
  test.done();
},

Error Log

AssertionError: 'c917eba4ddad2e97bec2e1c5607246911cb811be0f87131042791f5525f69575' notDeepEqual 'c917eba4ddad2e97bec2e1c5607246911cb811be0f87131042791f5525f69575'

Environment

  • CLI Version : master
  • Framework Version: master
  • OS : linux
  • Language : typescript

Other


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/assetsRelated to the @aws-cdk/assets packagebugThis issue is a bug.in-progressThis issue is being actively worked on.needs-triageThis issue or PR still needs to be triaged.p1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions