diff --git a/packages/core/__tests__/cli/build-watch.test.ts b/packages/core/__tests__/cli/build-watch.test.ts index ef16c472d..95bd12325 100644 --- a/packages/core/__tests__/cli/build-watch.test.ts +++ b/packages/core/__tests__/cli/build-watch.test.ts @@ -4,7 +4,7 @@ import { stripIndent } from 'common-tags'; import stripAnsi = require('strip-ansi'); import { afterEach, beforeEach, describe, expect, test } from 'vitest'; -import { Project, BASE_TS_CONFIG, INPUT_SCRIPT, setupCompositeProject } from '@glint/test-utils'; +import { Project, BASE_TS_CONFIG, INPUT_SFC, setupCompositeProject } from '@glint/test-utils'; const BUILD_WATCH_TSCONFIG = { ...BASE_TS_CONFIG, @@ -56,7 +56,6 @@ describe('CLI: watched build mode typechecking', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -65,14 +64,14 @@ describe('CLI: watched build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); let watch = project.buildWatch({ reject: true }); let output = await watch.awaitOutput('Watching for file changes.'); @@ -85,7 +84,6 @@ describe('CLI: watched build mode typechecking', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -94,15 +92,15 @@ describe('CLI: watched build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); let watch = project.buildWatch({ reject: false }); let output = await watch.awaitOutput('Watching for file changes.'); @@ -111,7 +109,7 @@ describe('CLI: watched build mode typechecking', () => { let stripped = stripAnsi(output); let error = stripped.slice( - stripped.indexOf('index.ts'), + stripped.indexOf('index.gts'), stripped.lastIndexOf(`~~~${os.EOL}`) + 3 ); @@ -123,7 +121,6 @@ describe('CLI: watched build mode typechecking', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -135,14 +132,14 @@ describe('CLI: watched build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); let watch = project.buildWatch(); let output = await watch.awaitOutput('Watching for file changes.'); @@ -151,15 +148,15 @@ describe('CLI: watched build mode typechecking', () => { let stripped = stripAnsi(output); let error = stripped.slice( - stripped.indexOf('index.ts'), + stripped.indexOf('index.gts'), stripped.lastIndexOf(`~~~${os.EOL}`) + 3 ); expect(output).toMatch('Found 1 error.'); expect(error.replace(/\r/g, '')).toMatchInlineSnapshot(` - "index.ts:17:36 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "index.gts:16:36 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 17 The current time is {{truncate this.startupTime 12}}. + 16 The current time is {{truncate this.startupTime 12}}. ~~~~~~~~~~~~~~~~" `); }); @@ -168,7 +165,6 @@ describe('CLI: watched build mode typechecking', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -177,14 +173,14 @@ describe('CLI: watched build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); let watch = project.buildWatch({ reject: true }); @@ -193,14 +189,14 @@ describe('CLI: watched build mode typechecking', () => { await pauseForTSBuffering(); - project.write(INPUT_SCRIPT, code.replace('this.startupTime', 'this.startupTimee')); + project.write(INPUT_SFC, code.replace('this.startupTime', 'this.startupTimee')); output = await watch.awaitOutput('Watching for file changes.'); expect(output).toMatch('Found 1 error.'); await pauseForTSBuffering(); - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); output = await watch.awaitOutput('Watching for file changes.'); expect(output).toMatch('Found 0 errors.'); @@ -236,7 +232,6 @@ describe('CLI: watched build mode typechecking', () => { let mainCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -247,45 +242,42 @@ describe('CLI: watched build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; let aCode = stripIndent` - import { hbs } from 'ember-template-imports'; import C from '@glint-test/c'; - const A = hbs\`Hello! \`; + const A = ; export default A; `; let bCode = stripIndent` - import { hbs } from 'ember-template-imports'; - const B = hbs\`Ahoy!\`; + const B = ; export default B; `; let cCode = stripIndent` - import { hbs } from 'ember-template-imports'; const add = (a: number, b: number) => a + b; - const C = hbs\`{{add 123 456}}\`; + const C = ; export default C; `; beforeEach(async () => { projects = await setupCompositeProject(); - projects.main.write(INPUT_SCRIPT, mainCode); - projects.children.a.write(INPUT_SCRIPT, aCode); - projects.children.b.write(INPUT_SCRIPT, bCode); - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.main.write(INPUT_SFC, mainCode); + projects.children.a.write(INPUT_SFC, aCode); + projects.children.b.write(INPUT_SFC, bCode); + projects.children.c.write(INPUT_SFC, cCode); }); afterEach(async () => { @@ -315,29 +307,29 @@ describe('CLI: watched build mode typechecking', () => { await pauseForTSBuffering(); projects.main.write( - INPUT_SCRIPT, + INPUT_SFC, mainCode.replace('{{this.startupTime}}', '{{this.startupTime}') ); output = await watch.awaitOutput('Parse error'); let stripped = stripAnsi(output); let error = stripped.slice( - stripped.indexOf('index.ts'), + stripped.indexOf('index.gts'), stripped.lastIndexOf(`~~~${os.EOL}`) + 3 ); expect(error).toMatchInlineSnapshot(` - "index.ts:15:32 - error TS0: Parse error on line 3: + "index.gts:14:32 - error TS0: Parse error on line 3: ...s {{this.startupTime}. -----------------------^ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', got 'INVALID' - 15 The current time is {{this.startupTime}. + 14 The current time is {{this.startupTime}. ~~~~~~~~~~~" `); await pauseForTSBuffering(); - projects.main.write(INPUT_SCRIPT, mainCode); + projects.main.write(INPUT_SFC, mainCode); output = await watch.awaitOutput('Watching for file changes.'); expect(output).toMatch('Found 0 errors.'); @@ -353,16 +345,16 @@ describe('CLI: watched build mode typechecking', () => { await pauseForTSBuffering(); - projects.children.a.write(INPUT_SCRIPT, aCode.replace('', '')); + projects.children.a.write(INPUT_SFC, aCode.replace('', '')); output = await watch.awaitOutput('Watching for file changes.'); let stripped = stripAnsi(output); let error = stripped.slice( - stripped.indexOf('index.ts'), + stripped.indexOf('index.gts'), stripped.lastIndexOf(`;${os.EOL}`) + 1 ); expect(error).toMatchInlineSnapshot(` - "index.ts:4:22 - error TS0: Unclosed element \`C\`: + "index.gts:3:28 - error TS0: Unclosed element \`C\`: | | @@ -370,12 +362,12 @@ describe('CLI: watched build mode typechecking', () => { (error occurred in 'an unknown module' @ line 1 : column 7) - 4 const A = hbs\`Hello! \`;" + 3 const A = ;" `); await pauseForTSBuffering(); - projects.children.a.write(INPUT_SCRIPT, aCode); + projects.children.a.write(INPUT_SFC, aCode); output = await watch.awaitOutput('Watching for file changes.'); expect(output).toMatch('Found 0 errors.'); @@ -391,27 +383,27 @@ describe('CLI: watched build mode typechecking', () => { await pauseForTSBuffering(); - projects.children.c.write(INPUT_SCRIPT, cCode.replace('456}}', '456}')); + projects.children.c.write(INPUT_SFC, cCode.replace('456}}', '456}')); output = await watch.awaitOutput('Parse error'); let stripped = stripAnsi(output); let error = stripped.slice( - stripped.indexOf('index.ts'), + stripped.indexOf('index.gts'), stripped.lastIndexOf(`~~~${os.EOL}`) + 3 ); expect(error).toMatchInlineSnapshot(` - "index.ts:5:25 - error TS0: Parse error on line 1: + "index.gts:3:31 - error TS0: Parse error on line 1: {{add 123 456} -------------^ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'INVALID' - 5 const C = hbs\`{{add 123 456}\`; - ~~~" + 3 const C = ; + ~~~" `); await pauseForTSBuffering(); - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.children.c.write(INPUT_SFC, cCode); output = await watch.awaitOutput('Watching for file changes.'); expect(output).toMatch('Found 0 errors.'); @@ -429,24 +421,24 @@ describe('CLI: watched build mode typechecking', () => { await pauseForTSBuffering(); - projects.main.write(INPUT_SCRIPT, mainCode.replace('', '')); + projects.main.write(INPUT_SFC, mainCode.replace('', '')); output = await watch.awaitOutput('Watching for file changes.'); let stripped = stripAnsi(output); let error = stripped.slice( - stripped.indexOf('index.ts'), + stripped.indexOf('index.gts'), stripped.lastIndexOf(`~~~${os.EOL}`) + 3 ); expect(error).toMatchInlineSnapshot(` - "index.ts:16:5 - error TS2554: Expected 0 arguments, but got 1. + "index.gts:15:5 - error TS2554: Expected 0 arguments, but got 1. - 16 + 15 ~~~~~~~~~~~~~~~~" `); await pauseForTSBuffering(); - projects.main.write(INPUT_SCRIPT, mainCode); + projects.main.write(INPUT_SFC, mainCode); output = await watch.awaitOutput('Watching for file changes.'); expect(output).toMatch('Found 0 errors.'); @@ -462,24 +454,24 @@ describe('CLI: watched build mode typechecking', () => { await pauseForTSBuffering(); - projects.children.a.write(INPUT_SCRIPT, aCode.replace('', '')); + projects.children.a.write(INPUT_SFC, aCode.replace('', '')); output = await watch.awaitOutput('Watching for file changes.'); let stripped = stripAnsi(output); let error = stripped.slice( - stripped.indexOf('index.ts'), + stripped.indexOf('index.gts'), stripped.lastIndexOf(`~~~${os.EOL}`) + 3 ); expect(error).toMatchInlineSnapshot(` - "index.ts:4:22 - error TS2554: Expected 0 arguments, but got 1. + "index.gts:3:28 - error TS2554: Expected 0 arguments, but got 1. - 4 const A = hbs\`Hello! \`; - ~~~~~~~~~~~~~~~~" + 3 const A = ; + ~~~~~~~~~~~~~~~~" `); await pauseForTSBuffering(); - projects.children.a.write(INPUT_SCRIPT, aCode); + projects.children.a.write(INPUT_SFC, aCode); output = await watch.awaitOutput('Watching for file changes.'); expect(output).toMatch('Found 0 errors.'); @@ -495,24 +487,24 @@ describe('CLI: watched build mode typechecking', () => { await pauseForTSBuffering(); - projects.children.c.write(INPUT_SCRIPT, cCode.replace('123', '"hello"')); + projects.children.c.write(INPUT_SFC, cCode.replace('123', '"hello"')); output = await watch.awaitOutput('Watching for file changes.'); let stripped = stripAnsi(output); let error = stripped.slice( - stripped.indexOf('index.ts'), + stripped.indexOf('index.gts'), stripped.lastIndexOf(`~~~${os.EOL}`) + 3 ); expect(error).toMatchInlineSnapshot(` - "index.ts:5:21 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "index.gts:3:27 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 5 const C = hbs\`{{add \\"hello\\" 456}}\`; - ~~~~~~~" + 3 const C = ; + ~~~~~~~" `); await pauseForTSBuffering(); - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.children.c.write(INPUT_SFC, cCode); output = await watch.awaitOutput('Watching for file changes.'); expect(output).toMatch('Found 0 errors.'); diff --git a/packages/core/__tests__/cli/build.test.ts b/packages/core/__tests__/cli/build.test.ts index 6d8c7bceb..f72b44ccd 100644 --- a/packages/core/__tests__/cli/build.test.ts +++ b/packages/core/__tests__/cli/build.test.ts @@ -10,6 +10,7 @@ import { CompositeProject, INDEX_D_TS, INPUT_SCRIPT, + INPUT_SFC, INPUT_TEMPLATE, setupCompositeProject, } from '@glint/test-utils'; @@ -29,7 +30,6 @@ describe('CLI: single-pass build mode typechecking', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -38,14 +38,14 @@ describe('CLI: single-pass build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); let checkResult = await project.build({ reject: false }); @@ -58,7 +58,6 @@ describe('CLI: single-pass build mode typechecking', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -67,22 +66,22 @@ describe('CLI: single-pass build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); let checkResult = await project.build({ reject: false }); expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:15:5 - error TS0: Unclosed element \`p\`: + "src/index.gts:14:5 - error TS0: Unclosed element \`p\`: | |

@@ -90,7 +89,7 @@ describe('CLI: single-pass build mode typechecking', () => { (error occurred in 'an unknown module' @ line 4 : column 4) - 15

Unclosed tag. + 14

Unclosed tag. " `); @@ -100,7 +99,6 @@ describe('CLI: single-pass build mode typechecking', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -112,23 +110,23 @@ describe('CLI: single-pass build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); let checkResult = await project.build({ reject: false }); expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:17:36 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "src/index.gts:16:36 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 17 The current time is {{truncate this.startupTime 12}}. + 16 The current time is {{truncate this.startupTime 12}}. ~~~~~~~~~~~~~~~~ " `); @@ -175,7 +173,6 @@ describe('CLI: single-pass build mode typechecking', () => { beforeEach(async () => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -186,10 +183,10 @@ describe('CLI: single-pass build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; @@ -209,10 +206,10 @@ describe('CLI: single-pass build mode typechecking', () => { export default C; `; - projects.main.write(INPUT_SCRIPT, rootCode); - projects.children.a.write(INPUT_SCRIPT, aCode); - projects.children.b.write(INPUT_SCRIPT, bCode); - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.main.write(INPUT_SFC, rootCode); + projects.children.a.write(INPUT_SFC, aCode); + projects.children.b.write(INPUT_SFC, bCode); + projects.children.c.write(INPUT_SFC, cCode); }); test('passes a valid composite project', async () => { @@ -271,15 +268,14 @@ describe('CLI: single-pass build mode typechecking', () => { export default C; `; - projects.children.a.write(INPUT_SCRIPT, aCode); - projects.children.b.write(INPUT_SCRIPT, bCode); - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.children.a.write(INPUT_SFC, aCode); + projects.children.b.write(INPUT_SFC, bCode); + projects.children.c.write(INPUT_SFC, cCode); }); test('for invalid TS', async () => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -292,23 +288,23 @@ describe('CLI: single-pass build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - projects.main.write(INPUT_SCRIPT, rootCode); + projects.main.write(INPUT_SFC, rootCode); let checkResult = await projects.main.build({ reject: false }); expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:6:5 - error TS2322: Type 'number' is not assignable to type 'string'. + "src/index.gts:5:5 - error TS2322: Type 'number' is not assignable to type 'string'. - 6 let x: string = 123; + 5 let x: string = 123; ~ " `); @@ -321,7 +317,6 @@ describe('CLI: single-pass build mode typechecking', () => { test('for invalid template syntax', async () => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -332,21 +327,21 @@ describe('CLI: single-pass build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - projects.main.write(INPUT_SCRIPT, rootCode); + projects.main.write(INPUT_SFC, rootCode); let checkResult = await projects.main.build({ reject: false }); expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:16:5 - error TS0: Unclosed element \`p\`: + "src/index.gts:15:5 - error TS0: Unclosed element \`p\`: | |

@@ -354,7 +349,7 @@ describe('CLI: single-pass build mode typechecking', () => { (error occurred in 'an unknown module' @ line 4 : column 4) - 16

Unclosed! + 15

Unclosed! " `); @@ -368,7 +363,6 @@ describe('CLI: single-pass build mode typechecking', () => { test('for a template type error', async () => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -381,23 +375,23 @@ describe('CLI: single-pass build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - projects.main.write(INPUT_SCRIPT, rootCode); + projects.main.write(INPUT_SFC, rootCode); let checkResult = await projects.main.build({ reject: false }); expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:18:14 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "src/index.gts:17:14 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 18 {{double A}} + 17 {{double A}} ~ " `); @@ -413,7 +407,6 @@ describe('CLI: single-pass build mode typechecking', () => { beforeEach(async () => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -424,10 +417,10 @@ describe('CLI: single-pass build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; @@ -441,9 +434,9 @@ describe('CLI: single-pass build mode typechecking', () => { export default C; `; - projects.main.write(INPUT_SCRIPT, rootCode); - projects.children.b.write(INPUT_SCRIPT, bCode); - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.main.write(INPUT_SFC, rootCode); + projects.children.b.write(INPUT_SFC, bCode); + projects.children.c.write(INPUT_SFC, cCode); }); describe('for invalid TS', () => { @@ -454,7 +447,7 @@ describe('CLI: single-pass build mode typechecking', () => { export default A; `; - projects.children.a.write(INPUT_SCRIPT, aCode); + projects.children.a.write(INPUT_SFC, aCode); }); test('build from the main project', async () => { @@ -463,7 +456,7 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../a/src/index.ts:2:15 - error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. + "../a/src/index.gts:2:15 - error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. 2 const A = 2 * C; ~ @@ -481,7 +474,7 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:2:15 - error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. + "src/index.gts:2:15 - error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. 2 const A = 2 * C; ~ @@ -498,13 +491,12 @@ describe('CLI: single-pass build mode typechecking', () => { beforeEach(async () => { let aCode = stripIndent` import C from '@glint-test/c'; - import { hbs } from 'ember-template-imports'; - const A = hbs\`{{C}\`; + const A = ; export default A; `; - projects.children.a.write(INPUT_SCRIPT, aCode); + projects.children.a.write(INPUT_SFC, aCode); }); test('build from the main project', async () => { @@ -513,13 +505,13 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../a/src/index.ts:4:17 - error TS0: Parse error on line 1: + "../a/src/index.gts:3:23 - error TS0: Parse error on line 1: {{C} ---^ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', got 'INVALID' - 4 const A = hbs\`{{C}\`; - ~ + 3 const A = ; + ~ " `); @@ -534,13 +526,13 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:4:17 - error TS0: Parse error on line 1: + "src/index.gts:3:23 - error TS0: Parse error on line 1: {{C} ---^ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', got 'INVALID' - 4 const A = hbs\`{{C}\`; - ~ + 3 const A = ; + ~ " `); @@ -554,14 +546,13 @@ describe('CLI: single-pass build mode typechecking', () => { beforeEach(async () => { let aCode = stripIndent` import C from '@glint-test/c'; - import { hbs } from 'ember-template-imports'; const double = (n: number): number => n * 2; - const A = hbs\`{{double C}}\`; + const A = ; export default A; `; - projects.children.a.write(INPUT_SCRIPT, aCode); + projects.children.a.write(INPUT_SFC, aCode); }); test('build from the main project', async () => { @@ -570,10 +561,10 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../a/src/index.ts:5:24 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "../a/src/index.gts:4:30 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 5 const A = hbs\`{{double C}}\`; - ~ + 4 const A = ; + ~ " `); @@ -588,10 +579,10 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:5:24 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "src/index.gts:4:30 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 5 const A = hbs\`{{double C}}\`; - ~ + 4 const A = ; + ~ " `); @@ -606,7 +597,6 @@ describe('CLI: single-pass build mode typechecking', () => { beforeEach(async () => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -617,10 +607,10 @@ describe('CLI: single-pass build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; @@ -635,9 +625,9 @@ describe('CLI: single-pass build mode typechecking', () => { export default C; `; - projects.main.write(INPUT_SCRIPT, rootCode); - projects.children.a.write(INPUT_SCRIPT, aCode); - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.main.write(INPUT_SFC, rootCode); + projects.children.a.write(INPUT_SFC, aCode); + projects.children.c.write(INPUT_SFC, cCode); }); describe('for invalid TS', () => { @@ -647,7 +637,7 @@ describe('CLI: single-pass build mode typechecking', () => { export default B; `; - projects.children.b.write(INPUT_SCRIPT, bCode); + projects.children.b.write(INPUT_SFC, bCode); }); test('build from the main project', async () => { @@ -656,7 +646,7 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../b/src/index.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + "../b/src/index.gts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. 1 const B: number = 'ahoy'; ~ @@ -674,7 +664,7 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + "src/index.gts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. 1 const B: number = 'ahoy'; ~ @@ -690,13 +680,12 @@ describe('CLI: single-pass build mode typechecking', () => { describe('for invalid template syntax', () => { beforeEach(async () => { let bCode = stripIndent` - import { hbs } from 'ember-template-imports'; - const usage = hbs\`{{123}\`; + const usage = ; const B = 'ahoy'; export default B; `; - projects.children.b.write(INPUT_SCRIPT, bCode); + projects.children.b.write(INPUT_SFC, bCode); }); test('build from the main project', async () => { @@ -705,13 +694,13 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../b/src/index.ts:2:21 - error TS0: Parse error on line 1: + "../b/src/index.gts:1:27 - error TS0: Parse error on line 1: {{123} -----^ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'INVALID' - 2 const usage = hbs\`{{123}\`; - ~~~ + 1 const usage = ; + ~~~ " `); @@ -726,13 +715,13 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:2:21 - error TS0: Parse error on line 1: + "src/index.gts:1:27 - error TS0: Parse error on line 1: {{123} -----^ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'INVALID' - 2 const usage = hbs\`{{123}\`; - ~~~ + 1 const usage = ; + ~~~ " `); @@ -745,14 +734,13 @@ describe('CLI: single-pass build mode typechecking', () => { describe('for a template type error', () => { beforeEach(async () => { let bCode = stripIndent` - import { hbs } from 'ember-template-imports'; const double = (n: number) => n * 2; - const Usage = hbs\`{{double "hello"}}\`; + const Usage = ; const B = 'ahoy'; export default B; `; - projects.children.b.write(INPUT_SCRIPT, bCode); + projects.children.b.write(INPUT_SFC, bCode); }); test('build from the main project', async () => { @@ -761,10 +749,10 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../b/src/index.ts:3:28 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "../b/src/index.gts:2:34 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 3 const Usage = hbs\`{{double \\"hello\\"}}\`; - ~~~~~~~ + 2 const Usage = ; + ~~~~~~~ " `); @@ -779,10 +767,10 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:3:28 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "src/index.gts:2:34 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 3 const Usage = hbs\`{{double \\"hello\\"}}\`; - ~~~~~~~ + 2 const Usage = ; + ~~~~~~~ " `); @@ -797,7 +785,6 @@ describe('CLI: single-pass build mode typechecking', () => { beforeEach(() => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -808,10 +795,10 @@ describe('CLI: single-pass build mode typechecking', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; @@ -826,9 +813,9 @@ describe('CLI: single-pass build mode typechecking', () => { export default B; `; - projects.main.write(INPUT_SCRIPT, rootCode); - projects.children.a.write(INPUT_SCRIPT, aCode); - projects.children.b.write(INPUT_SCRIPT, bCode); + projects.main.write(INPUT_SFC, rootCode); + projects.children.a.write(INPUT_SFC, aCode); + projects.children.b.write(INPUT_SFC, bCode); }); describe('for invalid TS', () => { @@ -837,7 +824,7 @@ describe('CLI: single-pass build mode typechecking', () => { const C: number = 'world'; export default C; `; - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.children.c.write(INPUT_SFC, cCode); }); test('built from the main project', async () => { @@ -846,7 +833,7 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../c/src/index.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + "../c/src/index.gts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. 1 const C: number = 'world'; ~ @@ -864,7 +851,7 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../c/src/index.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + "../c/src/index.gts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. 1 const C: number = 'world'; ~ @@ -882,7 +869,7 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. + "src/index.gts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. 1 const C: number = 'world'; ~ @@ -898,13 +885,12 @@ describe('CLI: single-pass build mode typechecking', () => { describe('for invalid template syntax', () => { beforeEach(() => { let cCode = stripIndent` - import { hbs } from 'ember-template-imports'; - const Bad = hbs\`{{123}\`; + const Bad = ; const C = 'world'; export default C; `; - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.children.c.write(INPUT_SFC, cCode); }); test('built from the main project', async () => { @@ -913,13 +899,13 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../c/src/index.ts:2:19 - error TS0: Parse error on line 1: + "../c/src/index.gts:1:25 - error TS0: Parse error on line 1: {{123} -----^ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'INVALID' - 2 const Bad = hbs\`{{123}\`; - ~~~ + 1 const Bad = ; + ~~~ " `); @@ -934,13 +920,13 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../c/src/index.ts:2:19 - error TS0: Parse error on line 1: + "../c/src/index.gts:1:25 - error TS0: Parse error on line 1: {{123} -----^ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'INVALID' - 2 const Bad = hbs\`{{123}\`; - ~~~ + 1 const Bad = ; + ~~~ " `); @@ -955,13 +941,13 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:2:19 - error TS0: Parse error on line 1: + "src/index.gts:1:25 - error TS0: Parse error on line 1: {{123} -----^ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'INVALID' - 2 const Bad = hbs\`{{123}\`; - ~~~ + 1 const Bad = ; + ~~~ " `); @@ -974,14 +960,13 @@ describe('CLI: single-pass build mode typechecking', () => { describe('for a template type error', () => { beforeEach(() => { let cCode = stripIndent` - import { hbs } from 'ember-template-imports'; const double = (n: number) => n * 2; - const useDouble = hbs\`{{double "hello"}}\`; + const useDouble = ; const C = 'world'; export default C; `; - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.children.c.write(INPUT_SFC, cCode); }); test('built from the main project', async () => { @@ -990,10 +975,10 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(2); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../c/src/index.ts:3:32 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "../c/src/index.gts:2:38 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 3 const useDouble = hbs\`{{double \\"hello\\"}}\`; - ~~~~~~~ + 2 const useDouble = ; + ~~~~~~~ " `); @@ -1008,10 +993,10 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "../c/src/index.ts:3:32 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "../c/src/index.gts:2:38 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 3 const useDouble = hbs\`{{double \\"hello\\"}}\`; - ~~~~~~~ + 2 const useDouble = ; + ~~~~~~~ " `); @@ -1026,10 +1011,10 @@ describe('CLI: single-pass build mode typechecking', () => { expect(checkResult.exitCode).toBe(1); expect(checkResult.stdout).toEqual(''); expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(` - "src/index.ts:3:32 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + "src/index.gts:2:38 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - 3 const useDouble = hbs\`{{double \\"hello\\"}}\`; - ~~~~~~~ + 2 const useDouble = ; + ~~~~~~~ " `); @@ -1068,7 +1053,6 @@ describe('CLI: --build --clean', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -1077,14 +1061,14 @@ describe('CLI: --build --clean', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); let buildResult = await project.build(); expect(buildResult.exitCode).toBe(0); @@ -1100,7 +1084,6 @@ describe('CLI: --build --clean', () => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -1111,10 +1094,10 @@ describe('CLI: --build --clean', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; @@ -1134,10 +1117,10 @@ describe('CLI: --build --clean', () => { export default C; `; - projects.main.write(INPUT_SCRIPT, rootCode); - projects.children.a.write(INPUT_SCRIPT, aCode); - projects.children.b.write(INPUT_SCRIPT, bCode); - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.main.write(INPUT_SFC, rootCode); + projects.children.a.write(INPUT_SFC, aCode); + projects.children.b.write(INPUT_SFC, bCode); + projects.children.c.write(INPUT_SFC, cCode); let buildResult = await projects.main.build(); expect(buildResult.exitCode).toBe(0); @@ -1164,7 +1147,6 @@ describe('CLI: --build --force', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -1173,14 +1155,14 @@ describe('CLI: --build --force', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); let buildResult = await project.build(); expect(buildResult.exitCode).toBe(0); @@ -1202,7 +1184,6 @@ describe('CLI: --build --force', () => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -1213,10 +1194,10 @@ describe('CLI: --build --force', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; @@ -1236,10 +1217,10 @@ describe('CLI: --build --force', () => { export default C; `; - projects.main.write(INPUT_SCRIPT, rootCode); - projects.children.a.write(INPUT_SCRIPT, aCode); - projects.children.b.write(INPUT_SCRIPT, bCode); - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.main.write(INPUT_SFC, rootCode); + projects.children.a.write(INPUT_SFC, aCode); + projects.children.b.write(INPUT_SFC, bCode); + projects.children.c.write(INPUT_SFC, cCode); let buildResult = await projects.main.build(); expect(buildResult.exitCode).toBe(0); @@ -1280,7 +1261,6 @@ describe('CLI: --build --dry', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -1289,14 +1269,14 @@ describe('CLI: --build --dry', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); }); test('when no build has occurred', async () => { @@ -1326,7 +1306,6 @@ describe('CLI: --build --dry', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { appVersion: string; @@ -1335,14 +1314,14 @@ describe('CLI: --build --dry', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - project.write(INPUT_SCRIPT, code); + project.write(INPUT_SFC, code); let buildResult = await project.build({ flags: ['--dry'] }); expect(buildResult.exitCode).toBe(0); @@ -1365,7 +1344,6 @@ describe('CLI: --build --dry', () => { let backingClass = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -1412,7 +1390,6 @@ describe('CLI: --build --dry', () => { let backingClass = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -1439,7 +1416,7 @@ describe('CLI: --build --dry', () => { The current time is {{this.startupTime}}. `; - project.write(INPUT_SCRIPT, template); + project.write(INPUT_TEMPLATE, template); let buildResult = await project.build({ flags: ['--dry'] }); expect(buildResult.exitCode).toBe(0); @@ -1458,7 +1435,6 @@ describe('CLI: --build --dry', () => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -1469,10 +1445,10 @@ describe('CLI: --build --dry', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; @@ -1492,10 +1468,10 @@ describe('CLI: --build --dry', () => { export default C; `; - projects.main.write(INPUT_SCRIPT, rootCode); - projects.children.a.write(INPUT_SCRIPT, aCode); - projects.children.b.write(INPUT_SCRIPT, bCode); - projects.children.c.write(INPUT_SCRIPT, cCode); + projects.main.write(INPUT_SFC, rootCode); + projects.children.a.write(INPUT_SFC, aCode); + projects.children.b.write(INPUT_SFC, bCode); + projects.children.c.write(INPUT_SFC, cCode); }); test('when no build has occurred', async () => { @@ -1543,7 +1519,6 @@ describe('CLI: --build --dry', () => { test('in a project which has changed with direct references which have not changed', async () => { let rootCode = stripIndent` import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; import A from '@glint-test/a'; import B from '@glint-test/b'; @@ -1554,13 +1529,13 @@ describe('CLI: --build --dry', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; - projects.main.write(INPUT_SCRIPT, rootCode); + projects.main.write(INPUT_SFC, rootCode); let buildResult = await projects.root.build({ flags: ['--dry'] }); expect(buildResult.exitCode).toBe(0); @@ -1585,7 +1560,7 @@ describe('CLI: --build --dry', () => { const A = 'hello there, ' + C; export default A; `; - projects.children.a.write(INPUT_SCRIPT, aCode); + projects.children.a.write(INPUT_SFC, aCode); let buildResult = await projects.root.build({ flags: ['--dry'] }); expect(buildResult.exitCode).toBe(0); diff --git a/packages/core/__tests__/cli/incremental.test.ts b/packages/core/__tests__/cli/incremental.test.ts index e6e09f609..209dc2f39 100644 --- a/packages/core/__tests__/cli/incremental.test.ts +++ b/packages/core/__tests__/cli/incremental.test.ts @@ -6,16 +6,15 @@ import { beforeEach, describe, expect, test } from 'vitest'; import { Project } from '@glint/test-utils'; const BUILD_INFO = 'tsconfig.tsbuildinfo'; -const INPUT_SCRIPT = 'index.ts'; +const INPUT_SCRIPT = 'index.gts'; describe('CLI: --incremental', () => { test('when no build has occurred', async () => { - let project = await Project.create(); + let project = await Project.create({ glint: { environment: 'ember-template-imports' } }); let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -24,10 +23,10 @@ describe('CLI: --incremental', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; @@ -49,12 +48,11 @@ describe('CLI: --incremental', () => { describe('when a build has occurred', () => { let project!: Project; beforeEach(async () => { - project = await Project.create(); + project = await Project.create({ glint: { environment: 'ember-template-imports' } }); let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -63,10 +61,10 @@ describe('CLI: --incremental', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; @@ -96,7 +94,6 @@ describe('CLI: --incremental', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { appVersion: string; @@ -105,10 +102,10 @@ describe('CLI: --incremental', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` + } `; @@ -135,7 +132,6 @@ describe('CLI: --incremental', () => { let code = stripIndent` import '@glint/environment-ember-template-imports'; import Component from '@glimmer/component'; - import { hbs } from 'ember-template-imports'; type ApplicationArgs = { version: string; @@ -144,10 +140,10 @@ describe('CLI: --incremental', () => { export default class Application extends Component<{ Args: ApplicationArgs }> { private startupTime = new Date().toISOString(); - public static template = hbs\` +