Skip to content
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

chore(test): add tests for react components #231

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ src/composer.lock
/crowdin.deb
crowdin.yml
node_modules/
.npmrc
.npmrc
coverage/
1 change: 1 addition & 0 deletions .tsbuildinfo

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
'@babel/preset-react',
'@babel/preset-typescript',
],
plugins: [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this plugin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we don't need this because it's for Vite

function () {
return {
visitor: {
MetaProperty(path) {
/**
replace "import.meta" by "process" to access env in jest test
env for vite : https://vitejs.dev/guide/env-and-mode.html#env-variables
issue for jest : https://github.com/vitejs/vite/issues/1149
**/
path.replaceWithSourceString('process')
},
},
}
},
],
}
24 changes: 24 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable import/no-anonymous-default-export */
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
const { resolve } = require('path')
const coverageThreshold = require('./threshold-js.json')
const baseDir = __dirname
module.exports = {
clearMocks: true,
collectCoverage: true,
coverageDirectory: 'coverage',
coverageProvider: 'babel',
testEnvironment: 'jsdom',
moduleDirectories: ['./node_modules'],
moduleNameMapper: {
'\\.(css|less|scss|sss|styl)$': resolve(baseDir, 'node_modules', 'jest-css-modules'), // Equivalent of identity-obj-proxy
},

coverageThreshold: {
global: coverageThreshold,
},
}
235 changes: 235 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading