add jest setup, WIP porting tests

This commit is contained in:
Kevin Qi 2019-04-20 22:46:48 -07:00
parent f92da8dbc9
commit c0efc187a1
6 changed files with 3275 additions and 341 deletions

3
.gitignore vendored
View File

@ -4,6 +4,9 @@
# distribution folder
/dist
# coverage
/coverage
.DS_Store
npm-debug.log*

5
demo/.env Normal file
View File

@ -0,0 +1,5 @@
# This is used to skip the error where
# e.g. babel-jest is a sub-dependency in the parent dir
# but is also used by react-scripts:
# "There might be a problem with the project dependency tree"
SKIP_PREFLIGHT_CHECK=true

9
jest.config.json Normal file
View File

@ -0,0 +1,9 @@
{
"rootDir": "src",
"transform": {
"^.+\\.(t|j)sx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
"coverageDirectory": "<rootDir>/../coverage"
}

View File

@ -24,12 +24,15 @@
"clean": "rimraf dist",
"format": "prettier --write 'src/**/*' 'demo/src/**/*'",
"prepare": "npm run clean && npm run build",
"start": "tsc -w"
"start": "tsc -w",
"test": "jest --config jest.config.json --coverage"
},
"devDependencies": {
"@types/jest": "^24.0.11",
"@types/react": "^16.8.14",
"chai": "^3.5.0",
"enzyme": "^2.3.0",
"jest": "^24.7.1",
"jsdom": "^9.0.0",
"mocha": "^3.3.0",
"npm-run-all": "^4.1.5",
@ -38,6 +41,7 @@
"react-addons-test-utils": "^15.0.2",
"react-dom": "^15.4.0",
"rimraf": "^2.3.4",
"ts-jest": "^24.0.2",
"typescript": "^3.4.4"
},
"dependencies": {

View File

@ -0,0 +1,5 @@
describe('<CircularProgressbar />', () => {
test('something', () => {
expect(true).toBe(true);
});
});

3588
yarn.lock

File diff suppressed because it is too large Load Diff