@toptal/davinci-qa 5.5.1-alpha-remove-display-name-from-code-templates.2 → 5.5.1-alpha-chore-improve-unit-tests-gh-workflow.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-qa",
3
- "version": "5.5.1-alpha-remove-display-name-from-code-templates.2+052cbcbe",
3
+ "version": "5.5.1-alpha-chore-improve-unit-tests-gh-workflow.4+36bb7e0c",
4
4
  "description": "QA package to test your application",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -33,14 +33,16 @@
33
33
  "@babel/preset-env": "^7.16.4",
34
34
  "@babel/preset-react": "^7.10.4",
35
35
  "@babel/preset-typescript": "^7.10.4",
36
+ "@cypress/code-coverage": "^3.9.12",
36
37
  "@cypress/webpack-preprocessor": "^5.7.0",
37
38
  "@testing-library/jest-dom": "^5.14.1",
38
39
  "@testing-library/react": "^12.1.2",
39
- "@toptal/davinci-cli-shared": "1.5.2-alpha-remove-display-name-from-code-templates.4+052cbcbe",
40
+ "@toptal/davinci-cli-shared": "1.5.2-alpha-chore-improve-unit-tests-gh-workflow.6+36bb7e0c",
40
41
  "@types/jest": "^27.0.3",
41
42
  "babel-jest": "^26.3.0",
42
43
  "cypress": "^9.4.1",
43
44
  "fs-extra": "^10.0.0",
45
+ "glob": "^7.2.0",
44
46
  "jest": "^26.6.3",
45
47
  "jest-html-reporters": "^2.1.6",
46
48
  "jest-junit": "^13.0.0",
@@ -50,5 +52,5 @@
50
52
  "matchmedia-polyfill": "^0.3.2",
51
53
  "semver": "^7.3.2"
52
54
  },
53
- "gitHead": "052cbcbef56c98d569c48fa8f950939429276c02"
55
+ "gitHead": "36bb7e0c9554587627389ad689e8ec2b28477121"
54
56
  }
@@ -1,5 +1,14 @@
1
- const cypressTypeScriptPreprocessor = require('./webpack-preprocessor')
1
+ const { webpackPreprocessor } = require('./webpack-preprocessor')
2
2
 
3
- module.exports = on => {
4
- on('file:preprocessor', cypressTypeScriptPreprocessor)
3
+ module.exports = (on, config) => {
4
+ // generate code coverage
5
+ require('@cypress/code-coverage/task')(on, config)
6
+
7
+ // instrument code for code coverage
8
+ on('file:preprocessor', webpackPreprocessor)
9
+
10
+ // split spec files in CI
11
+ require('./parallelization')(config)
12
+
13
+ return config
5
14
  }
@@ -0,0 +1,23 @@
1
+ const fs = require('fs')
2
+ const glob = require('glob')
3
+ const path = require('path')
4
+
5
+ const sizeOf = file => fs.statSync(file).size
6
+
7
+ module.exports = config => {
8
+ const groupIndex = parseInt(process.env.GROUP_INDEX || 0, 10)
9
+ const total = parseInt(process.env.PARALLEL_GROUPS || 1, 10)
10
+
11
+ if (groupIndex < 0 || total <= 1) {
12
+ return
13
+ }
14
+
15
+ const { integrationFolder, testFiles } = config
16
+
17
+ const specPattern = Array.isArray(testFiles) ? `{${testFiles.join(',')}}` : testFiles
18
+ const specs = glob.sync(path.join(integrationFolder, specPattern))
19
+
20
+ config.testFiles = specs
21
+ .sort((lhs, rhs) => sizeOf(rhs) - sizeOf(lhs))
22
+ .filter((_, index) => index % total === groupIndex)
23
+ }
@@ -1,9 +1,28 @@
1
1
  const webpack = require('@cypress/webpack-preprocessor')
2
- const { createWebpackConfig } = require('@toptal/davinci-engine')
3
2
 
4
3
  const options = {
5
- webpackOptions: createWebpackConfig('production'),
4
+ webpackOptions: {
5
+ mode: 'development',
6
+ module: {
7
+ rules: [
8
+ {
9
+ test: /\.[tj]sx?$/,
10
+ exclude: [/node_modules/],
11
+ use: [{
12
+ loader: 'babel-loader',
13
+ options: {
14
+ presets: ['@babel/preset-env'],
15
+ plugins: ['istanbul']
16
+ },
17
+ }],
18
+ },
19
+ ],
20
+ },
21
+ },
6
22
  watchOptions: {}
7
23
  }
8
24
 
9
- module.exports = webpack(options)
25
+ module.exports = {
26
+ options,
27
+ webpackPreprocessor: webpack(options),
28
+ }
@@ -13,8 +13,5 @@
13
13
  // https://on.cypress.io/configuration
14
14
  // ***********************************************************
15
15
 
16
- // Import commands.js using ES2015 syntax:
17
- // import './commands'
18
-
19
- // Alternatively you can use CommonJS syntax:
20
- // require('./commands')
16
+ // support for code coverage
17
+ import '@cypress/code-coverage/support'