Skip to content

Commit

Permalink
chore(test): add tests for react components
Browse files Browse the repository at this point in the history
  • Loading branch information
FranceBe committed Mar 6, 2024
1 parent d0bf484 commit a8a4d9a
Show file tree
Hide file tree
Showing 17 changed files with 46,159 additions and 39 deletions.
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: [
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

0 comments on commit a8a4d9a

Please sign in to comment.