spec-change
Computes specs to re-run when files change
Based on the import
and require
directives.
const { getDependentFiles } = require('spec-change')
const deps = getDependentFiles([
'path/to/spec1.js',
'path/to/spec2.js',
...
], 'path/to/common/directory')
The output will be an object with all files (the initial plus all files they import or require). Each key will be a relative filename to the directory. The values will be arrays, with relative filenames of files dependent on the key file.
{
'path/to/spec1.js': ['path/to/spec1.js'],
'path/to/spec2.js': ['path/to/spec2.js'],
'path/to/utils.js': ['path/to/spec2.js'],
...
}
Small print
Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2022
License: MIT - do anything with the code, but don't blame me if it does not work.
Support: if you find any problems with this module, email / tweet /
open issue on Github