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
15 changes: 10 additions & 5 deletions packages/core/__tests__/cli/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
setupCompositeProject,
} from 'glint-monorepo-test-utils';

describe.skip('CLI: single-pass build mode typechecking', () => {
describe('CLI: single-pass build mode typechecking', () => {
describe('simple projects using `--build`', () => {
let project!: Project;
beforeEach(async () => {
Expand Down Expand Up @@ -52,9 +52,12 @@ describe.skip('CLI: single-pass build mode typechecking', () => {
expect(checkResult.exitCode).toBe(0);
expect(checkResult.stdout).toEqual('');
expect(checkResult.stderr).toEqual('');

// This tests that the `--emitDeclarationOnly` flag within project.build is working.
expect(existsSync(project.filePath('dist/index.gts.js'))).toBe(false);
});

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

expect(checkResult.exitCode).toBe(1);
expect(checkResult.stdout).toEqual('');
expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(`
expect(stripAnsi(checkResult.stdout)).toMatchInlineSnapshot(`
"src/index.gts:16:36 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.

16 The current time is {{truncate this.startupTime 12}}.
~~~~~~~~~~~~~~~~


Found 1 error.
"
`);
});
});

describe('composite projects', () => {
describe.skip('composite projects', () => {
// The basic structure here is designed to give minimal coverage over all
// interesting combinations of project invalidation:
//
Expand Down
8 changes: 6 additions & 2 deletions test-packages/test-utils/src/composite-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ export const BASE_TS_CONFIG = {
allowJs: true,
checkJs: false,
declaration: true,
emitDeclarationOnly: true,

// commented out for Volar; Volar-ized `tsc` variants (e.g. `vue-tsc` as well as `glint`)
// behave more closely to `tsc`, and it is expected for `noEmit` to be explicitly
// specified in CLI args.
// noEmit: false,

incremental: true,
noEmit: false,
noEmitOnError: true,
outDir: OUT_DIR,
},
Expand Down
4 changes: 2 additions & 2 deletions test-packages/test-utils/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class Project {
// Not sure why this is needed, but in some contexts, `--pretty` is disabled
// because TS doesn't detect a TTY setup.
// https://github.com/microsoft/TypeScript/blob/c38569655bb151ec351c27032fbd3ef43b8856ba/src/compiler/executeCommandLine.ts#L160
options.flags = [...options.flags, '--pretty'];
options.flags = [...options.flags, '--noEmit', '--pretty'];

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

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