-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(react-norhtstar): use new conformance api to narrow down ts prog…
…ram to speed up tests
- Loading branch information
Showing
5 changed files
with
33 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const { workspaceRoot } = require('@nrwl/devkit'); | ||
const { pathsToModuleNameMapper } = require('ts-jest'); | ||
const { createV0Config: commonConfig } = require('@fluentui/scripts-jest'); | ||
|
||
const config = commonConfig({ | ||
name: 'react', | ||
displayName: 'react-northstar', | ||
moduleNameMapper: { | ||
// Legacy aliases, they should not be used in new tests | ||
'^src/(.*)$': `<rootDir>/src/$1`, | ||
'test/(.*)$': `<rootDir>/test/$1`, | ||
...getAliases(), | ||
}, | ||
}); | ||
config.setupFilesAfterEnv = [...config.setupFilesAfterEnv, './jest-setup.js']; | ||
|
||
module.exports = config; | ||
|
||
function getAliases() { | ||
const tsConfig = JSON.parse(fs.readFileSync(path.join(__dirname, 'tsconfig.spec.json'))); | ||
const tsPathAliases = pathsToModuleNameMapper(tsConfig.compilerOptions.paths, { | ||
prefix: `<rootDir>/${path.relative(__dirname, workspaceRoot)}/`, | ||
}); | ||
|
||
return tsPathAliases; | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/fluentui/react-northstar/test/specs/commonTests/extraConformanceTests.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"emitDeclarationOnly": false, | ||
"composite": false, | ||
"types": ["node", "jest", "@testing-library/jest-dom"], | ||
"paths": { | ||
"src/*": ["packages/fluentui/react-northstar/src/*"], | ||
"test/*": ["packages/fluentui/react-northstar/test/*"] | ||
} | ||
}, | ||
"include": ["test"] | ||
} |