teambit / bit.envs

DEPRECATED - Bit compilers and testers were moved to https://github.com/teambit/envs
https://bit.dev/bit/envs
Other
23 stars 9 forks source link

Jest test command line fails when the project's path contains spaces #10

Open zipang opened 5 years ago

zipang commented 5 years ago

Hi everyone !

OK, looks like i've found the place to open this issue and a submit a PR.

After adding jest to my test envs and trying a bit test, i've got the following error :

15:30 $ bit test
utils/object-paths
tests failed
file: src/utils/object-paths/index.spec.js

❌   Jest failure
    Command failed: "/usr/local/bin/node" /Users/christophe/Workspace/My Projects/bit-boilerplate/.bit/components/testers/jest/bit.envs/0.0.34/node_modules/jest/bin/jest.js /Users/christophe/Workspace/My Projects/bit-boilerplate/src/utils/object-paths/index.spec.js --rootDir=/Users/christophe/Workspace/My Projects/bit-boilerplate/src/utils/object-paths --config=/Users/christophe/Workspace/My Projects/bit-boilerplate/.bit/components/testers/jest/bit.envs/0.0.34/dist/jest.config.js --json --outputFile="index-results.json"
internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module '/Users/christophe/Workspace/My'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:775:12)
    at startup (internal/bootstrap/node.js:300:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:826:3)
 `"/usr/local/bin/node" /Users/christophe/Workspace/My Projects/bit-boilerplate/.bit/components/testers/jest/bit.envs/0.0.34/node_modules/jest/bin/jest.js /Users/christophe/Workspace/My Projects/bit-boilerplate/src/utils/object-paths/index.spec.js --rootDir=/Users/christophe/Workspace/My Projects/bit-boilerplate/src/utils/object-paths --config=/Users/christophe/Workspace/My Projects/bit-boilerplate/.bit/components/testers/jest/bit.envs/0.0.34/dist/jest.config.js --json --outputFile="index-results.json"` (exited with error code 1)

Which is obviously due to the fact the path to my project's folder contains a space... The fix is obvious : just surround every path from the command line with "