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

Add test to make sure .d.ts files are ignored when checking for TypeScript #6858

Merged
merged 1 commit into from
May 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/fixtures/issue-5947-not-typescript/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ test('Ignores node_modules when detecting TypeScript', async () => {
'package',
'index.ts',
];
const dtsSrcPath = [testSetup.testDirectory, 'src', 'types', 'index.d.ts'];
const tsSrcPath = path.join(testSetup.testDirectory, 'src', 'index.ts');

// Step 1.
Expand All @@ -28,6 +29,13 @@ test('Ignores node_modules when detecting TypeScript', async () => {
await testSetup.scripts.build();
expect(fs.existsSync(tsConfigPath)).toBe(false);

// Step 1b.
// See if src/types/index.d.ts is treated as a JS project
fs.mkdirSync(path.join(...dtsSrcPath.slice(0, 3)));
fs.writeFileSync(path.join(...dtsSrcPath));
await testSetup.scripts.build();
expect(fs.existsSync(tsConfigPath)).toBe(false);

// Step 2.
// Add TS and ensure tsconfig.json is generated
fs.writeFileSync(tsSrcPath);
Expand Down