project.getSourceFiles() filtering not working in v11
See original GitHub issueDescribe the bug
Version: 11.0.3
project.getSourceFiles() // return --> all files
Works just fine
project.getSourceFiles('**/*.ts') // return -> [] (doesn't get the files)
project.getSourceFiles('exact/file/path/to/file') // return -> [] (doesn't get the files)
project.getSourceFile('exact/file/path/to/file') // return -> undefined (doesn't get the file)
This doesn’t.
To Reproduce
const projectDirectory = '/someDirectory'
const projectConfigFile = path.join(projectDirectory, 'tsconfig.json')
const project = new Project({
tsConfigFilePath: projectConfigFile,
})
const sourceFilesAll = project.getSourceFiles() // return --> [...source files (all)...]
const sourceFilesFiltered = project.getSourceFiles('**/*.ts') // return --> [] (empty)
Expected behavior
Filters should just works well!
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Filter Drop-Down Not Working in Excel - YouTube
In this video I explore eight reasons why filtering in Excel is not working properly (or at all!).Table of Contents: 00:00 ...
Read more >Filter tasks or resources - Microsoft Support
With Project, you can filter your view so that you only see the critical tasks, milestones, and other information that's most important to...
Read more >JQL Filter not working for filtering issues in the second board
I have 2 teams working on the same project. I created a JQL filter and shared it with the project but its not...
Read more >Filtering projects - GitHub Docs
Use filters to choose which items appear in your project's views. You can customize views using filters for item metadata, such as assignees...
Read more >5 Reasons why your Excel filter may not be working
5 Reasons why your Excel filter may not be working · 1. Check that you have selected all of the data · 2....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s done this way because then all the paths use the same directory as the base including at project initialization. Additionally, when you use
project.getFileSystem()
everything will be relative from the cwd. I don’t believe it would make sense to make it relative based on the directory of the tsconfig once you initialize. For example, say there was the following structure and the cwd was the root:I’m not sure it would be desirable to work this way:
I would expect the current behaviour:
Sure, thanks! That would be great to add something saying that it’s based on the current working directory.
Could you provide more details and something I could take to reproduce this? I’m not sure what files exist in that project. What you’re doing should work. Perhaps the current working directory is different and you need to do
${projectDirectory}/**/*.ts