ts-ioc-container 37.1.1 → 37.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +12 -2
  2. package/package.json +4 -3
package/README.md CHANGED
@@ -236,7 +236,7 @@ Sometimes you want to dispose container and all its scopes. For example, when yo
236
236
 
237
237
  ```typescript
238
238
  import 'reflect-metadata';
239
- import { by, Container, ContainerDisposedError, MetadataInjector, Registration as R } from 'ts-ioc-container';
239
+ import { by, Container, ContainerDisposedError, EmptyContainer, MetadataInjector, Registration as R } from 'ts-ioc-container';
240
240
 
241
241
  class Logger {}
242
242
 
@@ -252,6 +252,17 @@ describe('Disposing', function () {
252
252
  expect(() => root.resolve('ILogger')).toThrow(ContainerDisposedError);
253
253
  expect(by.instances()(root).length).toBe(0);
254
254
  });
255
+
256
+ it('should dispose without cascade', function () {
257
+ const root = new Container(new MetadataInjector(), { tags: ['root'] });
258
+ const child1 = root.createScope({ tags: ['child1'] });
259
+
260
+ root.dispose({ cascade: false });
261
+
262
+ expect(root.isDisposed).toBe(true);
263
+ expect(child1.isDisposed).toBe(false);
264
+ expect(child1.getParent()).toBeInstanceOf(EmptyContainer);
265
+ });
255
266
  });
256
267
 
257
268
  ```
@@ -884,7 +895,6 @@ describe('alias', () => {
884
895
  });
885
896
 
886
897
  it('should resolve by memoized aliases', () => {
887
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
888
898
  interface ILogger {}
889
899
 
890
900
  @provider(alias('ILogger'))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-ioc-container",
3
- "version": "37.1.1",
3
+ "version": "37.2.0",
4
4
  "description": "Typescript IoC container",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -41,7 +41,7 @@
41
41
  "build:cjm": "rimraf cjm && tsc -p tsconfig.production.json --outDir cjm --module CommonJS",
42
42
  "build:esm": "rimraf esm && tsc -p tsconfig.production.json --outDir esm",
43
43
  "build:types": "rimraf typings && tsc -p tsconfig.production.json --outDir typings --emitDeclarationOnly --declaration",
44
- "generate:docs": "npx ts-node scripts/generateReadme/generateReadme.ts && git add README.md",
44
+ "generate:docs": "bun scripts/generateReadme/generateReadme.ts && git add README.md",
45
45
  "build": "npm run build:cjm && npm run build:esm && npm run build:types",
46
46
  "coverage": "coveralls",
47
47
  "test": "jest --coverage",
@@ -75,7 +75,8 @@
75
75
  "lint-staged": {
76
76
  "*.{js,ts,tsx}": [
77
77
  "eslint --fix",
78
- "prettier --write"
78
+ "prettier --write",
79
+ "bun scripts/check-coverage.ts"
79
80
  ]
80
81
  },
81
82
  "gitHead": "ae10f302c7e0f55196b42669040735112479a854",