Merge pull request #8173 from backstage/rugvip/best

cli: test coverage and speed improvements
This commit is contained in:
Patrik Oldsberg
2021-11-22 10:24:11 +01:00
committed by GitHub
4 changed files with 16 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Switch the default test coverage provider from the jest default one to `'v8'`, which provides much better coverage information when using the default Backstage test setup. This is considered a bug fix as the current coverage information is often very inaccurate.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Disable ES transforms in tests transformed by the `jestSucraseTransform.js`. This is not considered a breaking change since all code is already transpiled this way in the development setup.
+1
View File
@@ -95,6 +95,7 @@ async function getProjectConfig(targetPath, displayName) {
...(displayName && { displayName }),
rootDir: path.resolve(targetPath, 'src'),
coverageDirectory: path.resolve(targetPath, 'coverage'),
coverageProvider: 'v8',
collectCoverageFrom: ['**/*.{js,jsx,ts,tsx}', '!**/*.d.ts'],
moduleNameMapper: {
'\\.(css|less|scss|sss|styl)$': require.resolve('jest-css-modules'),
+5 -1
View File
@@ -46,7 +46,11 @@ function process(source, filePath) {
}
if (transforms) {
return transform(source, { transforms, filePath }).code;
return transform(source, {
transforms,
filePath,
disableESTransforms: true,
}).code;
}
return source;