Skip to content

Add @trigger.dev/testing package#432

Merged
matt-aitken merged 10 commits intotriggerdotdev:mainfrom
nicktrn:feat-testing-package
Sep 11, 2023
Merged

Add @trigger.dev/testing package#432
matt-aitken merged 10 commits intotriggerdotdev:mainfrom
nicktrn:feat-testing-package

Conversation

@nicktrn
Copy link
Copy Markdown
Collaborator

@nicktrn nicktrn commented Sep 4, 2023

As ordered.

# build
pnpm build --filter @trigger.dev/testing

# install
pnpm install

# test
pnpm test --filter @examples/unit-testing

Leaving this in draft as I won't be available for a few days. Should be ready though, so feel free to test and review!

Fixes #379
/claim #379

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Sep 4, 2023

🦋 Changeset detected

Latest commit: 9e30181

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@trigger.dev/testing Patch
@examples/unit-testing Patch
@trigger.dev/tailwind-config Patch
@trigger.dev/tsconfig Patch
@trigger.dev/astro Patch
@trigger.dev/cli Patch
@trigger.dev/core Patch
@trigger.dev/eslint-plugin Patch
@trigger.dev/express Patch
@trigger.dev/integration-kit Patch
@trigger.dev/nextjs Patch
@trigger.dev/react Patch
@trigger.dev/sdk Patch
@trigger.dev/airtable Patch
@trigger.dev/github Patch
@trigger.dev/openai Patch
@trigger.dev/plain Patch
@trigger.dev/resend Patch
@trigger.dev/sendgrid Patch
@trigger.dev/slack Patch
@trigger.dev/stripe Patch
@trigger.dev/supabase Patch
@trigger.dev/typeform Patch
@examples/job-catalog Patch
perf Patch
@examples/jobs-starter Patch
nextjs-12 Patch
@examples/nextjs Patch
@examples/package-tester Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Member

@matt-aitken matt-aitken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we made some changes to how integrations work – they now don't have explicit Tasks. Tasks can be structured however an author wants, including nested.

I've made a suggestion about mocking io.runTask

@nicktrn
Copy link
Copy Markdown
Collaborator Author

nicktrn commented Sep 11, 2023

Well, I guess that was bad timing. @matt-aitken thanks for updating the dummy integration and pointers re the new format. Wasn't a trivial fix indeed.

Minor API change: Function spies are now exposed and indexed via their key on jobTestResult.tasks.

I've also added tests to the package itself, so it doesn't have to be constantly rebuilt for testing during dev.

@nicktrn nicktrn marked this pull request as ready for review September 11, 2023 08:08
@nicktrn nicktrn requested a review from matt-aitken September 11, 2023 08:08
Copy link
Copy Markdown
Member

@matt-aitken matt-aitken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great PR @nicktrn. Thanks for adapting it so quickly after we changed how integration tasks work.

@matt-aitken matt-aitken merged commit 6de8bd4 into triggerdotdev:main Sep 11, 2023
@nicktrn
Copy link
Copy Markdown
Collaborator Author

nicktrn commented Sep 11, 2023

Thank you kindly! 🎩

@nicktrn nicktrn deleted the feat-testing-package branch November 9, 2023 13:27
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.

[TRI-1127] Improvement: Add a @trigger.dev/testing package that allows for unit testing job runs

2 participants