Skip to content

Commit a50ffa5

Browse files
committed
fix: prettify CSS result from the @bolt/build-tools before doing snapshot diff
(cherry picked from commit b47f2dc)
1 parent b06c92f commit a50ffa5

File tree

3 files changed

+27310
-5
lines changed

3 files changed

+27310
-5
lines changed

packages/build-tools/__tests__/multi-lang/__snapshots__/index.js.snap

Lines changed: 27302 additions & 2 deletions
Large diffs are not rendered by default.

packages/build-tools/__tests__/multi-lang/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const path = require('path');
22
const fs = require('fs-extra');
3+
const prettier = require('prettier');
4+
const prettierConfig = { semi: false, parser: 'css' };
35

46
const buildDir = require('./.boltrc.multi-lang.js').buildDir;
57

@@ -68,8 +70,9 @@ describe('Tests to confirm that the latest upcoming release of the @bolt/build-t
6870
};
6971

7072
const cssFile = await getCSSData();
73+
const prettyCss = await prettier.format(cssFile, prettierConfig);
7174

72-
expect(cssFile).toMatchSnapshot();
75+
expect(prettyCss).toMatchSnapshot();
7376

7477
const japaneseFontRule =
7578
'font-family:-apple-system,BlinkMacSystemFont,ヒラギノ角ゴ ProN,Hiragino Kaku Gothic ProN,游ゴシック,游ゴシック体,YuGothic,Yu Gothic,メイリオ,Meiryo,MS ゴシック,MS Gothic,HiraKakuProN-W3,TakaoExゴシック,TakaoExGothic,MotoyaLCedar,Droid Sans Japanese,sans-serif;';
@@ -124,6 +127,7 @@ describe('Tests to confirm that the latest upcoming release of the @bolt/build-t
124127
),
125128
);
126129

127-
expect(cssFile).toMatchSnapshot();
130+
const prettyCss = await prettier.format(cssFile, prettierConfig);
131+
expect(prettyCss).toMatchSnapshot();
128132
});
129133
});

packages/testing/testing-jest/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"jest-serializer-html": "^7.0.0",
3636
"now-storage": "^1.3.0",
3737
"puppeteer-core": "^1.17.0",
38-
"raf": "^3.4.1"
38+
"raf": "^3.4.1",
39+
"prettier": "^1.18.2"
3940
},
4041
"publishConfig": {
4142
"access": "public"

0 commit comments

Comments
 (0)