2022-08-15 18:59:36 +03:00
|
|
|
const fs = require('fs')
|
|
|
|
const path = require('path')
|
|
|
|
const packJson = require('../package.json')
|
2023-01-05 04:03:17 +03:00
|
|
|
const runAllSpecs = require('./run-tests')
|
2022-08-15 18:59:36 +03:00
|
|
|
|
2022-08-18 00:40:42 +03:00
|
|
|
module.exports = function(filter) {
|
|
|
|
let packagePath = []
|
|
|
|
|
|
|
|
for(let pack in packJson.packageDependencies) {
|
|
|
|
if(pack.match(filter)) {
|
|
|
|
let basePath = path.join('node_modules', pack)
|
|
|
|
let testPath = path.join(basePath, 'test')
|
|
|
|
let specPath = path.join(basePath, 'spec')
|
|
|
|
if(fs.existsSync(testPath)) packagePath.push(testPath)
|
|
|
|
if(fs.existsSync(specPath)) packagePath.push(specPath)
|
|
|
|
}
|
|
|
|
}
|
2022-08-15 18:59:36 +03:00
|
|
|
|
2023-01-05 04:03:17 +03:00
|
|
|
runAllSpecs(packagePath)
|
2022-08-18 00:40:42 +03:00
|
|
|
}
|