Wp-calypso: Store: Test Client: EISDIR: illegal operation on a directory

Created on 10 Jan 2018  ยท  4Comments  ยท  Source: Automattic/wp-calypso

Attempting to run the WooCommerce unit tests in a clean clone fails with the following

wp-calypso $ npm run test-client client/extensions/woocommerce/state/

> [email protected] pretest-client /Users/allendav/repos/wp-calypso
> npm run -s pretest


> [email protected] test-client /Users/allendav/repos/wp-calypso
> jest -c=test/client/jest.config.json "client/extensions/woocommerce/state/"

 FAIL  client/extensions/woocommerce/state
  โ— Test suite failed to run

    EISDIR: illegal operation on a directory, read

      at Object.readSync (node_modules/graceful-fs/polyfills.js:138:28)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.076s
Ran all test suites matching /client\/extensions\/woocommerce\/state\//i.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test-client: `jest -c=test/client/jest.config.json "client/extensions/woocommerce/state/"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test-client script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/allendav/.npm/_logs/2018-01-10T18_51_07_692Z-debug.log
Store [Type] Bug

All 4 comments

Master @ this commit (19 Dec) is fine (tests run successfully):

git checkout 90906ecfb30f198278e450c6897be93c57b9ca94
rm -rf node_modules/
npm run test-client client/extensions/woocommerce/state

But then the very next commit ( #20943 update to JEST 22) asplodes:

git checkout 7d98b9e146979ab00ba51d9f047e2def4911ff1a
rm -rf node_modules/
npm run test-client client/extensions/woocommerce/state

FAIL  client/extensions/woocommerce/state
Test suite failed to run
EISDIR: illegal operation on a directory, read
at Object.readSync (node_modules/graceful-fs/polyfills.js:138:28)

cc @sirreal

I can't speak as to why that worked before, but having a look at the Jest CLI docs:

Run only the tests that were specified with a pattern or filename:

jest my-test #or
jest path/to/my-test.js

This works:

npm run test-client woocommerce/state

I've been wondering and speculating about what the underlying cause of this issue may be, but I'm really not sure. Maybe our test config needs to be improved/corrected. At any rate, passing a "looser" pattern seems to be the fix.

Yep - I tried this and it also works

npm run test-client /client/extensions/woocommerce/state/

Basically is requiring the argument to look like a pattern (open and closing char match i suppose)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aduth picture aduth  ยท  3Comments

rickybanister picture rickybanister  ยท  3Comments

kellychoffman picture kellychoffman  ยท  3Comments

vparkhere picture vparkhere  ยท  3Comments

jjchrisdiehl picture jjchrisdiehl  ยท  3Comments