{"id":13769342,"url":"https://github.com/Neizan93/jest-angular-test-verifier","last_synced_at":"2025-05-11T02:32:12.380Z","repository":{"id":186541903,"uuid":"675334929","full_name":"Neizan93/jest-angular-test-verifier","owner":"Neizan93","description":"Jest reporter to verify all essential Angular files have associated test files, ensuring comprehensive test coverage.","archived":false,"fork":false,"pushed_at":"2023-08-06T19:24:31.000Z","size":86,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-13T10:08:00.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Neizan93.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-08-06T15:27:08.000Z","updated_at":"2023-08-12T13:51:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"9f224281-9226-4d9d-8d62-85d54e211f4f","html_url":"https://github.com/Neizan93/jest-angular-test-verifier","commit_stats":null,"previous_names":["neizan93/jest-angular-test-verifier"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neizan93%2Fjest-angular-test-verifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neizan93%2Fjest-angular-test-verifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neizan93%2Fjest-angular-test-verifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neizan93%2Fjest-angular-test-verifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Neizan93","download_url":"https://codeload.github.com/Neizan93/jest-angular-test-verifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224974851,"owners_count":17401108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:00:22.505Z","updated_at":"2024-11-17T05:30:46.712Z","avatar_url":"https://github.com/Neizan93.png","language":"JavaScript","funding_links":[],"categories":["Packages","Testing"],"sub_categories":["Reporters","Helpers"],"readme":"# jest-angular-test-verifier\n\nA custom Jest reporter specifically designed for Angular projects. This reporter checks and ensures that specific types of files (components, services, directives, etc.) have their corresponding test file.\n\n## Installation\n\nInstall the package using npm:\n\n```bash\nnpm install jest-angular-test-verifier --save-dev\n```\n\n## Usage\n\nIn your Jest configuration file (e.g., `jest.config.js`), add `jest-angular-test-verifier` to your list of reporters:\n\n```javascript\nmodule.exports = {\n  // ... other Jest configuration options\n  reporters: [\"default\", \"jest-angular-test-verifier\"]\n};\n```\n\n## Simple Configuration\n\nIf you just want to get started quickly without too much configuration, you can use the following simple setup in your Jest configuration file:\n\n```javascript\nmodule.exports = {\n  // ... other Jest configuration options\n  reporters: [\n    \"default\",\n    [\"jest-angular-test-verifier\", {\n      failOnMissingTests: true\n    }]\n  ]\n};\n```\n\nWith this simple configuration, the reporter will start checking for test files in the default directory `'src/app'` and it will display an error and fail the tests if any of the specified file types (components, services, guards, directives, and pipes) are missing their corresponding test files.\n\nFeel free to customize the configuration further by adding more options as needed, but this simple setup should get you started quickly.\n\n## Configuration Options\n\nYou can configure the reporter by providing a second argument with options in your configuration file:\n\n```javascript\nmodule.exports = {\n  // ... other Jest configuration options\n  reporters: [\n    \"default\",\n    [\"jest-angular-test-verifier\", {\n      directory: \"src/app\",\n      showTestedFiles: false,\n      failOnMissingTests: true,\n      exclusions: ['**/*.module.ts', 'src/app/somefolder/**'],\n      exclusionRules: [/DEPRECATED/, \"TO_BE_REMOVED\"],\n    }]\n  ]\n};\n```\n\n### Directory\n\nSpecifies the directory from where the reporter should start checking for test files.\n\n* Default: `'src/app'`\n\n### Extensions\n\nDefine which types of files you want to ensure have tests. By default, the reporter checks for components, services, guards, directives, and pipes.\n\n* Default:\n    \n    ```javascript\n    [\n      '.component.ts',\n      '.service.ts',\n      '.guard.ts',\n      '.directive.ts',\n      '.pipe.ts'\n    ]\n    ```\n    \n\nExample:\n\n```javascript\nmodule.exports = {\n  // ... other Jest configuration options\n  reporters: [\n    \"default\",\n    [\"jest-angular-test-verifier\", {\n      ...\n      extensions: ['.component.ts', '.service.ts']\n    }]\n  ]\n};\n```\n\n### ShowTestedFiles\n\nDetermines whether the reporter should display files that already have associated test files.\n\n* Default: `false`\n\n### FailOnMissingTests\n\nIndicates whether Jest should terminate with a failure if it finds files that are missing test files.\n\n* Default: `true`\n\n### ShowStatistics\n\nDetermines whether the reporter should display statistics about the total files checked, how many have tests, and how many are missing tests.\n\n* Default: `false`\n\nExample:\n\n```javascript\nmodule.exports = {\n  // ... other Jest configuration options\n  reporters: [\n    \"default\",\n    [\"jest-angular-test-verifier\", {\n      ...\n      showStatistics: true\n    }]\n  ]\n};\n```\n\n### Exclusions\n\nUsing the `exclusions` option, you can define specific files or directories that you want the reporter to skip. This is particularly useful when you have certain files or folders in your project that you know shouldn't have tests.\n\nThe exclusions accept glob patterns, allowing for flexible configurations:\n\n* `'**/*.module.ts'` - will exclude all module files in your project.\n* `'src/app/somefolder/**'` - will exclude everything within `src/app/somefolder/`.\n\n### ExclusionRules\n\nAllows you to exclude files based on content using strings or regular expressions. For example, if you have deprecated files containing the \"DEPRECATED\" string, you can easily exclude them without needing to rely on filenames or paths.\n\nExamples:\n\n* Using a string: `\"TO_BE_REMOVED\"` would exclude any file containing that exact string.\n* Using a regular expression: `/DEPRECATED/` would exclude any file containing the word \"DEPRECATED\".\n\n### DepthLevel\n\nAllows you to specify how many levels of subdirectories you want to check for test files. A value of `1` will check only the files and directories directly inside the specified directory. A value of `2` will check those and their immediate subdirectories, and so on.\n\n* Default: `Infinity` (All subdirectories will be checked)\n\nExample:\n\n```javascript\nmodule.exports = {\n  // ... other Jest configuration options\n  reporters: [\n    \"default\",\n    [\"jest-angular-test-verifier\", {\n      ...\n      depthLevel: 2\n    }]\n  ]\n};\n```\n\n### MockIdentifier\n\nDetermines the string used to identify mock files in your project. This is useful if you have a different naming convention for mock files than the standard 'mock'.\n\n* Default: `'mock'`\n\n### Congratulations Messages\n\nYou can customize the congratulatory messages displayed when all necessary files have tests. Provide an array of messages, and a random one will be chosen when all files are covered:\n\n```javascript\nmodule.exports = {\n  // ... other Jest configuration options\n  reporters: [\n    \"default\",\n    [\"jest-angular-test-verifier\", {\n      directory: \"src/app\",\n      extensions: ['.component.ts', '.service.ts'],\n      showTestedFiles: false,\n      failOnMissingTests: true,\n      showStatistics: true,\n      exclusions: ['**/*.module.ts', 'src/app/somefolder/**'],\n      exclusionRules: [/DEPRECATED/, \"TO_BE_REMOVED\"],\n      depthLevel: 2,\n      mockIdentifier: 'mock',\n      congratulations: [\n        \"🚀 Awesome! All files are covered.\",\n        \"💡 Brilliance! Every file has a test.\",\n        \"🔥 Blazing! 100% of files have tests.\"\n      ]\n    }]\n  ]\n};\n```\n\n## License\n\n[MIT](./LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNeizan93%2Fjest-angular-test-verifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNeizan93%2Fjest-angular-test-verifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNeizan93%2Fjest-angular-test-verifier/lists"}