Skip to content

Commit

Permalink
Merge pull request #1 from SeonHyungJo/set-husky
Browse files Browse the repository at this point in the history
Set husky, lint-staged, jest
  • Loading branch information
SeonHyungJo authored Jan 14, 2020
2 parents 1907e08 + 6163003 commit b9d267f
Show file tree
Hide file tree
Showing 10 changed files with 3,759 additions and 87 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@ dist
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test
.vscode-test

.DS_Store
19 changes: 19 additions & 0 deletions __tests__/components/hello.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { getValue, getTestValue } from '@components/hello';

test('getValue Testing', () => {
const expectValue: string = 'test';
const resultValue: string = getValue();

expect(expectValue).toBe(resultValue);
});

test('getTestValue Testing', () => {
const expectTrueValue: string = 'TrueValue';
const expectFalseValue: string = 'FalseValue';

const resultTrueValue: string = getTestValue(true);
const resultFalseValue: string = getTestValue(false);

expect(expectTrueValue).toBe(resultTrueValue);
expect(expectFalseValue).toBe(resultFalseValue);
});
8 changes: 8 additions & 0 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { indexFunction } from '@src/index';

test('indexFunction Testing', () => {
const expectValue: string = 'index';
const resultValue: string = indexFunction();

expect(expectValue).toBe(resultValue);
});
28 changes: 28 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const config = {
rootDir: '.',
preset: 'ts-jest',
roots: ['<rootDir>/__tests__'],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(ts?)$',
moduleFileExtensions: ['ts', 'js'],
testEnvironment: 'node',
moduleNameMapper: {
'@src/(.*)$': '<rootDir>/src/$1',
'@components/(.*)$': '<rootDir>/src/components/$1',
'@githubApi/(.*)$': '<rootDir>/src/github-api/$1',
'@redux/(.*)$': '<rootDir>/src/redux/$1',
'@model/(.*)$': '<rootDir>/src/model/$1',
'@util/(.*)$': '<rootDir>/src/util/$1',
},
collectCoverage: false,
collectCoverageFrom: ['**/*.{ts,}', '!**/node_modules/**', '!**/dist/**'],
coverageThreshold: {
global: {
branches: 50,
functions: 50,
lines: 50,
statements: 50,
},
},
};

module.exports = config;
Loading

0 comments on commit b9d267f

Please sign in to comment.