Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix(core): Allow circular structures for dynamic module #678 #1142

Merged
merged 1 commit into from
Oct 5, 2018

Conversation

BrunnerLivio
Copy link
Member

@BrunnerLivio BrunnerLivio commented Oct 2, 2018

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

It does not support circular structures for dynamic modules

Issue Number: #678

What is the new behavior?

Supports circular structures for dynamic modules by replacing JSON.stringify with fast-safe-stringify which allows to stringify circular structures.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@coveralls
Copy link

coveralls commented Oct 2, 2018

Coverage Status

Coverage increased (+0.002%) to 93.709% when pulling 958da96 on BrunnerLivio:fix/circular-structures into 1acae78 on nestjs:master.

@BrunnerLivio
Copy link
Member Author

If this PR gets approved we should consider adding e2e test for this edge case. It was quite annoying to migrate my Nest 4 app to Nest 5. Luckily I am a member of this framework, so I directly knew where to look, but a normal user would have been lost.

@kamilmysliwiec
Copy link
Member

Thanks @BrunnerLivio, great job! Could you create an integration test in the integration/injector directory (based on the existing examples) :)?

@BrunnerLivio
Copy link
Member Author

BrunnerLivio commented Oct 2, 2018

@kamilmysliwiec
Hmm can not run the integration tests. Looking through the travis.yml I even realized we do not run these in the pipeline haha.

I also had to install all the packages from the integration/* directories. I used

for D in integration/*; do [ -d "${D}" ] && npm i; done

Is this the intended way?

After I installed the dependencies and run npm run integration-test I became the following error:

TSError: ⨯ Unable to compile TypeScript
integration/graphql/e2e/graphql.spec.ts (14,5): Type 'INestApplication & INestExpressApplication' is not assignable to type 'INestApplication'.
  Types of property 'useWebSocketAdapter' are incompatible.
    Type '(adapter: WebSocketAdapter<any>) => INestApplication & INestExpressApplication' is not assignable to type '(adapter: WebSocketAdapter<any>) => INestApplication'.
      Types of parameters 'adapter' and 'adapter' are incompatible.
        Type 'WebSocketAdapter<any>' is not assignable to type 'WebSocketAdapter<any>'. Two different types with this name exist, but they are unrelated.
          Types of property 'bindMessageHandlers' are incompatible.
            Type '(client: any, handlers: { message: any; callback: (...args: any[]) => any; }[], transform: (data:...' is not assignable to type '(client: any, handlers: { message: any; callback: (...args: any[]) => any; }[], transform: (data:...'. Two different types with this name exist, but they are unrelated.
              Types of parameters 'transform' and 'transform' are incompatible.
                Type 'Observable<any>' is not assignable to type 'Observable<any>'. Two different types with this name exist, but they are unrelated.
                  Types of property 'source' are incompatible.
                    Type 'Observable<any>' is not assignable to type 'Observable<any>'. Two different types with this name exist, but they are unrelated. (2322)

Are these tests even up to date?

I think we really need a proper Contribution guide haha

@kamilmysliwiec
Copy link
Member

We've got ~80 integration tests, they all are up to date (running on each publish) :) Simply call npm run build to move fresh packages to the integration directory (and yes, contribution guide is very required :D). Also, you can run docker-compose up -d inside integration dir to mount all necessary containers.

@BrunnerLivio
Copy link
Member Author

BrunnerLivio commented Oct 3, 2018

@kamilmysliwiec done

Still did not got the graphql/mongoose test running because of the compile error, but I disabled them locally so I can work.

@BrunnerLivio
Copy link
Member Author

@kamilmysliwiec can this be part of the 5.4.0 release? I saw this PR is not assigned to the 5.4.0. On purpose or not yet?

My private project release is currently blocked because of this bug, so I'd warmly welcome this in the next release..

@kamilmysliwiec
Copy link
Member

@BrunnerLivio it's gonna be 5.3.11 which will be published in less than 1h 😅

@kamilmysliwiec kamilmysliwiec merged commit 958da96 into nestjs:master Oct 5, 2018
@lock
Copy link

lock bot commented Sep 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants