diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b26e33e..a2d5ade 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,19 @@ jobs: node-version: 20.x cache: "npm" - - run: npm ci - - run: npm run lint - - run: npm test - - run: npm run build + - name: Install dependencies + run: npm ci + + - name: Linting + run: npm run lint + + - name: Tests + run: npm run test:coverage + + - name: Upload results to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Build + run: npm run build diff --git a/README.md b/README.md index dd91e5b..6c40b0b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # A simple IOC container for Typescript +![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/evyweb/ioctopus/main.yml) +[![codecov](https://codecov.io/gh/Evyweb/ioctopus/graph/badge.svg?token=A3Z8UCNHDY)](https://codecov.io/gh/Evyweb/ioctopus) +![NPM Downloads](https://img.shields.io/npm/dm/%40evyweb%2Fioctopus) ![logo-ioctopus.png](assets/logo-ioctopus.png) @@ -250,10 +253,12 @@ To use the scoped scope, you need to create a scope using runInScope. ```typescript container.bind(DI.MY_SERVICE).toClass(MyServiceClass, [DI.DEP1, DI.DEP2], 'scoped'); +const instance1 = undefined; +const instance2 = undefined; container.runInScope(() => { - const instance1 = container.get(DI.MY_SERVICE); - const instance2 = container.get(DI.MY_SERVICE); + instance1 = container.get(DI.MY_SERVICE); + instance2 = container.get(DI.MY_SERVICE); console.log(instance1 === instance2); // true });