Skip to content

Commit b32a536

Browse files
authored
feat: upgrade to Angular 13 (#704)
1 parent f626ddf commit b32a536

File tree

17 files changed

+3748
-4046
lines changed

17 files changed

+3748
-4046
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ jobs:
3030
HUSKY_SKIP_INSTALL: 'true'
3131
run: yarn --frozen-lockfile --no-progress --non-interactive
3232

33-
- name: Run TSLint
34-
run: yarn lint
35-
3633
- name: Run tests
3734
run: yarn test
3835

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/.angular/cache
12
dist
23
node_modules
34
.vscode

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint-staged

angular.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,6 @@
2222
"options": {
2323
"no-cache": false
2424
}
25-
},
26-
"lint": {
27-
"builder": "@angular-devkit/build-angular:tslint",
28-
"options": {
29-
"tsConfig": [
30-
"emitter/tsconfig.lib.json",
31-
"tsconfig.spec.json"
32-
],
33-
"exclude": [
34-
"**/node_modules/**"
35-
]
36-
}
3725
}
3826
}
3927
}

emitter/ng-package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
"dest": "../dist/emitter",
44
"lib": {
55
"flatModuleFile": "ngxs-labs-emitter",
6-
"entryFile": "src/index.ts",
7-
"umdModuleIds": {
8-
"@ngxs/store": "ngxs-store"
9-
}
6+
"entryFile": "src/index.ts"
107
}
118
}

emitter/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"sideEffects": true,
2020
"peerDependencies": {
21-
"@angular/core": ">=13.2.3",
21+
"@angular/core": ">=13.0.0",
2222
"@ngxs/store": ">=3.7.3"
2323
}
2424
}

emitter/src/lib/core/decorators/receiver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function Receiver(options?: Partial<ReceiverMetaData>): MethodDecorator {
108108
payload
109109
};
110110

111-
target.prototype[key] = function(ctx: StateContext<any>, action: any) {
111+
target.prototype[key] = function (ctx: StateContext<any>, action: any) {
112112
return target[key].call(target, ctx, action);
113113
};
114114
};

emitter/src/tests/action.spec.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ describe('Actions', () => {
114114
}
115115

116116
TestBed.configureTestingModule({
117-
imports: [NgxsModule.forRoot([CounterStateWithCustomActions]), NgxsEmitPluginModule.forRoot()]
117+
imports: [
118+
NgxsModule.forRoot([CounterStateWithCustomActions]),
119+
NgxsEmitPluginModule.forRoot()
120+
],
121+
teardown: { destroyAfterEach: false }
118122
});
119123

120124
const store: Store = TestBed.inject(Store);
@@ -132,7 +136,8 @@ describe('Actions', () => {
132136
it('should intercept only CounterState.increment receiver', () => {
133137
TestBed.configureTestingModule({
134138
imports: [NgxsModule.forRoot([CounterState]), NgxsEmitPluginModule.forRoot()],
135-
declarations: [MockComponent]
139+
declarations: [MockComponent],
140+
teardown: { destroyAfterEach: false }
136141
});
137142

138143
const fixture = TestBed.createComponent(MockComponent);
@@ -152,7 +157,8 @@ describe('Actions', () => {
152157
it('should intercept receiver that throws an error', () => {
153158
TestBed.configureTestingModule({
154159
imports: [NgxsModule.forRoot([CounterState]), NgxsEmitPluginModule.forRoot()],
155-
declarations: [MockComponent]
160+
declarations: [MockComponent],
161+
teardown: { destroyAfterEach: false }
156162
});
157163

158164
const fixture = TestBed.createComponent(MockComponent);
@@ -174,7 +180,8 @@ describe('Actions', () => {
174180
it('should intercept multiple dispatched emittables', () => {
175181
TestBed.configureTestingModule({
176182
imports: [NgxsModule.forRoot([CounterState]), NgxsEmitPluginModule.forRoot()],
177-
declarations: [MockComponent]
183+
declarations: [MockComponent],
184+
teardown: { destroyAfterEach: false }
178185
});
179186

180187
const fixture = TestBed.createComponent(MockComponent);
@@ -203,7 +210,8 @@ describe('Actions', () => {
203210
it('should intercept multiple successful emittables', () => {
204211
TestBed.configureTestingModule({
205212
imports: [NgxsModule.forRoot([CounterState]), NgxsEmitPluginModule.forRoot()],
206-
declarations: [MockComponent]
213+
declarations: [MockComponent],
214+
teardown: { destroyAfterEach: false }
207215
});
208216

209217
const fixture = TestBed.createComponent(MockComponent);
@@ -276,7 +284,8 @@ describe('Actions', () => {
276284
// Arrange
277285
TestBed.configureTestingModule({
278286
imports: [NgxsModule.forRoot([CounterState]), NgxsEmitPluginModule.forRoot()],
279-
declarations: [MockComponent]
287+
declarations: [MockComponent],
288+
teardown: { destroyAfterEach: false }
280289
});
281290

282291
// Act

emitter/src/tests/emit.plugin.spec.ts

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ describe(NgxsEmitPluginModule.name, () => {
7575

7676
TestBed.configureTestingModule({
7777
imports: [NgxsModule.forRoot([TodosState]), NgxsEmitPluginModule.forRoot()],
78-
declarations: [MockComponent]
78+
declarations: [MockComponent],
79+
teardown: { destroyAfterEach: false }
7980
});
8081

8182
const fixture = TestBed.createComponent(MockComponent);
@@ -122,7 +123,8 @@ describe(NgxsEmitPluginModule.name, () => {
122123

123124
TestBed.configureTestingModule({
124125
imports: [NgxsModule.forRoot([TodosState]), NgxsEmitPluginModule.forRoot()],
125-
declarations: [MockComponent]
126+
declarations: [MockComponent],
127+
teardown: { destroyAfterEach: false }
126128
});
127129

128130
const store: Store = TestBed.inject(Store);
@@ -158,7 +160,8 @@ describe(NgxsEmitPluginModule.name, () => {
158160

159161
TestBed.configureTestingModule({
160162
imports: [NgxsModule.forRoot([TodosState]), NgxsEmitPluginModule.forRoot()],
161-
declarations: [MockComponent]
163+
declarations: [MockComponent],
164+
teardown: { destroyAfterEach: false }
162165
});
163166

164167
const store: Store = TestBed.inject(Store);
@@ -198,7 +201,8 @@ describe(NgxsEmitPluginModule.name, () => {
198201

199202
TestBed.configureTestingModule({
200203
imports: [NgxsModule.forRoot([CounterState]), NgxsEmitPluginModule.forRoot()],
201-
declarations: [MockComponent]
204+
declarations: [MockComponent],
205+
teardown: { destroyAfterEach: false }
202206
});
203207

204208
const store: Store = TestBed.inject(Store);
@@ -242,7 +246,8 @@ describe(NgxsEmitPluginModule.name, () => {
242246

243247
TestBed.configureTestingModule({
244248
imports: [NgxsModule.forRoot([BarState, Bar2State]), NgxsEmitPluginModule.forRoot()],
245-
declarations: [MockComponent]
249+
declarations: [MockComponent],
250+
teardown: { destroyAfterEach: false }
246251
});
247252

248253
const store: Store = TestBed.inject(Store);
@@ -270,7 +275,8 @@ describe(NgxsEmitPluginModule.name, () => {
270275
}
271276

272277
TestBed.configureTestingModule({
273-
imports: [NgxsModule.forRoot([BarState]), NgxsEmitPluginModule.forRoot()]
278+
imports: [NgxsModule.forRoot([BarState]), NgxsEmitPluginModule.forRoot()],
279+
teardown: { destroyAfterEach: false }
274280
});
275281
} catch ({ message }) {
276282
expect(message).toBe('Method decorated with such type `foo` already exists');
@@ -318,7 +324,8 @@ describe(NgxsEmitPluginModule.name, () => {
318324
}
319325

320326
TestBed.configureTestingModule({
321-
imports: [NgxsModule.forRoot([BarState]), NgxsEmitPluginModule.forRoot()]
327+
imports: [NgxsModule.forRoot([BarState]), NgxsEmitPluginModule.forRoot()],
328+
teardown: { destroyAfterEach: false }
322329
});
323330

324331
const store: EmitStore = TestBed.inject(EmitStore);
@@ -383,7 +390,8 @@ describe(NgxsEmitPluginModule.name, () => {
383390
TestBed.configureTestingModule({
384391
imports: [NgxsModule.forRoot([TodosState]), NgxsEmitPluginModule.forRoot()],
385392
declarations: [MockComponent],
386-
providers: [ApiService]
393+
providers: [ApiService],
394+
teardown: { destroyAfterEach: false }
387395
});
388396

389397
const store: Store = TestBed.inject(Store);
@@ -418,7 +426,8 @@ describe(NgxsEmitPluginModule.name, () => {
418426

419427
TestBed.configureTestingModule({
420428
imports: [NgxsModule.forRoot([TodosState]), NgxsEmitPluginModule.forRoot()],
421-
declarations: [MockComponent]
429+
declarations: [MockComponent],
430+
teardown: { destroyAfterEach: false }
422431
});
423432

424433
const fixture = TestBed.createComponent(MockComponent);
@@ -456,7 +465,8 @@ describe(NgxsEmitPluginModule.name, () => {
456465

457466
TestBed.configureTestingModule({
458467
imports: [NgxsModule.forRoot([TodosState]), NgxsEmitPluginModule.forRoot()],
459-
declarations: [MockComponent]
468+
declarations: [MockComponent],
469+
teardown: { destroyAfterEach: false }
460470
});
461471

462472
const store: Store = TestBed.inject(Store);
@@ -497,7 +507,8 @@ describe(NgxsEmitPluginModule.name, () => {
497507

498508
TestBed.configureTestingModule({
499509
imports: [NgxsModule.forRoot([TodosState]), NgxsEmitPluginModule.forRoot()],
500-
declarations: [MockComponent]
510+
declarations: [MockComponent],
511+
teardown: { destroyAfterEach: false }
501512
});
502513

503514
const fixture = TestBed.createComponent(MockComponent);
@@ -533,7 +544,8 @@ describe(NgxsEmitPluginModule.name, () => {
533544

534545
TestBed.configureTestingModule({
535546
imports: [NgxsModule.forRoot([AnimalsState]), NgxsEmitPluginModule.forRoot()],
536-
declarations: [MockComponent]
547+
declarations: [MockComponent],
548+
teardown: { destroyAfterEach: false }
537549
});
538550

539551
const fixture = TestBed.createComponent(MockComponent);
@@ -586,7 +598,8 @@ describe(NgxsEmitPluginModule.name, () => {
586598

587599
TestBed.configureTestingModule({
588600
imports: [NgxsModule.forRoot([CounterState]), NgxsEmitPluginModule.forRoot()],
589-
declarations: [MockComponent]
601+
declarations: [MockComponent],
602+
teardown: { destroyAfterEach: false }
590603
});
591604

592605
const store: Store = TestBed.inject(Store);

emitter/testing/ng-package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
33
"lib": {
44
"flatModuleFile": "ngxs-labs-emitter-testing",
5-
"entryFile": "src/index.ts",
6-
"umdModuleIds": {
7-
"@ngxs/store": "ngxs-store"
8-
}
5+
"entryFile": "src/index.ts"
96
}
107
}

0 commit comments

Comments
 (0)