{"id":16003145,"url":"https://github.com/mauriciolauffer/vitest-environment-ui5","last_synced_at":"2025-07-04T23:34:42.832Z","repository":{"id":196137638,"uuid":"685908170","full_name":"mauriciolauffer/vitest-environment-ui5","owner":"mauriciolauffer","description":"A Vitest Environment for unit testing UI5 code","archived":false,"fork":false,"pushed_at":"2025-02-13T08:08:13.000Z","size":91,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T12:42:20.281Z","etag":null,"topics":["openui5","sap","sapui5","testing","ui5","unit-testing","vitest","vitest-environment"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mauriciolauffer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"mauriciolauffer"}},"created_at":"2023-09-01T09:33:26.000Z","updated_at":"2025-03-01T19:26:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"2d80a4df-cdb4-4d50-8b90-3573f4ad27b9","html_url":"https://github.com/mauriciolauffer/vitest-environment-ui5","commit_stats":null,"previous_names":["mauriciolauffer/vitest-environment-ui5"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauriciolauffer%2Fvitest-environment-ui5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauriciolauffer%2Fvitest-environment-ui5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauriciolauffer%2Fvitest-environment-ui5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauriciolauffer%2Fvitest-environment-ui5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauriciolauffer","download_url":"https://codeload.github.com/mauriciolauffer/vitest-environment-ui5/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244068708,"owners_count":20392879,"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":["openui5","sap","sapui5","testing","ui5","unit-testing","vitest","vitest-environment"],"created_at":"2024-10-08T10:06:30.557Z","updated_at":"2025-03-17T16:30:29.317Z","avatar_url":"https://github.com/mauriciolauffer.png","language":"TypeScript","funding_links":["https://github.com/sponsors/mauriciolauffer"],"categories":[],"sub_categories":[],"readme":"# vitest-environment-ui5\n\n[![npm](https://img.shields.io/npm/v/vitest-environment-ui5)](https://www.npmjs.com/package/vitest-environment-ui5) [![test](https://github.com/mauriciolauffer/vitest-environment-ui5/actions/workflows/test.yml/badge.svg)](https://github.com/mauriciolauffer/vitest-environment-ui5/actions/workflows/test.yml)\n\nA `Vitest Environment` for unit testing `UI5` code. Run your unit tests in a blazing fast way! Neither webserver nor browser are required. It runs in `Node.js` and uses `jsdom` to emulate browser environment.\n\nSee [Vitest Environment](https://vitest.dev/guide/environment.html) and [jsdom](https://github.com/jsdom/jsdom) for more details.\n\n## Installation\n\nInstall `vitest-environment-ui5`, and `vitest`, as devDependencies:\n\n```shell\n$ npm i -D vitest  vitest-environment-ui5\n```\n\n## Setup\n\nVitest uses `node` as default test environment. In order to change it to a different environment, `vitest-environment-ui5`, we will either have to define it in `vitest.config.js` or add a `@vitest-environment` docblock at the top of the test file. See [Vitest Config](https://vitest.dev/config/#environment) for more details.\n\n`vitest-environment-ui5` builds `jsdom` from a local HTML file, no webserver required. The HTML file should contain the `UI5` bootstrap, similar to this one: [ui5 bootstrap](test/fixtures/ui5-unit-test.html).\n\nYou can change the [UI5 bootstrap configuration](https://sapui5.hana.ondemand.com/sdk/#/topic/a04b0d10fb494d1cb722b9e341b584ba) as you wish, just like in your webapp. You can even open the file in a browser to see `UI5` being loaded. However, no tests will be executed.\n\n### Vitest Configuration\n\n```js\nimport { defineConfig } from \"vitest/config\";\n\nexport default defineConfig({\n  test: {\n    environment: \"ui5\",\n    environmentOptions: {\n      ui5: {\n        path: \"test/ui5-unit-test.html\", // Path to the HTML file containing UI5 bootstrap\n        timeout: 200, // UI5 load timeout in ms, default is 100ms\n      },\n    },\n  },\n});\n```\n\n### Vitest DocBlock\n\n```js\n/**\n * @vitest-environment ui5\n * @vitest-environment-options { \"path\": \"test/ui5-unit-test.html\" }\n */\n\nimport { expect, test } from \"vitest\";\n\ntest(\"UI5 is loaded\", () =\u003e {\n  expect(window.sap).toBeTruthy();\n  expect(sap).toBeTruthy();\n  expect(sap.ui.getCore()).toBeTruthy();\n  expect(sap.ui.version).toBeTruthy();\n});\n```\n\n## Run\n\nRun the tests with `Vitest` [CLI](https://vitest.dev/guide/cli.html):\n\n```shell\n$ vitest\n```\n\n## Don't be afraid\n\n`jsdom` is not a real browser, but gets the job done for unit testing. All major javascript frameworks use it today: `React`, `Vue`, `Svelte`, and even our old friend `jQuery`. It has over 20M weekly downloads in [NPM](https://www.npmjs.com/package/jsdom)!\n\n## Author\n\nMauricio Lauffer\n\n- LinkedIn: [https://www.linkedin.com/in/mauriciolauffer](https://www.linkedin.com/in/mauriciolauffer)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauriciolauffer%2Fvitest-environment-ui5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauriciolauffer%2Fvitest-environment-ui5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauriciolauffer%2Fvitest-environment-ui5/lists"}