Skip to content

Commit

Permalink
chore(public-docsite-v9): add jest test setup in order to run test fr…
Browse files Browse the repository at this point in the history
…om migrated react-components suite
  • Loading branch information
Hotell committed May 21, 2024
1 parent c8c46d3 commit 36d819e
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 1 deletion.
3 changes: 3 additions & 0 deletions apps/public-docsite-v9/config/tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/** Jest test setup file. */

require('@testing-library/jest-dom');
22 changes: 22 additions & 0 deletions apps/public-docsite-v9/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// @ts-check

/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
displayName: 'public-docsite-v9',
preset: '../../jest.preset.js',
// TODO: lets not allow path aliases which point only to v9 packages ATM
moduleNameMapper: {},
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
isolatedModules: true,
},
],
},
coverageDirectory: './coverage',
setupFilesAfterEnv: ['./config/tests.js'],
};
3 changes: 2 additions & 1 deletion apps/public-docsite-v9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"type-check": "just-scripts type-check",
"start": "yarn storybook:docs",
"storybook": "start-storybook --port 3000 --no-manager-cache",
"storybook:docs": "yarn storybook --docs"
"storybook:docs": "yarn storybook --docs",
"test": "jest --passWithNoTests"
},
"devDependencies": {
"@fluentui/eslint-plugin": "*",
Expand Down
1 change: 1 addition & 0 deletions apps/public-docsite-v9/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"sourceMap": true,
"types": ["static-assets", "webpack-env"]
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx"],
"include": ["src"]
}
3 changes: 3 additions & 0 deletions apps/public-docsite-v9/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"include": [],
"files": [],
"references": [
{
"path": "./tsconfig.spec.json"
},
{
"path": "./tsconfig.app.json"
},
Expand Down
9 changes: 9 additions & 0 deletions apps/public-docsite-v9/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"jsx": "react",
"types": ["node", "jest"]
},
"include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"]
}

0 comments on commit 36d819e

Please sign in to comment.