{"id":20906132,"url":"https://github.com/distributedlife/conventionaljs","last_synced_at":"2025-12-28T08:30:29.623Z","repository":{"id":39606772,"uuid":"282074468","full_name":"distributedlife/conventionaljs","owner":"distributedlife","description":"Conventional tests for your JS and TS","archived":false,"fork":false,"pushed_at":"2023-01-06T12:18:37.000Z","size":773,"stargazers_count":2,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-20T13:40:30.258Z","etag":null,"topics":["convention","conventions","js","test","testing","tests","ts","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/distributedlife.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-23T23:03:06.000Z","updated_at":"2020-07-29T02:00:36.000Z","dependencies_parsed_at":"2023-02-06T01:45:27.617Z","dependency_job_id":null,"html_url":"https://github.com/distributedlife/conventionaljs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Fconventionaljs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Fconventionaljs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Fconventionaljs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributedlife%2Fconventionaljs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/distributedlife","download_url":"https://codeload.github.com/distributedlife/conventionaljs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243297566,"owners_count":20268801,"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":["convention","conventions","js","test","testing","tests","ts","typescript"],"created_at":"2024-11-18T13:29:10.729Z","updated_at":"2025-12-28T08:30:29.582Z","avatar_url":"https://github.com/distributedlife.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# conventionaljs\nConventional tests for your JS and TS.\n\nThere is only one rule so far and it's incomplete.\n- Make sure AWS Lambda event handler input parameters don't escape the file they are defined in.\n\n## AWS Lambda Handler Matchers\nThe following is considered an AWS Lambda handlers if all are true:\n\n- Must be an export of a root source file (file not imported by another source file)\n- Looks like one of the following:\n  - has JSDoc annotation matching an AWS event type e.g. `AWSLambda.DynamoDBStreamEvent` for the first param\n  - has three params (event, context, callback) in that order and with that name \n  - has two params (event, context) is async\n  - has one param (event) is async and the function name is called \"handler\"\n\n### The following are considered AWS Lambda Event Types\n- AWSLambda.ALBEvent\n- AWSLambda.APIGatewayEvent\n- AWSLambda.CloudFrontEvent\n- AWSLambda.CloudWatchLogsEvent\n- AWSLambda.CognitoUserPoolEvent\n- AWSLambda.DynamoDBStreamEvent\n- AWSLambda.KinesisStreamEvent\n- AWSLambda.S3CreateEvent\n- AWSLambda.S3Event\n- AWSLambda.SNSEvent\n- AWSLambda.SQSEvent\n\n## Usage\nYou'll need [entente](https://github.com/h-o-t/entente) or [ts-morph](https://github.com/dsherret/ts-morph) for this.\n\n### entente (known entrypoints only at the moment)\n```js\nconst { createProject } = require(\"entente\");\ncreateProject('./src/index.js');\n\ncheckProject(project) \n```\n\n### ts-morph (find entrypoints in a source tree)\n```js\nconst compilerOptions = {\n  allowJs: true,\n  checkJs: true,\n  noEmit: true,\n  resolveJsonModule: true,\n};\n\nconst project = new Project({ compilerOptions });\nproject.resolveSourceFileDependencies();\nproject.addSourceFilesAtPaths(['./src/**/*.js', \"!./src/**/*.spec.js\"]);\n\ncheckProject(project) \n```\n\n## Todos\n- [ ] Make it work with commonjs modules. ts-morph is having a hard time here.\n- [ ] Make sure it doesn't escape through a renamed reference.\n\n## Ideas to explore\n- [ ] express request/response objects are not passed around\n- [ ] GraphQL response objects are converted to view models before use\n- [ ] types defined externally to the project can only be passed out of the file where they are first used (don't couple yourself to external objects) -- but you can define them anywhere\n- [ ] types defined externally to the project can only be used in leaf (files that do not reference other source files) or entrypoint files (files not referened by other source files)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributedlife%2Fconventionaljs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistributedlife%2Fconventionaljs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributedlife%2Fconventionaljs/lists"}