Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions assets/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"allowSyntheticDefaultImports": true,
"noEmit": true,
"jsx": "react-jsx",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With TypeScript 6, the default for types changed: https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/#types-now-defaults-to-[]

This means we need to add "types": ["node"] here. It's weird that TypeScript docs on this aren't yet updated 🤔 microsoft/TypeScript#63392

"types": ["node"],
},
"include": ["./src"],
}
3 changes: 3 additions & 0 deletions src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ export class Generator {
for (const browserName of ['chromium', 'firefox', 'webkit'])
sections.set(browserName, !this.options.browser || this.options.browser.includes(browserName) ? 'show' : 'comment');

if (answers.language === 'TypeScript')
files.set('tsconfig.json', this._readAsset('tsconfig.json'));

let ctPackageName;
let installExamples = !this.options.noExamples;
if (answers.framework) {
Expand Down
5 changes: 5 additions & 0 deletions tests/integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ test('should generate a project in the current directory', async ({ run, dir, pa
test.skip(packageManager === 'yarn-classic' || packageManager === 'yarn-berry');
test.slow();
const { stdout } = await run([], { installGitHubActions: true, testDir: 'tests', language: 'TypeScript', installPlaywrightDependencies: false, installPlaywrightBrowsers: true });
expect(fs.existsSync(path.join(dir, 'tsconfig.json'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'tests/example.spec.ts'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'package.json'))).toBeTruthy();
assertLockFilesExist(dir, packageManager);
Expand Down Expand Up @@ -59,6 +60,7 @@ test('should generate a project in the current directory', async ({ run, dir, pa
test('should generate a project in a given directory', async ({ run, dir, packageManager }) => {
test.skip(packageManager === 'yarn-classic' || packageManager === 'yarn-berry');
await run(['foobar'], { installGitHubActions: true, testDir: 'tests', language: 'TypeScript', installPlaywrightDependencies: false, installPlaywrightBrowsers: true });
expect(fs.existsSync(path.join(dir, 'foobar/tsconfig.json'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'foobar/tests/example.spec.ts'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'foobar/package.json'))).toBeTruthy();
assertLockFilesExist(path.join(dir, 'foobar'), packageManager);
Expand All @@ -78,6 +80,7 @@ test('should generate a project with JavaScript and without GHA', async ({ run,
test('should generate be able to run TS examples successfully', async ({ run, dir, exec, packageManager }) => {
test.slow();
await run([], { installGitHubActions: false, testDir: 'tests', language: 'TypeScript', installPlaywrightDependencies: false, installPlaywrightBrowsers: true });
expect(fs.existsSync(path.join(dir, 'tsconfig.json'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'tests/example.spec.ts'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'package.json'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'playwright.config.ts'))).toBeTruthy();
Expand Down Expand Up @@ -114,6 +117,7 @@ test('should generate in the root of pnpm workspace', async ({ run, packageManag

await run([], { installGitHubActions: false, testDir: 'tests', language: 'TypeScript', installPlaywrightDependencies: false, installPlaywrightBrowsers: false });
assertLockFilesExist(dir, packageManager);
expect(fs.existsSync(path.join(dir, 'tsconfig.json'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'tests/example.spec.ts'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'package.json'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'playwright.config.ts'))).toBeTruthy();
Expand All @@ -139,6 +143,7 @@ test('should generate in the root of yarn workspaces', async ({ run, packageMana

await run([], { installGitHubActions: false, testDir: 'tests', language: 'TypeScript', installPlaywrightDependencies: false, installPlaywrightBrowsers: false });
assertLockFilesExist(dir, packageManager);
expect(fs.existsSync(path.join(dir, 'tsconfig.json'))).toBeTruthy();
expect(fs.existsSync(path.join(dir, 'tests/example.spec.ts'))).toBeTruthy();
const writesNodeModules = packageManager === 'yarn-classic';
expect(fs.existsSync(path.join(dir, 'node_modules/playwright'))).toBe(writesNodeModules);
Expand Down
Loading