Reputation: 29
I am setting up test automation using yarn, selenium, and node js. In the wdio.conf.js
file, I must fill in a specs
array which is an array of strings. These strings are paths of js
files to execute. I cannot find figure out how to include every single js file in the folder. My structure looks like this
/specs/productA/
Within /productA
there are .js
files in the root, as well as sub folders, and folders within those sub folders.
/specs/productA/testCollectionA/
/specs/productA/testCollectionB/
/specs/productA/testCollectionC/subCollection/
How can I target every single js
file in the root, and recursively?
Upvotes: 1
Views: 86
Reputation: 76929
This is very easy to do using node-glob.
const glob = require("glob")
glob("**/*.js", options, function (error, paths) {
// `paths` will have your files
})
Edit: I think the specs
entry in wdio.conf.js
actually takes glob syntax. Try using this:
specs: [ "tests/**/*.js" ]
Upvotes: 2