Fix Testing Suite to Work Out of the Box #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Testing Suite to Work Out of the Box and Add GitHub Workflow
This PR addresses issues with the testing suite to ensure it works correctly out of the box for the Payload CMS plugin template. It also adds a GitHub workflow to automatically run tests.
Changes
Updated Dependencies
@payloadcms/plugin-cloud
from^2.0.0
to^3.0.2
dotenv
from^8.2.0
to^16.4.5
payload
from^2.0.0
to^2.27.0
mongodb-memory-server
version^10.0.0
nodemon
from^2.0.6
to^3.1.4
ts-node
from^9.1.1
to^10.9.2
Testing Configuration
jest.config.js
to use@swc/jest
for transformationplugin.spec.ts
to improve test setup and teardown:beforeAll
hook to 30 secondsafterAll
hook to 10 secondsBuild and Development Scripts
payload.config.ts
to import the plugin from thedist
directory instead ofsrc
server.ts
to return a Promise resolving to the server instance, allowing for better test controlAdded GitHub Workflow
.github/workflows/test.yml
to run tests automatically:Other Improvements
dev/package.json
script with"test": "jest --forceExit --detectOpenHandles"
Testing
The new GitHub workflow will automatically run tests on push and pull requests. You can also verify that the testing suite works correctly locally by running:
All tests should pass without any configuration issues.