-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: unit test infrastructure #313
Draft
Irinaa133
wants to merge
11
commits into
qiwi:master
Choose a base branch
from
Irinaa133:unit-tests-infrastructure
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f5016da
feat: unit test infrastructure
Irinaa133 c4a1fc8
fix: move packages to dev-dependencies
Irinaa133 251912e
feat: tsbuildinfo
Irinaa133 9c76e33
feat: projects in jest config
Irinaa133 e25c88d
fix: jest config
Irinaa133 108138e
feat: add test jest
Irinaa133 e84823e
feat: add script yarn test to travis
Irinaa133 7ba8bc3
style: sort package.json
Irinaa133 20bf6ec
feat: add coverage, ignore /coverage
Irinaa133 2bc11e5
fix: coverage
Irinaa133 8268de5
fix: remove global jest-config
Irinaa133 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ | |
/node_modules | ||
/packages/*/node_modules | ||
/packages/*/lib | ||
/packages/*/buildcache | ||
/coverage | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {configure} from 'enzyme' | ||
|
||
const Adapter = require('enzyme-adapter-react-16') | ||
|
||
configure({ | ||
adapter: new Adapter(), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const {pathsToModuleNameMapper} = require('ts-jest/utils') | ||
|
||
const {compilerOptions} = require('../../tsconfig') | ||
|
||
module.exports = { | ||
rootDir: '../../', | ||
preset: 'ts-jest', | ||
globals: { | ||
'ts-jest': { | ||
'tsConfig': '<rootDir>/tsconfig.json', | ||
}, | ||
}, | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest', | ||
}, | ||
transformIgnorePatterns: ['/node_modules/(?!@qiwi).+ \\ .js $'], | ||
testMatch: ['**/core/**/test/**/*.+(ts|tsx)'], | ||
collectCoverage: true, | ||
collectCoverageFrom: [ | ||
'**/core/src/*/*.ts{,x}', | ||
], | ||
coverageDirectory: '<rootDir>/coverage/core', | ||
coveragePathIgnorePatterns: ['node_modules', 'index.ts'], | ||
snapshotSerializers: ['enzyme-to-json/serializer'], | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], | ||
moduleNameMapper: { | ||
...pathsToModuleNameMapper(compilerOptions.paths, {prefix: '<rootDir>/packages/'}), | ||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|)$': 'jest-mock', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe('test jest', () => { | ||
it('jest runner', () => { | ||
expect(true).toBeTruthy() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const {pathsToModuleNameMapper} = require('ts-jest/utils') | ||
|
||
const {compilerOptions} = require('../../tsconfig') | ||
|
||
module.exports = { | ||
rootDir: '../../', | ||
preset: 'ts-jest', | ||
globals: { | ||
'ts-jest': { | ||
'tsConfig': '<rootDir>/tsconfig.json', | ||
}, | ||
}, | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest', | ||
}, | ||
transformIgnorePatterns: ['/node_modules/(?!@qiwi).+ \\ .js $'], | ||
testMatch: ['**/desktop/**/test/**/*.+(ts|tsx)'], | ||
collectCoverage: true, | ||
collectCoverageFrom: [ | ||
'**/desktop/src/*/*.ts{,x}', | ||
], | ||
coverageDirectory: '<rootDir>/coverage/desktop', | ||
coveragePathIgnorePatterns: ['node_modules', 'index.ts'], | ||
snapshotSerializers: ['enzyme-to-json/serializer'], | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], | ||
moduleNameMapper: { | ||
...pathsToModuleNameMapper(compilerOptions.paths, {prefix: '<rootDir>/packages/'}), | ||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|)$': 'jest-mock', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
{ | ||
"name": "@qiwi/pijma-desktop", | ||
"version": "1.111.0", | ||
"license": "MIT", | ||
"main": "lib/es5/index.js", | ||
"types": "lib/es5/index.d.ts", | ||
"license": "MIT", | ||
"scripts": { | ||
"clean": "rm -rf lib styleguide/lib", | ||
"build": "mkdir -p lib/es5 && tsc -p tsconfig.build.json && styleguidist build", | ||
"watch": "styleguidist server", | ||
"lint": "tslint -p tsconfig.build.json src/**/*.ts{,x}", | ||
"lint:fix": "tslint -p tsconfig.build.json --fix src/**/*.ts{,x}", | ||
"guide": "gh-pages -d styleguide/lib -e desktop -m \"update desktop style guide v$npm_package_version\"", | ||
"guide_ci": "gh-pages -d styleguide/lib -e desktop -m \"update desktop style guide v$npm_package_version\" -r \"https://[email protected]/qiwi/pijma.git\"" | ||
}, | ||
"files": [ | ||
"README.md", | ||
"CHANGELOG.md", | ||
"lib" | ||
], | ||
"scripts": { | ||
"prebuild": "rimraf buildcache", | ||
"build": "mkdir -p lib/es5 && tsc -p tsconfig.build.json && styleguidist build", | ||
"clean": "rm -rf lib styleguide/lib", | ||
"guide": "gh-pages -d styleguide/lib -e desktop -m \"update desktop style guide v$npm_package_version\"", | ||
"guide_ci": "gh-pages -d styleguide/lib -e desktop -m \"update desktop style guide v$npm_package_version\" -r \"https://[email protected]/qiwi/pijma.git\"", | ||
"lint": "tslint -p tsconfig.build.json src/**/*.ts{,x}", | ||
"lint:fix": "tslint -p tsconfig.build.json --fix src/**/*.ts{,x}", | ||
"test": "jest", | ||
"watch": "styleguidist server" | ||
}, | ||
"dependencies": { | ||
"@emotion/core": "^10.0.16", | ||
"@emotion/styled": "^10.0.15", | ||
|
@@ -39,12 +41,19 @@ | |
"tslib": "^1.10.0" | ||
}, | ||
"devDependencies": { | ||
"@types/enzyme": "^3.10.5", | ||
"@types/jest": "^25.2.1", | ||
"@types/webpack-env": "1.14.0", | ||
"enzyme": "^3.11.0", | ||
"enzyme-adapter-react-16": "^1.15.2", | ||
"enzyme-to-json": "^3.4.4", | ||
"file-loader": "4.2.0", | ||
"gh-pages": "2.1.1", | ||
"husky": "3.0.3", | ||
"jest": "^25.4.0", | ||
"react-docgen-typescript": "1.12.5", | ||
"react-styleguidist": "9.1.14", | ||
"ts-jest": "^25.4.0", | ||
"ts-loader": "6.0.4", | ||
"tslint": "5.18.0", | ||
"tslint-config-qiwi": "1.1.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe('test jest', () => { | ||
it('jest runner', () => { | ||
expect(true).toBeTruthy() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const {pathsToModuleNameMapper} = require('ts-jest/utils') | ||
|
||
const {compilerOptions} = require('../../tsconfig') | ||
|
||
module.exports = { | ||
rootDir: '../../', | ||
preset: 'ts-jest', | ||
globals: { | ||
'ts-jest': { | ||
'tsConfig': '<rootDir>/tsconfig.json', | ||
}, | ||
}, | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest', | ||
}, | ||
transformIgnorePatterns: ['/node_modules/(?!@qiwi).+ \\ .js $'], | ||
testMatch: ['**/mobile/**/test/**/*.+(ts|tsx)'], | ||
collectCoverage: true, | ||
collectCoverageFrom: [ | ||
'**/mobile/src/*/*.ts{,x}', | ||
], | ||
coverageDirectory: '<rootDir>/coverage/mobile', | ||
coveragePathIgnorePatterns: ['node_modules', 'index.ts'], | ||
snapshotSerializers: ['enzyme-to-json/serializer'], | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], | ||
moduleNameMapper: { | ||
...pathsToModuleNameMapper(compilerOptions.paths, {prefix: '<rootDir>/packages/'}), | ||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|)$': 'jest-mock', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
{ | ||
"name": "@qiwi/pijma-mobile", | ||
"version": "1.111.0", | ||
"license": "MIT", | ||
"main": "lib/es5/index.js", | ||
"types": "lib/es5/index.d.ts", | ||
"license": "MIT", | ||
"scripts": { | ||
"clean": "rm -rf lib styleguide/lib", | ||
"build": "mkdir -p lib/es5 && tsc -p tsconfig.build.json && styleguidist build", | ||
"watch": "styleguidist server", | ||
"lint": "tslint -p tsconfig.build.json src/**/*.ts{,x}", | ||
"lint:fix": "tslint -p tsconfig.build.json --fix src/**/*.ts{,x}", | ||
"guide": "gh-pages -d styleguide/lib -e mobile -m \"update mobile style guide v$npm_package_version\"", | ||
"guide_ci": "gh-pages -d styleguide/lib -e mobile -m \"update mobile style guide v$npm_package_version\" -r \"https://[email protected]/qiwi/pijma.git\"" | ||
}, | ||
"files": [ | ||
"README.md", | ||
"CHANGELOG.md", | ||
"lib" | ||
], | ||
"scripts": { | ||
"prebuild": "rimraf buildcache", | ||
"build": "mkdir -p lib/es5 && tsc -p tsconfig.build.json && styleguidist build", | ||
"clean": "rm -rf lib styleguide/lib", | ||
"guide": "gh-pages -d styleguide/lib -e mobile -m \"update mobile style guide v$npm_package_version\"", | ||
"guide_ci": "gh-pages -d styleguide/lib -e mobile -m \"update mobile style guide v$npm_package_version\" -r \"https://[email protected]/qiwi/pijma.git\"", | ||
"lint": "tslint -p tsconfig.build.json src/**/*.ts{,x}", | ||
"lint:fix": "tslint -p tsconfig.build.json --fix src/**/*.ts{,x}", | ||
"test": "jest", | ||
"watch": "styleguidist server" | ||
}, | ||
"dependencies": { | ||
"@emotion/core": "^10.0.16", | ||
"@emotion/styled": "^10.0.15", | ||
|
@@ -39,12 +41,19 @@ | |
"tslib": "^1.10.0" | ||
}, | ||
"devDependencies": { | ||
"@types/enzyme": "^3.10.5", | ||
Irinaa133 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"@types/jest": "^25.2.1", | ||
"@types/webpack-env": "1.14.0", | ||
"enzyme": "^3.11.0", | ||
"enzyme-adapter-react-16": "^1.15.2", | ||
"enzyme-to-json": "^3.4.4", | ||
"file-loader": "4.2.0", | ||
"gh-pages": "2.1.1", | ||
"husky": "3.0.3", | ||
"jest": "^25.4.0", | ||
"react-docgen-typescript": "1.12.5", | ||
"react-styleguidist": "9.1.14", | ||
"ts-jest": "^25.4.0", | ||
"ts-loader": "6.0.4", | ||
"tslint": "5.18.0", | ||
"tslint-config-qiwi": "1.1.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe('test jest', () => { | ||
it('jest runner', () => { | ||
expect(true).toBeTruthy() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
{ | ||
"extends": "./tsconfig.base.json", | ||
|
||
"exclude": ["node_modules"], | ||
|
||
"compilerOptions": { | ||
"jsx": "react", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. доп параметры на билд не влияют? все норм пашет потом? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. все работает |
||
"lib": ["dom", "esnext"], | ||
"module": "esnext", | ||
"esModuleInterop": true, | ||
|
||
"baseUrl": "./packages", | ||
"paths": { | ||
"@qiwi/pijma-core": [ | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
таки может /packages/*/coverage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не-а. Там и корне будет coverage.