Skip to content

Move to Mocha tests#320

Open
harryadel wants to merge 53 commits intomasterfrom
mocha-tests
Open

Move to Mocha tests#320
harryadel wants to merge 53 commits intomasterfrom
mocha-tests

Conversation

@harryadel
Copy link
Member

@harryadel harryadel commented Jul 11, 2025

  • Fix failing server side tests

  • Fix linting

  • Verify .find hooks work
    History & README were updated to properly reflect the current package status

  • Support both sync and async operations in all hooks
    As I was working on the package I thought it'd be possible to support async operations in sync hooks but I then figured how hard it'd be to support such a thing as blocking sync execution based on a sync operation wouldn't be feasible and allowing async operations as fire-and-forget to not block things would be awkward. I know understand why @bhunjadi decided to drop sync support and now hooks are only triggered on async operations (ex: findOneAsync instead of findOne)

     collection.before.findOne(async function(userId, selector) {
       console.log('Async hook started')
       await fetch('/api/log-access') // Takes 200ms
       console.log('Async hook finished')
     })
    
     // Sync call
     const doc = collection.findOne({name: 'John'})
     console.log('findOne returned:', doc)
     Async hook started                    // ← Hook fires immediately
     findOne returned: {_id: 1, name: 'John'}  // ← findOne completes WITHOUT waiting
     Async hook finished                   // ← Hook completes later (200ms later)
  • Fix CI tests

  • Utilize https://packosphere.com/lai/collection-extensions until Integrate lai:collection-extensions into core meteor/meteor#13830 gets merged

  • Once it's ready, ping @vparpoil for one last test


Post release

…` instead of `_super`. Introduce constants for async methods and MongoDB operators for better readability and maintainability.
@jankapunkt
Copy link
Member

hey @harryadel anything you need here to move on?

@harryadel
Copy link
Member Author

I was hoping to gather some feedback from the community but nobody chimed in 🤷 we could pull the trigger nonetheless

@harryadel harryadel marked this pull request as ready for review December 30, 2025 17:19
…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@harryadel harryadel changed the title [WIP] Move to Mocha tests Move to Mocha tests Dec 30, 2025
@jankapunkt
Copy link
Member

massive PR @harryadel !!! @StorytellerCZ from my end this looks good but I can't field test the rc until next week, do you have the resources for that?

@StorytellerCZ
Copy link
Member

I'm busy till next week for anything big as well.

@harryadel
Copy link
Member Author

@StorytellerCZ I can wait things out for sure but I'd definitely need you to have a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants