* Assert a list of files to match snapshots * @param {object} options Options * - exists: assert the file exists or not * - rootPath: rootPath for file names * @param {...string} files
(options, ...files)
| 28 | * @param {...string} files |
| 29 | */ |
| 30 | function assertFilesToMatchSnapshot(options, ...files) { |
| 31 | options = {exists: true, ...options}; |
| 32 | if (options.rootPath) { |
| 33 | files = files.map(f => path.resolve(options.rootPath, f)); |
| 34 | } |
| 35 | |
| 36 | for (const f of files) { |
| 37 | if (options.exists === false) { |
| 38 | assert.noFile(f); |
| 39 | break; |
| 40 | } |
| 41 | assert.file(f); |
| 42 | expectFileToMatchSnapshot(f); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | module.exports = { |
| 47 | expectToMatchSnapshot, |
no test coverage detected