{"id":22827440,"url":"https://github.com/voxaai/alexa-mime","last_synced_at":"2026-07-04T06:01:13.268Z","repository":{"id":82234332,"uuid":"129455415","full_name":"VoxaAI/alexa-mime","owner":"VoxaAI","description":null,"archived":false,"fork":false,"pushed_at":"2019-09-26T15:52:40.000Z","size":19,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-10-28T18:42:44.757Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VoxaAI.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-13T21:31:20.000Z","updated_at":"2020-07-30T12:51:36.000Z","dependencies_parsed_at":"2023-03-12T15:10:07.015Z","dependency_job_id":null,"html_url":"https://github.com/VoxaAI/alexa-mime","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/VoxaAI/alexa-mime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoxaAI%2Falexa-mime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoxaAI%2Falexa-mime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoxaAI%2Falexa-mime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoxaAI%2Falexa-mime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VoxaAI","download_url":"https://codeload.github.com/VoxaAI/alexa-mime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoxaAI%2Falexa-mime/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35111429,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-04T02:00:05.987Z","response_time":113,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-12-12T18:10:36.915Z","updated_at":"2026-07-04T06:01:13.235Z","avatar_url":"https://github.com/VoxaAI.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Alexa Mime\n\nCreate test suites for your Alexa Skills and Google Actions in [YML](http://yaml.org/start.html) structured files\n\n## Installation\n\nInstall it from [npm](https://www.npmjs.com/package/alexa-mime)\n\n```bash\n$ npm install --save-dev alexa-mime\n```\n\n## Usage\n\nAlexa Mime relies on the [Alexa Skill Test Framework](https://github.com/BrianMacIntosh/alexa-skill-test-framework) to run all your unit tests, if you want to understand a little bit further on how Alexa Mime works internally, please check the documentation of Alexa Skill Test Framework.\n\n### The `describeWrapper` object\n\nAlexa Mime lets you wrap all your mock statements in a Javascript object that is available for all your test cases. There you can mock all the things you need for your tests to work properly. A basic example of a `describeWrapper` would be (using the [simple-mock](https://github.com/jupiter/simple-mock) library):\n\n```javascript\nconst simple = require('simple-mock');\nconst User = require('../path/to/UserClass');\n\nconst describeWrapper = {\n  clear: () =\u003e {\n    simple.restore();\n  },\n  firstTimeUser: () =\u003e {\n    // Your mock statements here\n    simple.mock(User.prototype, 'isFirstTime').returnWith(true);\n  },\n};\n```\n\nYou can define as many properties as you want in the `describeWrapper` object, then you can use them in the `beforeEach` and `afterEach` hooks in your `YML` files.\n\n### Use cases (`YML` files)\n\nOnce you have your `describeWrapper`, is time to create your actual unit tests in `YML` structure files. A basic example of a use case in a `YML` form would be:\n\n```YML\nUser launches the skill for the first time as a new user:\n  - beforeEach: 'firstTimeUser'\n  - afterEach: 'clear'\n  - LaunchIntent:\n      alexaResponse: Begin.FirstTime\n```\n\nNote how the `firstTimeUser` property is being injected in the `beforeEach` key, and same for `clear` injected in `afterEach`, Alexa Mime will take care of executing whatever you define in your `describeWrapper` so your tests run without issues.\n\n### Hooking it up\n\n```javascript\nconst mime = require('alexa-mime');\nconst simple = require('simple-mock');\nconst path = require('path');\nconst skill = require('../path/to/skill/handler/index'); \nconst views = require('../path/to/views/index'); \nconst User = require('../path/to/UserClass');\n\nconst describeWrapper = {\n  clear: () =\u003e {\n    simple.restore();\n  },\n  firstTimeUser: () =\u003e {\n    // Your mock statements here\n    simple.mock(User.prototype, 'isFirstTime').returnWith(true);\n  },\n};\n\nmime(\n  skill,\n  views,\n  path.join(__dirname, 'use-cases'),\n  path.join(__dirname, '..', 'simulate'),\n  describeWrapper\n);\n```\n\n### Options\n\n* **skill**: Object containing your skill's/action's handler method. It must define a method called `handler` which runs the skill\n* **views**: Object representation of all the responses that your skill/action contains and that your tests expect for certain use case. For more info, see the **Views and Variables** section [here](https://voxa.readthedocs.io/en/master/views-and-variables.html)\n* **pathToYAMLTest**: Path to the folder where all your `YML` files are located\n* **pathToSaveHTML**: Alexa Mime will generate a HTML report file with all your test cases and result of rach (error or success). Here you can specify the path where Alexa Mime will save the report.\n* **describeWrapper**: Your `describeWrapper` object\n* **locale**: The locale that your skill/action runs in. By default Alexa Mime uses `en-US` but you can specify any valid locale based on the platform you are using (Alexa or Google Assistant).\n\n### Going deeper\n\n#### Define multiple `beforeEach` statements in your `YML` files\n\n```YML\nUser launches the skill for the first time as a new user:\n  - beforeEach: 'globalMock, firstTimeUser'\n  - afterEach: 'clear'\n  - LaunchIntent:\n      alexaResponse: Begin.FirstTime\n```\n\n### Define a different locale for your test cases\n\nThis example uses a `views` object of [Voxa3](https://voxa.readthedocs.io/en/v3/views-and-variables.html#views)\n\n```javascript\n// ...\n\nconst mime = require('alexa-mime');\nconst locale = 'en-AU';\n\n// ...\n\nmime(\n  skill,\n  views[locale].translation,\n  path.join(__dirname, 'use-cases'),\n  path.join(__dirname, '..', 'simulate'),\n  describeWrapper,\n  locale\n);\n```\n\n### Complex `YML` files\n\n```YML\nUser launches the skill as an expert, receives welcome message, invokes BookCarIntent with carName slot, car is booked successfully, the session ends:\n  - beforeEach: 'expertUser'\n  - afterEach: 'clear'\n  - LaunchIntent:\n      alexaVariable:\n        greeting: 'Hey'\n      alexaResponse: Begin.Expert\n  - BookCarIntent:\n      slots:\n        carName: 'Karen The Yaris'\n      alexaVariable:\n        goodbye: 'See you soon.'\n      alexaResponse: BookCar.Done\n      shouldEndSession: true\n```\n\n`YML` files can contain these properties:\n\n* **beforeEach**: You define this in your `describeWrapper` and runs before each test case\n* **afterEach**: You define this in your `describeWrapper` and runs after each test case\n* **intent**: The name of the intent you want your test case to cover. Note that multiple intents can be tested in the same use case\n  * **slots**: Name and value of any slot that your intent expects. You can specify multiple slots, one slot per line\n  * **alexaVariable**: Name and value of the variable that your view (`alexaResponse`) uses. You can specify multiple variables, one variable per line\n  * **alexaResponse**: Name/Path of the actual view/response your test case expects for this request or use case. You can specify multiple views/responses, in the same line separated by comma\n  * **shouldEndSession**: Boolean value specifying if session is closed after the test case runs","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxaai%2Falexa-mime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxaai%2Falexa-mime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxaai%2Falexa-mime/lists"}