Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug: Collecting included files possibly missing bunch of them #1522

Open
3 tasks done
rubiesonthesky opened this issue Apr 4, 2024 · 1 comment · May be fixed by #1542
Open
3 tasks done

🐛 Bug: Collecting included files possibly missing bunch of them #1522

rubiesonthesky opened this issue Apr 4, 2024 · 1 comment · May be fixed by #1542
Labels
status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛

Comments

@rubiesonthesky
Copy link
Collaborator

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Expected

I expected code to collect all files that match include from compilerOptions: [ 'src', 'test/*.ts' ]

Actual

In practice, it seems that only these files where matched

[
  'test/postProcessing.test.ts',
  'test/infiniteWaveDetection.test.ts',
  'test/include.test.ts',
  'test/fixStrictNonNullAssertions.test.ts',
  'test/fixNoInferableTypes.test.ts',
  'test/fixNoImplicitThis.test.ts',
  'test/fixNoImplicitAny.test.ts',
  'test/fixMissingProperties.test.ts',
  'test/fixIncompleteTypes.test.ts',
  'test/fixImportExtensions.test.ts',
  'test/filters.test.ts',
  'test/files.test.ts',
  'test/customMutators.test.ts',
  'test/cleanups.test.ts'
]

Additional Info

I added logging to parseRawCompilerOptions to check what is doing with include. It's read correctly as [ 'src', 'test/*.ts' ] but then parseJsonConfigFileContent.filenames sets it to be just those files mentioned in Actual section.

There is mutation test for include, but it seems that the test setup does not use parseRawCompilerOptions at all. So it's not actually tested.

This manifest so that suppressTypeErrors is adding a lot ts-expect-error comments all around about things that are not problems.

@rubiesonthesky rubiesonthesky added the type: bug Something isn't working :( 🐛 label Apr 4, 2024
@rubiesonthesky
Copy link
Collaborator Author

If we change the code to be following, then it collect the correct files. However, it's still adding a lot unnecessary ts-expect-error comments. So there must be something else.

	config.include &&= ts.parseJsonConfigFileContent(
		compilerOptions.config,
		{
			fileExists: fs.existsSync,
			// eslint-disable-next-line @typescript-eslint/unbound-method
			readDirectory: ts.sys.readDirectory,
			readFile: (file) => fs.readFileSync(file, "utf8"),
			useCaseSensitiveFileNames: true,
		},
		cwd,
	).fileNames;

@rubiesonthesky rubiesonthesky added the status: accepting prs Please, send a pull request to resolve this! 🙏 label Apr 7, 2024
@rubiesonthesky rubiesonthesky linked a pull request Apr 7, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! 🙏 type: bug Something isn't working :( 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant