WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.34k stars 4.13k forks source link

test-performance build script: Add build:packages/wp-env start scripts as dependency #22038

Open strarsis opened 4 years ago

strarsis commented 4 years ago

Describe the bug Just running the test-performance script (npm run test-performance) on a cleanly checked out worktree won't work as jest fails to find the monorepo modules in ./packages. This can be easily solved by running the build:packages and wp-env start scripts to have the monorepo modules all built and loadable by jest.

To reproduce Steps to reproduce the behavior:

  1. Check out Gutenberg (e.g. git clone https://github.com/WordPress/gutenberg)`
  2. Install the node modules/ensure node environment: nvm use && npm install
  3. Run the test-performance script: npm run test-performance. Notice that jest fails to start the testing because it cannot find packages in the monorepo.
  4. As fix, run the build:packages (npm run build:packages) and wp-env start (npm run wp-env start) scripts. After successful packages build, run the test-performance script again and notice that the jest loading issue is now fixed.

Expected behavior When a npm package script is invoked, all scripts on which output/state modifications/installing the invoked script depends on, should run first.

grappler commented 2 years ago

Came across the same issue. It might be good to just document the fix in the documentation until it is correctly fixed.