[NIFI-12941] - adding in jest-preset-angular to enable unit testing in Idea based IDEs (#8580)

* [NIFI-12941] - adding in jest-preset-angular to enable unit testing in Idea-based IDEs

* remove globalSetup jest config

This closes #8580
This commit is contained in:
Rob Fellows 2024-03-28 16:12:17 -04:00 committed by GitHub
parent 8ef9528bf9
commit e5827c1026
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 1 deletions

View File

@ -184,7 +184,16 @@ const config: Config = {
// testRunner: "jest-circus/runner",
// A map from regular expressions to paths to transformers
transform: {},
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
useESM: true
}
]
},
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
transformIgnorePatterns: []

View File

@ -64,6 +64,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.7.0",
"jest-preset-angular": "^14.0.3",
"nx": "18.1.3",
"postcss": "^8.4.32",
"prettier": "3.1.0",

View File

@ -72,6 +72,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.7.0",
"jest-preset-angular": "^14.0.3",
"nx": "18.1.3",
"postcss": "^8.4.32",
"prettier": "3.1.0",

View File

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'jest-preset-angular/setup-jest';
// jsdom testing environment does not provide crypto functionality... provide a dummy implementation in its place.
window.crypto.randomUUID = () => {