mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[optimizer] pretty-print jest snapshots to help reviews (#119404)
This commit is contained in:
parent
220c8e9729
commit
03afedefe8
2 changed files with 625 additions and 9 deletions
File diff suppressed because one or more lines are too long
|
@ -10,6 +10,7 @@ import Path from 'path';
|
|||
import Fs from 'fs';
|
||||
import Zlib from 'zlib';
|
||||
import { inspect } from 'util';
|
||||
import prettier from 'prettier';
|
||||
|
||||
import cpy from 'cpy';
|
||||
import del from 'del';
|
||||
|
@ -245,9 +246,13 @@ it('prepares assets for distribution', async () => {
|
|||
* Verifies that the file matches the expected output and has matching compressed variants.
|
||||
*/
|
||||
const expectFileMatchesSnapshotWithCompression = (filePath: string, snapshotLabel: string) => {
|
||||
const raw = Fs.readFileSync(Path.resolve(MOCK_REPO_DIR, filePath), 'utf8');
|
||||
const path = Path.resolve(MOCK_REPO_DIR, filePath);
|
||||
const raw = Fs.readFileSync(path, 'utf8');
|
||||
const pretty = prettier.format(raw, {
|
||||
filepath: path,
|
||||
});
|
||||
|
||||
expect(raw).toMatchSnapshot(snapshotLabel);
|
||||
expect(pretty).toMatchSnapshot(snapshotLabel);
|
||||
|
||||
// Verify the brotli variant matches
|
||||
expect(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue