From 2a3c0e54af23bd8dcd83ca8b71438bd1198b418c Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 16 Jun 2023 08:52:30 -0600 Subject: [PATCH 1/2] Add support for `--build --verbose` invocations This is super handy for debugging when a `--build` is failing for some reason. The default reporting from `tsc` or `glint` itself isn't always helpful: it tends to bottom out with a *symptom* like "some type is not defined" without any way to get to the root cause of *why* that type is not defined. Having `--verbose` available for a `--build` invocation surfaces additional information, including which `references` are being built or not, and why. --- packages/core/__tests__/cli/build.test.ts | 177 ++++++++++++++++++++++ packages/core/src/cli/index.ts | 7 + 2 files changed, 184 insertions(+) diff --git a/packages/core/__tests__/cli/build.test.ts b/packages/core/__tests__/cli/build.test.ts index 20632a3e6..496f478ba 100644 --- a/packages/core/__tests__/cli/build.test.ts +++ b/packages/core/__tests__/cli/build.test.ts @@ -15,6 +15,8 @@ import { setupCompositeProject, } from 'glint-monorepo-test-utils'; +const TIMESTAMP = /\d{1,2}:\d{2}:\d{2} (AM|PM)/g; + describe('CLI: single-pass build mode typechecking', () => { describe('simple projects using `--build`', () => { let project!: Project; @@ -131,6 +133,89 @@ describe('CLI: single-pass build mode typechecking', () => { " `); }); + + describe('with `--verbose`', () => { + test('prints verbose output for a valid basic project', async () => { + let code = stripIndent` + import '@glint/environment-ember-template-imports'; + import Component from '@glimmer/component'; + + type ApplicationArgs = { + version: string; + }; + + export default class Application extends Component<{ Args: ApplicationArgs }> { + private startupTime = new Date().toISOString(); + + + } + `; + + project.write(INPUT_SFC, code); + + let checkResult = await project.build({ reject: false, flags: ['--verbose'] }); + + expect(checkResult.exitCode).toBe(0); + expect(checkResult.stdout.replace(TIMESTAMP, '