Skip to content

Commit 6cdb1f7

Browse files
committed
Fix baseline CLI build tests
1 parent e2be29b commit 6cdb1f7

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

packages/core/__tests__/cli/build.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
setupCompositeProject,
1616
} from 'glint-monorepo-test-utils';
1717

18-
describe.skip('CLI: single-pass build mode typechecking', () => {
18+
describe('CLI: single-pass build mode typechecking', () => {
1919
describe('simple projects using `--build`', () => {
2020
let project!: Project;
2121
beforeEach(async () => {
@@ -52,9 +52,12 @@ describe.skip('CLI: single-pass build mode typechecking', () => {
5252
expect(checkResult.exitCode).toBe(0);
5353
expect(checkResult.stdout).toEqual('');
5454
expect(checkResult.stderr).toEqual('');
55+
56+
// This tests that the `--emitDeclarationOnly` flag within project.build is working.
57+
expect(existsSync(project.filePath('dist/index.gts.js'))).toBe(false);
5558
});
5659

57-
test('rejects a basic project with a template syntax error', async () => {
60+
test.skip('rejects a basic project with a template syntax error', async () => {
5861
let code = stripIndent`
5962
import '@glint/environment-ember-template-imports';
6063
import Component from '@glimmer/component';
@@ -122,18 +125,20 @@ describe.skip('CLI: single-pass build mode typechecking', () => {
122125
let checkResult = await project.build({ reject: false });
123126

124127
expect(checkResult.exitCode).toBe(1);
125-
expect(checkResult.stdout).toEqual('');
126-
expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(`
128+
expect(stripAnsi(checkResult.stdout)).toMatchInlineSnapshot(`
127129
"src/index.gts:16:36 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
128130
129131
16 The current time is {{truncate this.startupTime 12}}.
130132
~~~~~~~~~~~~~~~~
133+
134+
135+
Found 1 error.
131136
"
132137
`);
133138
});
134139
});
135140

136-
describe('composite projects', () => {
141+
describe.skip('composite projects', () => {
137142
// The basic structure here is designed to give minimal coverage over all
138143
// interesting combinations of project invalidation:
139144
//

test-packages/test-utils/src/composite-project.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ export const BASE_TS_CONFIG = {
2121
allowJs: true,
2222
checkJs: false,
2323
declaration: true,
24-
emitDeclarationOnly: true,
24+
25+
// commented out for Volar; Volar-ized `tsc` variants (e.g. `vue-tsc` as well as `glint`)
26+
// behave more closely to `tsc`, and it is expected for `noEmit` to be explicitly
27+
// specified in CLI args.
28+
// noEmit: false,
29+
2530
incremental: true,
26-
noEmit: false,
2731
noEmitOnError: true,
2832
outDir: OUT_DIR,
2933
},

test-packages/test-utils/src/project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export class Project {
298298
// Not sure why this is needed, but in some contexts, `--pretty` is disabled
299299
// because TS doesn't detect a TTY setup.
300300
// https://github.com/microsoft/TypeScript/blob/c38569655bb151ec351c27032fbd3ef43b8856ba/src/compiler/executeCommandLine.ts#L160
301-
options.flags = [...options.flags, '--pretty'];
301+
options.flags = [...options.flags, '--noEmit', '--pretty'];
302302

303303
return execaNode(require.resolve('@glint/core/bin/glint'), options.flags, {
304304
cwd: this.rootDir,
@@ -312,7 +312,7 @@ export class Project {
312312
}
313313

314314
public build(options: Options & { flags?: string[] } = {}, debug = false): ExecaChildProcess {
315-
let flags = ['--build', '--pretty', ...(options.flags ?? [])];
315+
let flags = ['--build', '--emitDeclarationOnly', '--pretty', ...(options.flags ?? [])];
316316
return execaNode(require.resolve('@glint/core/bin/glint'), flags, {
317317
cwd: this.rootDir,
318318
nodeOptions: debug ? ['--inspect-brk'] : [],

0 commit comments

Comments
 (0)