assertDirectoryContents(expectedFiles, directory = '') {
        const targetDirectory = path.join(this.webpackConfig.outputPath, directory);

        expect(targetDirectory).to.be.a.directory();

        const expectedFileStrings = {};
        expectedFiles.forEach((expectedFile) => {
            expectedFileStrings[expectedFile] = convertFilenameToMatcher(expectedFile);
        });

        const actualFiles = fs.readdirSync(targetDirectory);
        actualFiles.forEach((foundFile) => {
            // filter out directories
            if (fs.statSync(path.join(targetDirectory, foundFile)).isDirectory()) {
                return;
            }

            let matchIsFound = false;

            for (const originalFilename of Object.keys(expectedFileStrings)) {
                const filenameRegex = expectedFileStrings[originalFilename];

                if (foundFile.match(filenameRegex)) {
                    matchIsFound = true;
                    delete expectedFileStrings[originalFilename];

                    break;
                }
            }

            if (!matchIsFound) {
                throw new Error(`File "${foundFile}" was found in directory but was not expected. Expected patterns where ${expectedFiles.join(', ')}`);
            }
        });

        if (Object.keys(expectedFileStrings).length > 0) {
            throw new Error(`Files ${Object.keys(expectedFileStrings).join(', ')} were expected to be found in the directory but were not. Actual files: ${actualFiles.join(', ')}`);
        }
    }
Verifies that the directory contains the array of files.

The expectedFiles can contain a [hash:8] syntax in case
the file is versioned - e.g. main.[hash:8].js, which would
match a real file like main.abcd1234.js.

@param {Array} expectedFiles
@param {string} directory relative to output to check
@returns {void}