Skip to content

Commit

Permalink
feat(Hooks): configure tests and documentation for hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
hamikhambardzumyan committed Apr 18, 2024
1 parent 7658172 commit 7565149
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ module.exports = {
'./../stories/changelog.mdx',
'./../stories/gettingStarted.mdx',
'./../src/lib/**/**/*.stories.tsx',
'./../stories/*/**/*.stories.jsx'
'./../stories/**/**/*.stories.jsx',
'./../src/hooks/**/*.mdx'
],
addons: [
'@storybook/preset-scss',
Expand Down Expand Up @@ -40,7 +41,7 @@ module.exports = {
lib: '../src/lib/',
wrappers: '../src/wrappers/index.js',
configs: '../src/configs.js',
hooks: '../src/hooks/index.js',
hooks: '../src/hooks/index.ts',
indexof: '../src/utils/indexof.js',
stories: '../stories/',
components: '../src/index.ts'
Expand Down
11 changes: 10 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@ export const parameters = {
},
options: {
storySort: {
order: ['Introduction', 'Changelog', 'Atoms', 'Molecules', 'Organisms', 'Charts']
order: [
'Introduction',
'Changelog',
'Getting started',
'Atoms',
'Molecules',
'Organisms',
'Charts',
'Hooks'
]
}
}
};
Expand Down
3 changes: 2 additions & 1 deletion configs/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ docs
**/*.svg

**/*.mdx
**/*.md

**/*.ico
**/*.ico
10 changes: 8 additions & 2 deletions configs/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ module.exports = {
'^components$': '<rootDir>/src/index.ts'
},
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
testMatch: ['**/?(*.)+(test).tsx'], // TODO add .ts also for helpers and hooks
collectCoverageFrom: ['src/**/*.tsx', '!src/**/*.d.ts', '!src/**/*.stories.tsx'], // TODO add .ts also for helpers and hooks
testMatch: ['**/?(*.)+(test).tsx'], // TODO add .ts also for helpers
collectCoverageFrom: [
'src/**/*.tsx',
'src/hooks/**/*.ts',
'!src/hooks/index.ts',
'!src/**/*.d.ts',
'!src/**/*.stories.tsx'
], // TODO add .ts also for helpers
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
transformIgnorePatterns: ['<rootDir>/node_modules/(?!react-dnd|dnd-core|@react-dnd)'],
modulePathIgnorePatterns: ['node_modules', 'jest-test-results.json']
Expand Down
4 changes: 2 additions & 2 deletions configs/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const componentsInputs = Object.entries({

const hooks = getFiles('src/hooks').reduce((acc, path) => {
const [hookPath] = path.split('/').reverse();
const hookName = hookPath.replace('.js', '');
const hookName = hookPath.replace(/\.(js|ts)$/, '');
acc[hookName] = path;
return acc;
}, {});
Expand Down Expand Up @@ -107,7 +107,7 @@ export default {
utils: 'src/utils/index.js',
wrappers: 'src/wrappers/index.js',
configs: 'src/configs.js',
hooks: 'src/hooks/index.js',
hooks: 'src/hooks/index.ts',
indexof: 'src/utils/indexof.js',
components: 'src/index.ts'
}
Expand Down

0 comments on commit 7565149

Please sign in to comment.