Node 6.5, Linux, Yarn 0.16
Repo to reproduce: https://github.com/reflog/yarn_problem_2
did:
yarn init
yarn add typescript tslint
ran 'tslint' - all is well
ran
yarn clean
tslint
it fails with:
module.js:457
throw err;
^
Error: Cannot find module './test/parse'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/reflog/Rafael/yarn_problem_2/node_modules/tslint/lib/test.js:10:13)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
You can add exclude rules to .yarnclean.
Example Gist
In this case !tslint/src/test/parse.ts might do the trick. (untested)
You can do what @marzepani suggests. yarn clean is working correctly here since it's common for module authors to accidently publish packages with the original test folder and that file is hitting that rule.
@kittens But probably only root folder test should be cleaned, not subfolders (src/test). And especially not sub of src folder.
I just hit the same issue. tslint requires the /tslint/lib/test/ folder to run correctly. Anything under src or lib that has test in it should not be removed. In this case, it breaks tslint.
I have run across this one as well, I can confirm that the entry in the .yarnclean works around the problem. After yarn clean tslint keeps working.
Most helpful comment
@kittens But probably only root folder
testshould be cleaned, not subfolders (src/test). And especially not sub ofsrcfolder.