Skip to content
This repository was archived by the owner on Oct 27, 2020. It is now read-only.

Commit a1afd7e

Browse files
committed
fix(test): use dynamic filename
1 parent 6cba364 commit a1afd7e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/cacheAddedFiles-option.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ const mockWebpackWithAddedFilesConfig = {
2121
},
2222
};
2323

24-
const cachedImageFilename = '92be28d7dfd7b29034ae9500cc94e7f2.png';
25-
2624
describe('cacheAddedFiles option', () => {
2725
beforeEach(() => {});
2826

@@ -31,11 +29,17 @@ describe('cacheAddedFiles option', () => {
3129
del.sync(mockRandomTmpDirForAddedFiles, { force: true });
3230
});
3331

32+
let cachedImageFilename;
33+
3434
it('should not cache added files', async () => {
3535
const testId = './img/index.js';
3636
const stats = await webpack(testId, mockWebpackConfig);
3737
const cachedStats = await webpack(testId, mockWebpackConfig);
3838

39+
cachedImageFilename = Object.keys(stats.compilation.assets).find((c) =>
40+
c.endsWith('.png')
41+
);
42+
3943
expect(stats.compilation.warnings).toMatchSnapshot('warnings');
4044
expect(stats.compilation.errors).toMatchSnapshot('errors');
4145
expect(cachedStats.compilation.warnings).toMatchSnapshot('warnings');

0 commit comments

Comments
 (0)