@toptal/davinci-qa 5.5.0 → 5.5.1-alpha-pudek357-patch-1.0

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.0",
3
+ "version": "5.5.1-alpha-pudek357-patch-1.0+679c84fd",
4
4
  "description": "QA package to test your application",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -36,7 +36,7 @@
36
36
  "@cypress/webpack-preprocessor": "^5.7.0",
37
37
  "@testing-library/jest-dom": "^5.14.1",
38
38
  "@testing-library/react": "^12.1.2",
39
- "@toptal/davinci-cli-shared": "1.5.1",
39
+ "@toptal/davinci-cli-shared": "1.5.2-alpha-pudek357-patch-1.2+679c84fd",
40
40
  "@types/jest": "^27.0.3",
41
41
  "babel-jest": "^26.3.0",
42
42
  "cypress": "^9.4.1",
@@ -49,5 +49,6 @@
49
49
  "jsdom": "^16.5.2",
50
50
  "matchmedia-polyfill": "^0.3.2",
51
51
  "semver": "^7.3.2"
52
- }
52
+ },
53
+ "gitHead": "679c84fd56b734e8e9a7c09b2564521b17a40f26"
53
54
  }
@@ -1,53 +0,0 @@
1
- {
2
- "name": "@toptal/davinci-qa",
3
- "version": "5.5.0",
4
- "description": "QA package to test your application",
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
- "keywords": [
9
- "qa",
10
- "testing"
11
- ],
12
- "author": "Toptal",
13
- "homepage": "https://github.com/toptal/davinci/tree/master/packages/qa#readme",
14
- "license": "ISC",
15
- "bin": {
16
- "davinci-qa": "./bin/davinci-qa.js"
17
- },
18
- "main": "./src/index.js",
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/toptal/davinci.git"
22
- },
23
- "scripts": {
24
- "build:package": "../../bin/build-package.js",
25
- "prepublishOnly": "../../bin/prepublish.js",
26
- "test": "echo \"Error: run tests from root\" && exit 1"
27
- },
28
- "bugs": {
29
- "url": "https://github.com/toptal/davinci/issues"
30
- },
31
- "dependencies": {
32
- "@babel/core": "^7.14.8",
33
- "@babel/preset-env": "^7.16.4",
34
- "@babel/preset-react": "^7.10.4",
35
- "@babel/preset-typescript": "^7.10.4",
36
- "@cypress/webpack-preprocessor": "^5.7.0",
37
- "@testing-library/jest-dom": "^5.14.1",
38
- "@testing-library/react": "^12.1.2",
39
- "@toptal/davinci-cli-shared": "1.5.1",
40
- "@types/jest": "^27.0.3",
41
- "babel-jest": "^26.3.0",
42
- "cypress": "^9.4.1",
43
- "fs-extra": "^10.0.0",
44
- "jest": "^26.6.3",
45
- "jest-html-reporters": "^2.1.6",
46
- "jest-junit": "^13.0.0",
47
- "jest-silent-reporter": "^0.5.0",
48
- "jest-styled-components": "^7.0.3",
49
- "jsdom": "^16.5.2",
50
- "matchmedia-polyfill": "^0.3.2",
51
- "semver": "^7.3.2"
52
- }
53
- }
@@ -1,65 +0,0 @@
1
- const convertToCLIParametersMock = jest.fn()
2
- const getPackageFilePathMock = jest.fn()
3
-
4
- jest.mock('@toptal/davinci-cli-shared', () => ({
5
- runSync: jest.fn(),
6
- print: {
7
- green: jest.fn()
8
- },
9
- convertToCLIParameters: convertToCLIParametersMock,
10
- files: {
11
- getPackageFilePath: getPackageFilePathMock
12
- }
13
- }))
14
-
15
- const { runSync } = require('@toptal/davinci-cli-shared')
16
-
17
- const { action } = require('./end-to-end-tests')
18
-
19
- describe('endToEndTestCommand', () => {
20
- it('runs cypress with default options', () => {
21
- convertToCLIParametersMock.mockReturnValueOnce([])
22
- getPackageFilePathMock.mockReturnValueOnce('packages/qa/src/configs/cypress.config.json')
23
-
24
- action({ options: {} })
25
-
26
- expect(runSync).toHaveBeenCalledWith('yarn', [
27
- 'cypress',
28
- 'run',
29
- '--config-file',
30
- 'packages/qa/src/configs/cypress.config.json'
31
- ])
32
-
33
- expect(convertToCLIParametersMock).toHaveBeenCalledWith({})
34
- expect(getPackageFilePathMock).toHaveBeenCalledWith(
35
- '@toptal/davinci-qa',
36
- 'src/configs/cypress.config.json'
37
- )
38
- })
39
-
40
- it('runs cypress with custom options', () => {
41
- const spec = 'cypress/integration/activation_flow.spec.ts'
42
-
43
- convertToCLIParametersMock.mockReturnValueOnce(['--spec', spec])
44
- getPackageFilePathMock.mockReturnValueOnce('packages/qa/src/configs/cypress.config.json')
45
-
46
- action({ options: { spec } })
47
-
48
- expect(runSync).toHaveBeenCalledWith('yarn', [
49
- 'cypress',
50
- 'run',
51
- '--config-file',
52
- 'packages/qa/src/configs/cypress.config.json',
53
- '--spec',
54
- spec
55
- ])
56
-
57
- expect(convertToCLIParametersMock).toHaveBeenCalledWith({
58
- spec
59
- })
60
- expect(getPackageFilePathMock).toHaveBeenCalledWith(
61
- '@toptal/davinci-qa',
62
- 'src/configs/cypress.config.json'
63
- )
64
- })
65
- })
@@ -1,123 +0,0 @@
1
- const JestAnvilReporter = require('./jest-anvil-reporter.js')
2
- const fs = require('fs')
3
- const { passedTestResults, failedTestResults, skippedTestResults, combinedTestResults } = require('./test-result-mocks')
4
-
5
- describe('Jest Anvil reporter', () => {
6
- const expectedPassedTestResults = {
7
- test_results: [
8
- [
9
- {
10
-
11
- file_name: "/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js",
12
- line_number: 2,
13
- status: "passed",
14
- duration: 3,
15
- scenario_name: "Example test suite/1 + 1 returns 2",
16
- description: "1 + 1 returns 2",
17
- error: null,
18
- backtrace: null,
19
- test_type: "unit",
20
- tag: "platform"
21
- }
22
- ]
23
- ]
24
- }
25
-
26
- const expectedFailedTestResults = {
27
- test_results: [
28
- [
29
- {
30
- file_name: "/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js",
31
- line_number: 2,
32
- status: "failed",
33
- duration: 6,
34
- scenario_name: "Example test suite/1 + 1 returns 3",
35
- description: "1 + 1 returns 3",
36
- error: "Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m3\u001b[39m\nReceived: \u001b[31m2\u001b[39m",
37
- backtrace: "Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m3\u001b[39m\nReceived: \u001b[31m2\u001b[39m\n at Object.<anonymous> (/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js:3:17)\n at Object.asyncJestTest (/davinci/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:45:12\n at new Promise (<anonymous>)\n at mapper (/davinci/node_modules/jest-jasmine2/build/queueRunner.js:28:19)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:75:41",
38
- test_type: "unit",
39
- tag: "platform"
40
- }
41
- ]
42
- ]
43
- }
44
-
45
- const expectedSkippedTestResults = {
46
- test_results: [
47
- [
48
- {
49
- file_name: "/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js",
50
- line_number: 2,
51
- status: "pending",
52
- duration: 0,
53
- scenario_name: "Example test suite/1 + 1 returns 2",
54
- description: "1 + 1 returns 2",
55
- error: null,
56
- backtrace: null,
57
- test_type: "unit",
58
- tag: "platform"
59
- }
60
- ]
61
- ]
62
- }
63
-
64
- const expectedCombinedTestResults = {
65
- test_results: [
66
- [
67
- {
68
- file_name: "/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js",
69
- line_number: 2,
70
- status: "passed",
71
- duration: 5,
72
- scenario_name: "Example test suite/1 + 1 returns 2 (passed)",
73
- description: "1 + 1 returns 2 (passed)",
74
- error: null,
75
- backtrace: null,
76
- test_type: "unit",
77
- tag: "platform"
78
- },
79
- {
80
- file_name: "/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js",
81
- line_number: 6,
82
- status: "failed",
83
- duration: 7,
84
- scenario_name: "Example test suite/1 + 1 returns 3 (failed)",
85
- description: "1 + 1 returns 3 (failed)",
86
- error: "Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m3\u001b[39m\nReceived: \u001b[31m2\u001b[39m",
87
- backtrace: "Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m3\u001b[39m\nReceived: \u001b[31m2\u001b[39m\n at Object.<anonymous> (/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js:7:17)\n at Object.asyncJestTest (/davinci/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:45:12\n at new Promise (<anonymous>)\n at mapper (/davinci/node_modules/jest-jasmine2/build/queueRunner.js:28:19)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:75:41",
88
- test_type: "unit",
89
- tag: "platform"
90
- },
91
- {
92
- file_name: "/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js",
93
- line_number: 10,
94
- status: "pending",
95
- duration: 0,
96
- scenario_name: "Example test suite/1 + 1 returns 2 (skipped)",
97
- description: "1 + 1 returns 2 (skipped)",
98
- error: null,
99
- backtrace: null,
100
- test_type: "unit",
101
- tag: "platform"
102
- }
103
- ]
104
- ]
105
- }
106
-
107
- beforeEach(() => {
108
- jest.clearAllMocks();
109
- });
110
-
111
- test.each`
112
- input | expectedOutput | testType
113
- ${passedTestResults} | ${expectedPassedTestResults} | ${"passing tests"}
114
- ${failedTestResults} | ${expectedFailedTestResults} | ${"failing tests"}
115
- ${skippedTestResults} | ${expectedSkippedTestResults} | ${"skipped tests"}
116
- ${combinedTestResults} | ${expectedCombinedTestResults} | ${"a combination of test results"}
117
- `('returns a payload matching Anvil for $testType', ({ input, expectedOutput, testType }) => {
118
- const spy = jest.spyOn(fs, 'writeFileSync')
119
- const jestAnvilReporter = new JestAnvilReporter(undefined, { anvilTag: 'platform' })
120
- jestAnvilReporter.onRunComplete(undefined, input)
121
- expect(spy).toBeCalledWith("./anvil_test_results.json", JSON.stringify(expectedOutput, undefined, 2), expect.anything())
122
- })
123
- })
@@ -1,59 +0,0 @@
1
- const getPackageFileContentMock = jest.fn()
2
-
3
- jest.mock('@toptal/davinci-cli-shared', () => ({
4
- files: {
5
- getPackageFileContent: getPackageFileContentMock
6
- }
7
- }))
8
-
9
- const jestArgsToCLIRules = require('./jest-args-to-cli-converters')
10
-
11
- describe('jestArgsToCLIRules "reporters"', () => {
12
- const reportersRule = jestArgsToCLIRules['reporters']
13
-
14
- it('converts correctly arrays', () => {
15
- expect(
16
- reportersRule(['reporter1', 'reporter2'])
17
- ).toEqual(['reporter1', 'reporter2'])
18
- })
19
-
20
- it('converts correctly string', () => {
21
- expect(
22
- reportersRule('reporter1')
23
- ).toEqual(['reporter1'])
24
- })
25
- })
26
-
27
- describe('jestArgsToCLIRules "setupFilesAfterEnv"', () => {
28
- const setupFilesAfterEnvRule = jestArgsToCLIRules['setupFilesAfterEnv']
29
-
30
- it('takes default values from the davinci jest.config.js file', () => {
31
- getPackageFileContentMock.mockReturnValueOnce({
32
- setupFilesAfterEnv: ['davinci-setup-files']
33
- })
34
-
35
- expect(
36
- setupFilesAfterEnvRule()
37
- ).toEqual(['davinci-setup-files'])
38
- })
39
-
40
- it('merges default values with passed setup files', () => {
41
- getPackageFileContentMock.mockReturnValueOnce({
42
- setupFilesAfterEnv: ['davinci-setup-files']
43
- })
44
-
45
- expect(
46
- setupFilesAfterEnvRule(['file1', 'file2'])
47
- ).toEqual(['davinci-setup-files', 'file1', 'file2'])
48
- })
49
-
50
- it('merges default values with single passed setup file', () => {
51
- getPackageFileContentMock.mockReturnValueOnce({
52
- setupFilesAfterEnv: ['davinci-setup-files']
53
- })
54
-
55
- expect(
56
- setupFilesAfterEnvRule('file1')
57
- ).toEqual(['davinci-setup-files', 'file1'])
58
- })
59
- })
@@ -1,78 +0,0 @@
1
- const styledComponentsVersionCheck = require('./styled-components-version-check')
2
-
3
- const successTest = (styledComponentsVersion, dependenciesKeys) => {
4
- const packageJson = {}
5
-
6
- dependenciesKeys.forEach(dependenciesKey => {
7
- packageJson[dependenciesKey] = {
8
- 'styled-components': styledComponentsVersion
9
- }
10
- })
11
-
12
- let error = null
13
- try {
14
- styledComponentsVersionCheck(packageJson)
15
- } catch (e) {
16
- error = e
17
- }
18
-
19
- expect(error).toBeNull()
20
- }
21
-
22
- const errorTest = (styledComponentsVersion, dependenciesKeys) => {
23
- const packageJson = {}
24
-
25
- dependenciesKeys.forEach(dependenciesKey => {
26
- packageJson[dependenciesKey] = {
27
- 'styled-components': styledComponentsVersion
28
- }
29
- })
30
-
31
- let error = null
32
- try {
33
- styledComponentsVersionCheck(packageJson)
34
- } catch (e) {
35
- error = e
36
- }
37
-
38
- expect(error).not.toBeNull()
39
- expect(error.message).toContain(styledComponentsVersion)
40
- }
41
-
42
- describe('styled-components version check', () => {
43
- describe('has wrong (^4.4.1) SC version in dependencies', () => {
44
- test('should throw an error', () => {
45
- errorTest('^4.4.1', ['dependencies'])
46
- })
47
- })
48
-
49
- describe('has correct (^5.0.1) SC version in dependencies', () => {
50
- test('should NOT throw an error', () => {
51
- successTest('^5.0.1', ['dependencies'])
52
- })
53
- })
54
-
55
- describe('has wrong (^4.4.1) SC version in devDependencies and peerDependencies', () => {
56
- test('should throw an error', () => {
57
- errorTest('^4.4.1', ['devDependencies', 'peerDependencies'])
58
- })
59
- })
60
-
61
- describe('has correct (^5.0.1) SC version in devDependencies and peerDependencies', () => {
62
- test('should NOT throw an error', () => {
63
- successTest('^5.0.1', ['devDependencies', 'peerDependencies'])
64
- })
65
- })
66
-
67
- describe('has wrong (^4.4.1) SC version in devDependencies', () => {
68
- test('should throw an error', () => {
69
- errorTest('^4.4.1', ['devDependencies'])
70
- })
71
- })
72
-
73
- describe('has correct (^5.0.1) SC version in devDependencies', () => {
74
- test('should NOT throw an error', () => {
75
- successTest('^5.0.1', ['devDependencies'])
76
- })
77
- })
78
- })
@@ -1,32 +0,0 @@
1
- const toJestCLIArguments = require('./to-jest-cli-arguments')
2
-
3
- const EXAMPLE_REPORTER = 'some-jest-reporter'
4
- const ARGS_TO_CLI_RESULT = [EXAMPLE_REPORTER]
5
-
6
- jest.mock('./jest-args-to-cli-converters.js', () => ({
7
- 'reporters': () => ARGS_TO_CLI_RESULT
8
- }))
9
-
10
- describe('toJestCLIArguments', () => {
11
- it('converts boolean strings to booleans correctly', () => {
12
- expect(
13
- toJestCLIArguments({
14
- cache: 'false',
15
- ci: 'true'
16
- })
17
- ).toEqual({
18
- cache: false,
19
- ci: true
20
- })
21
- })
22
-
23
- it('converts some rules by using args-to-cli rules', () => {
24
- expect(
25
- toJestCLIArguments({
26
- 'reporters': EXAMPLE_REPORTER
27
- })
28
- ).toEqual({
29
- 'reporters': ARGS_TO_CLI_RESULT
30
- })
31
- })
32
- })