Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
17
rated 0 times [  22] [ 5]  / answers: 1 / hits: 142305  / 9 Years ago, mon, may 4, 2015, 12:00:00

I am trying to pass along a configuration file to Jest in order to run tests only from a given directory.



According to documentation, you can use config.testPathDirs: https://facebook.github.io/jest/docs/api.html#config-testpathdirs-array-string and you can call jest --config=<config-file>.



Unfortunately the documentation doesn't include any description of how the configuration file should look like.



I tried both these options in a jest-config.js file:



testPathDirs = ['coredata/src'];


and



config.testPathDirs(['coredata/src']);


and ran:



$ jest --config=jest-config.js


...but I get this type of error:



$ jest --config=jest-config.js
Using Jest CLI v0.4.0
Failed with unexpected error.

/Users/carles/dev/azazo/coredata/node_modules/jest-cli/src/jest.js:179
throw error;
^
SyntaxError: Unexpected token c
at Object.parse (native)
at /Users/carles/dev/azazo/coredata/node_modules/jest-cli/src/lib/utils.js:291:23
at _fulfilled (/Users/carles/dev/azazo/coredata/node_modules/jest-cli/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/Users/carles/dev/azazo/coredata/node_modules/jest-cli/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/Users/carles/dev/azazo/coredata/node_modules/jest-cli/node_modules/q/q.js:760:13)
at /Users/carles/dev/azazo/coredata/node_modules/jest-cli/node_modules/q/q.js:574:44
at flush (/Users/carles/dev/azazo/coredata/node_modules/jest-cli/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)

More From » jestjs

 Answers
4

I figured out that the config file is JSON.



{
testPathDirs: [coredata/src]
}


Unfortunately I found nowhere in the documentation a hint about this.


[#66760] Friday, May 1, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
payton

Total Points: 307
Total Questions: 96
Total Answers: 83

Location: Saint Vincent and the Grenadines
Member since Sat, Sep 11, 2021
3 Years ago
;