diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2c9ff85fc..03539f506 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1934,6 +1934,9 @@ importers: '@babel/plugin-proposal-decorators': specifier: ^7.21.0 version: 7.24.7(@babel/core@7.25.2) + '@babel/plugin-transform-typescript': + specifier: ^7.21.3 + version: 7.25.2(@babel/core@7.25.2) '@ember/optional-features': specifier: ^2.0.0 version: 2.1.0 @@ -9168,6 +9171,9 @@ packages: /ajv-formats@2.1.1: resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependenciesMeta: + ajv: + optional: true dependencies: ajv: 8.17.1 diff --git a/tests/scenarios/typescript-app-test.ts b/tests/scenarios/typescript-app-test.ts index 5f2703f52..79e33eaa1 100644 --- a/tests/scenarios/typescript-app-test.ts +++ b/tests/scenarios/typescript-app-test.ts @@ -8,6 +8,31 @@ let typescriptApp = tsAppScenarios.map('typescript-app', project => { merge(project.files, { app: { components: { + 'test-gts.gts': ` + import Component from '@glimmer/component'; + import { tracked } from '@glimmer/tracking'; + import { action } from '@ember/object'; + import { on } from '@ember/modifier'; + + interface Signature { + Element: HTMLDivElement; + Blocks: { + default: [number] + } + } + + export default class Incrementer extends Component { + @tracked count = 0; + + @action increment() { this.count++ } + + } + `, 'incrementer.ts': ` import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; @@ -36,6 +61,29 @@ let typescriptApp = tsAppScenarios.map('typescript-app', project => { }, tests: { rendering: { + 'gts-test.gts': ` + import { module, test } from 'qunit'; + import { setupRenderingTest } from 'ember-qunit'; + import { render, click } from '@ember/test-helpers'; + import TestGts from '/app/components/test-gts'; + + module('Rendering', function (hooks) { + setupRenderingTest(hooks); + + test('increments', async function (assert) { + await render(); + + assert.dom('out').hasText('0'); + + await click('button'); + assert.dom('out').hasText('1'); + }); + }); + `, 'incrementer-test.ts': ` import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; diff --git a/tests/ts-app-template/babel.config.cjs b/tests/ts-app-template/babel.config.cjs index 29a153bfc..e6248182d 100644 --- a/tests/ts-app-template/babel.config.cjs +++ b/tests/ts-app-template/babel.config.cjs @@ -2,6 +2,7 @@ const { babelCompatSupport, templateCompatSupport } = require('@embroider/compat module.exports = { plugins: [ + ['@babel/plugin-transform-typescript'], [ 'babel-plugin-ember-template-compilation', { diff --git a/tests/ts-app-template/package.json b/tests/ts-app-template/package.json index 2b35c5725..37dc2f460 100644 --- a/tests/ts-app-template/package.json +++ b/tests/ts-app-template/package.json @@ -30,6 +30,7 @@ }, "devDependencies": { "@babel/core": "^7.22.20", + "@babel/plugin-transform-typescript": "^7.21.3", "@babel/eslint-parser": "^7.21.3", "@babel/plugin-proposal-decorators": "^7.21.0", "@ember/optional-features": "^2.0.0",