Skip to content

Commit

Permalink
Investigate code coverage in container (#4105)
Browse files Browse the repository at this point in the history
  • Loading branch information
walmazacn authored Mar 6, 2025
1 parent b3c7cea commit 1681a49
Show file tree
Hide file tree
Showing 13 changed files with 2,779 additions and 349 deletions.
4 changes: 4 additions & 0 deletions container/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@
/public/**/*.ts

/coverage
/e2e-coverage
/instrumented
/.nyc_output
/coverage-summary.html
.DS_Store
34 changes: 28 additions & 6 deletions container/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

# Luigi Container
# Luigi Container

## Overview
[Luigi Container](https://docs.luigi-project.io/docs/luigi-container) is a [web component](https://developer.mozilla.org/en-US/docs/Web/Web_Components) that can be included in an arbitrary application, in order to render a Luigi micro frontend (iframe or web component based) without the need of being a Luigi Core application.

## Installation
1. Install the container package: `@luigi-project/container`
1. Install the container package: `@luigi-project/container`

```
npm install @luigi-project/container
Expand All @@ -21,8 +21,8 @@ import '@luigi-project/container';
You can now use the Luigi container as follows anywhere in your application:

```
<luigi-container
viewURL="https://www.example-microfronted.com"
<luigi-container
viewURL="https://www.example-microfronted.com"
webcomponent="false"
label="my label"
context='{"label": "Calendar"}'>
Expand All @@ -33,9 +33,31 @@ You can find simple examples that use [webcomponents](https://github.com/SAP/lui
4. In a similar way you can use the Luigi **compound container** to insert multiple microfrontends as follows:

```
<luigi-compound-container
<luigi-compound-container
context='{"label": "Dashboard"}'
compoundConfig = { your config here }>
</luigi-compound-container>
```
An example can be found at [./examples/compound-container/index.html](https://github.com/SAP/luigi/tree/main/container/examples/compound-container).
An example can be found at [./examples/compound-container/index.html](https://github.com/SAP/luigi/tree/main/container/examples/compound-container).

## Code coverage
It is possible to get code coverage stats for both unit and e2e tests. In the first step trigger unit tests by running the following commands:

```
npm install
npm run test
```

After running unit tests execute the following bash script to trigger e2e tests in code coverage mode:

```
./run-container-e2e.sh
```

When both `coverage` and `e2e-coverage` folders are present in the main directory then a summary report might be created by running the following command:

```
npm run coverage-summary
```

New HTML file called `coverage-summary.html` should be created in the main directory - just open it in a browser to see the summary report.
Loading

0 comments on commit 1681a49

Please sign in to comment.