Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

notanengineercom
Copy link
Collaborator

@notanengineercom notanengineercom commented Oct 11, 2020

This branch is the base of v2 (feature branch).
It contains the base of the new structure.
All existing features are supported, with a few changes.

💥 Breaking Changes

  • Setting multiple return values will use the last value instead of undefined after all the values have been used
    • 👀

      test('resolves different values in the specified order on a method', async t => {
      const calculator = Substitute.for<Calculator>()
      calculator.heavyOperation(Arg.any('number')).resolves(1, 2, 3)
      t.is(await calculator.heavyOperation(0), 1)
      t.is(await calculator.heavyOperation(0), 2)
      t.is(await calculator.heavyOperation(0), 3)
      t.is(await calculator.heavyOperation(0), 3) // https://github.com/nsubstitute/NSubstitute/blob/master/tests/NSubstitute.Acceptance.Specs/ReturningResults.cs#L37-L42
      })

✨ New Features

  • Logging a substitution will print a custom object with all calls
    • 👀 Screenshot 2021-09-13 at 00 17 48
  • Clearing / resetting a Substitute

🎨 Improvements

  • Nicer and clearer assertion messages
    • 👀 Screenshot 2021-09-13 at 00 05 17

@notanengineercom notanengineercom added enhancement New feature or request wip Work in progress - should not merge labels Oct 11, 2020
@notanengineercom notanengineercom self-assigned this Oct 11, 2020
@notanengineercom notanengineercom changed the title Substitute v2-beta: Replace context switches with nodes in linked lists Substitute v2-beta: Rework substitution logic Sep 12, 2021
@notanengineercom notanengineercom changed the title Substitute v2-beta: Rework substitution logic [ReleaseBranch] Substitute v2-beta: Rework substitution logic Sep 12, 2021
* move existing tests to regression folder

* add RecordedArguments spec

* create Utilities spec
* improve proxy creation function

* use node contexts to simplify node logic

* implement custom records set

RecordsSet implements the higher order filter and map methods which get applied when retrieving the iterator. This increases performance as it doesn't create arrays on each .map or .filter -> the iterator yields only the end values with one iteration
resolves #46 

* implement clearSubstitute

* add clearSubstitute spec
@ffMathy
Copy link
Owner

ffMathy commented Oct 4, 2021

Awesome work so far. Looking forward to it being ready for review!

@notanengineercom
Copy link
Collaborator Author

Thanks 😄
You can see in the v2-release project board what's still pending. A refactor is due before the final v2 release too.
By the way, what do you think of releasing a beta version of the library with the latest commit on this branch?
People can start experimenting with v2, using the new features and worst case scenario, report back issues.
In theory everything is working (regression and new tests are green), but you never know 🤷‍♂️

@ffMathy
Copy link
Owner

ffMathy commented Oct 4, 2021

I see no issues with that, but then I think this project should also have its own CI pipeline. Because right now, it's hard to do, because everything is published using https://github.com/ffMathy/FluffySpoon.Publishers.

@notanengineercom
Copy link
Collaborator Author

That's what I wanted to suggest, it would great to have the release system in a Github Action.
This would also allow us to have a better control on what gets included in the release (packing the built lib is visible in the repo), to avoid having a release per commit to master, and to align the package.json with the npm version number.

@ffMathy
Copy link
Owner

ffMathy commented Oct 4, 2021

Indeed! Feel free to make an actions.yml file in this repo that does all the heavy lifting. Then I'll create a repo secret for the NuGet API key.

@ffMathy
Copy link
Owner

ffMathy commented Oct 4, 2021

In the long run though, FluffySpoon.Publishers will transition into being based on actions itself though. But that won't be in the next foreseeable future.

@notanengineercom
Copy link
Collaborator Author

Sure, that sounds like a good idea 👍

Then I'll create a repo secret for the NuGet API key.

We need a NPM api key, don't we?
Moving FluffySpoon.Publishers to a Github Action would be ideal, but I don't think it's crucial right now 😄

@ffMathy
Copy link
Owner

ffMathy commented Oct 4, 2021

I already have a key 😊 if you can make it work with placeholder values for the key, I'll insert the real one as a GitHub secret 😊🙏

@notanengineercom
Copy link
Collaborator Author

I just merged a publish github action, which publishes both to npm and github.
I think both failed due to lack of permissions (github) and no npm token (npm). Or might be missing something 😆
Could you try removing the release I created, and creating a new one again? (only important bit here is the tag name)

@notanengineercom
Copy link
Collaborator Author

The npm token name for the secrets is npm_token. The github one I assume is the self generated one - which I think only you have write permissions when used

@ffMathy
Copy link
Owner

ffMathy commented Jun 2, 2022

I tried committing something to retry now. Hopefully it works. @notanengineercom not sure what happened, but somehow your message got lost in translation. I'll try to follow up on it soon, so we can get this beautiful work out.

As for coding styles though, I think you should re-add the semicolons, but we can do that later too.

@ffMathy ffMathy merged commit 6e3011a into master Jun 2, 2022
@ffMathy ffMathy deleted the v2-beta branch June 2, 2022 07:26
@ffMathy ffMathy added this to the v2.0 milestone Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ✨v2 release wip Work in progress - should not merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants