Skip to content

Commit

Permalink
fix: upgrade NestJS to major version 8
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The peer dependencies of NestJS and rxjs have been increased
to the next major version. To use the new nestjs-unleash version, your project
must be updated to NestJS 8 and rxjs 7.

test: fix broken e2e test
  • Loading branch information
pmb0 committed Jul 31, 2021
1 parent 56eb6ef commit d4a99a0
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 367 deletions.
2 changes: 1 addition & 1 deletion e2e/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('AppController (e2e)', () => {
app = await NestFactory.create<NestExpressApplication>(
ApplicationModule,
new ExpressAdapter(),
{ logger: true, abortOnError: false },
{ logger: ['debug'], abortOnError: false },
)

app.enableShutdownHooks()
Expand Down
25 changes: 14 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,27 @@
"murmurhash3js": "^3.0.1"
},
"peerDependencies": {
"@nestjs/common": "^7.0.0",
"@nestjs/core": "^7.0.0",
"@nestjs/schedule": "^0.4.1",
"@nestjs/axios": "^0.0.1",
"@nestjs/common": "^8.0.5",
"@nestjs/core": "^8.0.5",
"@nestjs/schedule": "^1.0.1",
"axios": "^0.21.0",
"reflect-metadata": "^0.1.2"
"reflect-metadata": "^0.1.12",
"rxjs": "^7.3.0"
},
"devDependencies": {
"@commitlint/cli": "^13.0.0",
"@commitlint/config-conventional": "^13.0.0",
"@heise/eslint-config": "^18.0.1",
"@nestjs/cli": "^7.0.0",
"@nestjs/common": "^7.0.0",
"@nestjs/axios": "^0.0.1",
"@nestjs/cli": "^8.1.0",
"@nestjs/common": "^8.0.5",
"@nestjs/config": "^1.0.0",
"@nestjs/core": "^7.0.0",
"@nestjs/platform-express": "^7.5.5",
"@nestjs/schedule": "^0.4.1",
"@nestjs/core": "^8.0.5",
"@nestjs/platform-express": "^8.0.5",
"@nestjs/schedule": "^1.0.1",
"@nestjs/schematics": "^8.0.0",
"@nestjs/testing": "^7.5.5",
"@nestjs/testing": "^8.0.5",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/commit-analyzer": "^8.0.1",
"@semantic-release/git": "^9.0.0",
Expand All @@ -84,7 +87,7 @@
"pinst": "^2.1.1",
"reflect-metadata": "^0.1.12",
"rimraf": "^3.0.2",
"rxjs": "^6.6.3",
"rxjs": "^7.3.0",
"semantic-release": "^17.3.0",
"ts-jest": "27.0.4",
"ts-loader": "^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/unleash-client/register/register-client.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HttpModule } from '@nestjs/common'
import { HttpModule } from '@nestjs/axios'
import { Test, TestingModule } from '@nestjs/testing'
import { UnleashRegisterClient } from '..'
import { version } from '../../../package.json'
Expand Down
3 changes: 2 additions & 1 deletion src/unleash-client/unleash-client.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DynamicModule, HttpModule, Module, Provider } from '@nestjs/common'
import { HttpModule } from '@nestjs/axios'
import { DynamicModule, Module, Provider } from '@nestjs/common'
import { AxiosRequestConfig } from 'axios'
import {
UnleashFeaturesClient,
Expand Down
2 changes: 1 addition & 1 deletion src/unleash-client/unleash-client.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HttpModule, HttpService } from '@nestjs/common'
import { HttpModule, HttpService } from '@nestjs/axios'
import { Test, TestingModule } from '@nestjs/testing'
import { of } from 'rxjs'
import { UnleashClient } from './unleash-client'
Expand Down
6 changes: 4 additions & 2 deletions src/unleash-client/unleash-client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { HttpService, Injectable, Logger } from '@nestjs/common'
import { HttpService } from '@nestjs/axios'
import { Injectable, Logger } from '@nestjs/common'
import { AxiosRequestConfig } from 'axios'
import { firstValueFrom } from 'rxjs'

@Injectable()
export class UnleashClient {
Expand All @@ -13,7 +15,7 @@ export class UnleashClient {
const url = config.url ?? '(unknown url)'

this.logger.debug(`Request: ${method} ${baseUrl}${url}`)
const response = await this.http.request<T>(config).toPromise()
const response = await firstValueFrom(this.http.request<T>(config))
return response.data
}

Expand Down
Loading

0 comments on commit d4a99a0

Please sign in to comment.