Test(Integration): migrate test/integration into @wordpress/integration-tests workspace#77556
Conversation
- Add test/integration workspace with package.json and Jest config - Add integration test scripts to root package.json - Link @wordpress/integration-tests in package-lock.json - Add bin/test-native-args.sh for testing native arg forwarding
Thought CI has special test unit syntax for integration but they are run with others so these are not needed now
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Let's ensure we don't repeat issues from #77063. |
Right now, this workspace doesn’t expose any scripts, and the fixture runs the unit test version which invokes test/integration via args. Because of that, this issue shouldn’t occur here. I’m waiting for input on whether we want to separate scripts for this case. If we do switch to using test:integration directly, I’ll update it to use the -- argument forwarding approach. |
|
Thanks for the confirmation, @USERSATOSHI! I'll defer to @manzoorwanijk on similar PRs. |
|
From a quick look
I don't see those changes. 🤔 It seems that the workspace is imported here Do we need to update that by adding the package as a dev dependency to |
| "devDependencies": { | ||
| "ajv": "^8.17.1", | ||
| "fast-glob": "^3.2.7" | ||
| }, |
There was a problem hiding this comment.
Let us ensure that we declare all the dependencies that the workspace uses.
There was a problem hiding this comment.
Also, agv can be removed from root package.json
| "gutenberg", | ||
| "integration-tests" | ||
| ], | ||
| "homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/test/integration/README.md", |
There was a problem hiding this comment.
This file doesn't exist. Let us create one.
manzoorwanijk
left a comment
There was a problem hiding this comment.
Let us polish things a bit as mentioned above.
There was a problem hiding this comment.
Pull request overview
Migrates the integration test suite into its own npm workspace (@wordpress/integration-tests) to make its dependency ownership explicit and prepare for stricter workspace dependency isolation.
Changes:
- Add
test/integration/package.jsondeclaring the new@wordpress/integration-testsworkspace and its integration-test-only devDependencies. - Register
test/integrationin the rootpackage.jsonworkspaces array. - Update
package-lock.jsonworkspace metadata for the new package.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
test/integration/package.json |
Introduces a new workspace package for integration tests and declares devDependencies. |
package.json |
Adds test/integration to the monorepo workspaces list. |
package-lock.json |
Records the new workspace link and package metadata in the lockfile. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| "devDependencies": { |
There was a problem hiding this comment.
Other test workspaces define workspace-scoped scripts and include the runner dependency they use (e.g. @wordpress/unit-tests includes @wordpress/scripts and test:unit* scripts in test/unit/package.json:22-48, and e2e/performance do similarly). This new @wordpress/integration-tests package currently has no scripts and no @wordpress/scripts; if the intent is to run integration tests independently via npm run --workspace @wordpress/integration-tests …, add the corresponding scripts and required devDependencies to match that established pattern.
| }, | |
| "devDependencies": { | |
| }, | |
| "scripts": { | |
| "test:integration": "wp-scripts test-unit-js", | |
| "test:integration:watch": "npm run test:integration -- --watch" | |
| }, | |
| "devDependencies": { | |
| "@wordpress/scripts": "^30.13.0", |
| "test/e2e", | ||
| "test/integration", | ||
| "test/performance", |
There was a problem hiding this comment.
PR description mentions adding test:integration/watch/debug scripts and a test/integration/jest.config.js, but those changes aren’t present (root scripts still only include unit-test runners, and test/integration/ has no jest config). Either update the PR description or include the missing script/config changes so the workspace can actually be executed independently as described.
| "gutenberg", | ||
| "integration-tests" | ||
| ], | ||
| "homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/test/integration/README.md", |
There was a problem hiding this comment.
The homepage points to test/integration/README.md, but there is no README.md at test/integration/ (only READMEs deeper in fixtures). This makes the package metadata link dead; either add test/integration/README.md or update the homepage URL to the directory (without README.md).
| "homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/test/integration/README.md", | |
| "homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/test/integration/", |
Oh right, I removed them thinking we don't need them anymore. My bad, forgot to update that part.
Sure let me check that! |
manzoorwanijk
left a comment
There was a problem hiding this comment.
This is almost ready to land. Let us update this branch from trunk and address one inline comment and then we are good to go.
| @@ -0,0 +1,58 @@ | |||
| # Integration Tests | |||
|
|
|||
| This directory contains the integration test suite for the Gutenberg project, published as the `@wordpress/integration-tests` workspace package. | |||
manzoorwanijk
left a comment
There was a problem hiding this comment.
This looks good now. Thank you for working on this.
|
Can we please update the branch from trunk? |
…ace (#77556) * Add integration test workspace and scripts - Add test/integration workspace with package.json and Jest config - Add integration test scripts to root package.json - Link @wordpress/integration-tests in package-lock.json - Add bin/test-native-args.sh for testing native arg forwarding * chore: remove my test script whoops * chore: workspaces list is alphabetically ordered * chore: remove not needed files Thought CI has special test unit syntax for integration but they are run with others so these are not needed now * chore: update package dependencies and add integration test documentation * chore: clarify README about integration test suite and workspace package Co-authored-by: USERSATOSHI <tusharbharti@git.wordpress.org> Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

What?
Part of #75041
Migrates
test/integrationinto a proper npm workspace@wordpress/integration-tests.Why?
The integration test suite previously had no
package.jsonand was not a registered workspace, meaning it relied entirely on hoisted root and unit-test dependencies with no explicit ownership. This PR ensures the workspace does not rely on root dependencies once dependency isolation is enforced.How?
test/integration/package.jsondeclaring the new@wordpress/integration-testsworkspace with only the dependencies unique to integration tests (ajv,fast-glob,@wordpress/scripts). All other deps (e.g.jest, testing-library) are resolved via hoisting fromtest/unitandpackages/scripts.test/integration/jest.config.jsthat extendstest/unit/jest.config.js, scoping test discovery totest/integration/**.test/integrationin the rootpackage.jsonworkspaces array.Integration tests continue to run as part of
npm run test:unitbut can now also be run independently.Testing Instructions
Note: The fixture uses integration through unit tests, and I’m not sure if this should be handled from the integration side.
If it is required, we can add the corresponding Jest configuration and scripts back.