Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get a few composite tests passing #742

Merged
merged 4 commits into from
Jul 3, 2024
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
13 changes: 13 additions & 0 deletions V2_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changes since v2 (Volar-ized Glint)

## `glint` CLI binary

- BREAKING CHANGE: closer unification with vanilla `tsc`
- `glint` is now a much more thin wrapper around `tsc` and requires a number of changes to the arguments passed to it to accomplish typical tasks
- When in doubt, think in terms of what args `tsc` would need in order to accomplish a similar task, and pass those same args to `glint`
- to type-check your code
- before: `glint`
- after: `glint --noEmit`
- to build `.d.ts` declaration files for your .gts/.ts files
- before: `glint --build`
- after: `glint --declaration --emitDeclarationOnly`
98 changes: 49 additions & 49 deletions packages/core/__tests__/cli/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});
});

describe.skip('composite projects', () => {
describe('composite projects', () => {
// The basic structure here is designed to give minimal coverage over all
// interesting combinations of project invalidation:
//
Expand Down Expand Up @@ -218,43 +218,43 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('passes a valid composite project', async () => {
let checkResult = await projects.main.build({ reject: false });
let result = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(0);
expect(checkResult.stdout).toEqual('');
// expect(checkResult.stderr).toEqual('');
expect(result.exitCode).toBe(0);
expect(result.stdout).toEqual('');
expect(result.stderr).toEqual('');

expect(existsSync(projects.children.a.filePath(INDEX_D_TS))).toBe(true);
expect(existsSync(projects.children.b.filePath(INDEX_D_TS))).toBe(true);
expect(existsSync(projects.children.c.filePath(INDEX_D_TS))).toBe(true);
});

test('passes a valid composite subproject with a reference', async () => {
let checkResult = await projects.children.a.build({ reject: false });
let result = await projects.children.a.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(0);
expect(checkResult.stdout).toEqual('');
expect(checkResult.stderr).toEqual('');
expect(result.exitCode).toBe(0);
expect(result.stdout).toEqual('');
expect(result.stderr).toEqual('');

expect(existsSync(projects.children.a.filePath(INDEX_D_TS))).toBe(true);
expect(existsSync(projects.children.b.filePath(INDEX_D_TS))).toBe(false);
expect(existsSync(projects.children.c.filePath(INDEX_D_TS))).toBe(true);
});

test('passes a valid composite subproject with no references', async () => {
let checkResult = await projects.children.b.build({ reject: false });
let result = await projects.children.b.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(0);
expect(checkResult.stdout).toEqual('');
expect(checkResult.stderr).toEqual('');
expect(result.exitCode).toBe(0);
expect(result.stdout).toEqual('');
expect(result.stderr).toEqual('');

expect(existsSync(projects.children.a.filePath(INDEX_D_TS))).toBe(false);
expect(existsSync(projects.children.b.filePath(INDEX_D_TS))).toBe(true);
expect(existsSync(projects.children.c.filePath(INDEX_D_TS))).toBe(false);
});
});

describe('reports diagnostics', () => {
describe.skip('reports diagnostics', () => {
describe('for the root', () => {
beforeEach(async () => {
let aCode = stripIndent`
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('CLI: single-pass build mode typechecking', () => {

projects.main.write(INPUT_SFC, rootCode);

let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });
expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -342,7 +342,7 @@ describe('CLI: single-pass build mode typechecking', () => {

projects.main.write(INPUT_SFC, rootCode);

let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });
expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -390,7 +390,7 @@ describe('CLI: single-pass build mode typechecking', () => {

projects.main.write(INPUT_SFC, rootCode);

let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });
expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
expect(stripAnsi(checkResult.stderr)).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -456,7 +456,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the main project', async () => {
let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand All @@ -474,7 +474,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the subproject', async () => {
let checkResult = await projects.children.a.build({ reject: false });
let checkResult = await projects.children.a.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand Down Expand Up @@ -505,7 +505,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the main project', async () => {
let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand All @@ -526,7 +526,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the subproject', async () => {
let checkResult = await projects.children.a.build({ reject: false });
let checkResult = await projects.children.a.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand Down Expand Up @@ -561,7 +561,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the main project', async () => {
let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand All @@ -579,7 +579,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the subproject', async () => {
let checkResult = await projects.children.a.build({ reject: false });
let checkResult = await projects.children.a.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand Down Expand Up @@ -615,7 +615,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the main project', async () => {
let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(0);
expect(checkResult.stdout).toEqual('');
Expand All @@ -627,7 +627,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the subproject', async () => {
let checkResult = await projects.children.a.build({ reject: false });
let checkResult = await projects.children.a.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(0);
expect(checkResult.stdout).toEqual('');
Expand Down Expand Up @@ -688,7 +688,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the main project', async () => {
let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand All @@ -706,7 +706,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the subproject', async () => {
let checkResult = await projects.children.b.build({ reject: false });
let checkResult = await projects.children.b.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(1);
expect(checkResult.stdout).toEqual('');
Expand Down Expand Up @@ -736,7 +736,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the main project', async () => {
let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand All @@ -757,7 +757,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the subproject', async () => {
let checkResult = await projects.children.b.build({ reject: false });
let checkResult = await projects.children.b.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(1);
expect(checkResult.stdout).toEqual('');
Expand Down Expand Up @@ -791,7 +791,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the main project', async () => {
let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand All @@ -809,7 +809,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('build from the subproject', async () => {
let checkResult = await projects.children.b.build({ reject: false });
let checkResult = await projects.children.b.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(1);
expect(checkResult.stdout).toEqual('');
Expand Down Expand Up @@ -875,7 +875,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('built from the main project', async () => {
let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand All @@ -893,7 +893,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('built from the intermediate project', async () => {
let checkResult = await projects.children.a.build({ reject: false });
let checkResult = await projects.children.a.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(1);
expect(checkResult.stdout).toEqual('');
Expand All @@ -911,7 +911,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('built from the transitively referenced project', async () => {
let checkResult = await projects.children.c.build({ reject: false });
let checkResult = await projects.children.c.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(1);
expect(checkResult.stdout).toEqual('');
Expand Down Expand Up @@ -941,7 +941,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('built from the main project', async () => {
let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand All @@ -962,7 +962,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('built from the intermediate project', async () => {
let checkResult = await projects.children.a.build({ reject: false });
let checkResult = await projects.children.a.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(1);
expect(checkResult.stdout).toEqual('');
Expand All @@ -983,7 +983,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('built from the transitively referenced project', async () => {
let checkResult = await projects.children.c.build({ reject: false });
let checkResult = await projects.children.c.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(1);
expect(checkResult.stdout).toEqual('');
Expand Down Expand Up @@ -1017,7 +1017,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('built from the main project', async () => {
let checkResult = await projects.main.build({ reject: false });
let checkResult = await projects.main.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(2);
expect(checkResult.stdout).toEqual('');
Expand All @@ -1035,7 +1035,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('built from the intermediate project', async () => {
let checkResult = await projects.children.a.build({ reject: false });
let checkResult = await projects.children.a.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(1);
expect(checkResult.stdout).toEqual('');
Expand All @@ -1053,7 +1053,7 @@ describe('CLI: single-pass build mode typechecking', () => {
});

test('built from the transitively referenced project', async () => {
let checkResult = await projects.children.c.build({ reject: false });
let checkResult = await projects.children.c.buildDeclaration({ reject: false });

expect(checkResult.exitCode).toBe(1);
expect(checkResult.stdout).toEqual('');
Expand Down Expand Up @@ -1151,15 +1151,15 @@ describe.skip('CLI: --build --clean', () => {
projects.children.b.write(INPUT_SFC, bCode);
projects.children.c.write(INPUT_SFC, cCode);

let buildResult = await projects.main.build();
let buildResult = await projects.main.buildDeclaration();
expect(buildResult.exitCode).toBe(0);
expect(buildResult.stdout).toEqual('');
expect(buildResult.stderr).toEqual('');
expect(existsSync(projects.children.a.filePath(INDEX_D_TS))).toBe(true);
expect(existsSync(projects.children.b.filePath(INDEX_D_TS))).toBe(true);
expect(existsSync(projects.children.c.filePath(INDEX_D_TS))).toBe(true);

let buildCleanResult = await projects.main.build({ flags: ['--clean'] });
let buildCleanResult = await projects.main.buildDeclaration({ flags: ['--clean'] });
expect(buildCleanResult.exitCode).toBe(0);
expect(buildCleanResult.stdout).toEqual('');
expect(buildCleanResult.stderr).toEqual('');
Expand Down Expand Up @@ -1251,7 +1251,7 @@ describe.skip('CLI: --build --force', () => {
projects.children.b.write(INPUT_SFC, bCode);
projects.children.c.write(INPUT_SFC, cCode);

let buildResult = await projects.main.build();
let buildResult = await projects.main.buildDeclaration();
expect(buildResult.exitCode).toBe(0);
expect(buildResult.stdout).toEqual('');
expect(buildResult.stderr).toEqual('');
Expand All @@ -1260,7 +1260,7 @@ describe.skip('CLI: --build --force', () => {
let firstBStat = statSync(projects.children.b.filePath(INDEX_D_TS));
let firstCStat = statSync(projects.children.c.filePath(INDEX_D_TS));

let buildCleanResult = await projects.main.build({ flags: ['--force'] });
let buildCleanResult = await projects.main.buildDeclaration({ flags: ['--force'] });
expect(buildCleanResult.exitCode).toBe(0);
expect(buildCleanResult.stdout).toEqual('');
expect(buildCleanResult.stderr).toEqual('');
Expand Down Expand Up @@ -1504,7 +1504,7 @@ describe.skip('CLI: --build --dry', () => {
});

test('when no build has occurred', async () => {
let buildResult = await projects.root.build({ flags: ['--dry'] });
let buildResult = await projects.root.buildDeclaration({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${projects.main.filePath('tsconfig.json')}'`,
Expand All @@ -1523,11 +1523,11 @@ describe.skip('CLI: --build --dry', () => {

describe('when the project has been built', () => {
beforeEach(async () => {
await projects.root.build();
await projects.root.buildDeclaration();
});

test('and there are no changes', async () => {
let buildResult = await projects.root.build({ flags: ['--dry'] });
let buildResult = await projects.root.buildDeclaration({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`Project '${projects.main.filePath('tsconfig.json')}' is up to date`,
Expand Down Expand Up @@ -1566,7 +1566,7 @@ describe.skip('CLI: --build --dry', () => {
`;
projects.main.write(INPUT_SFC, rootCode);

let buildResult = await projects.root.build({ flags: ['--dry'] });
let buildResult = await projects.root.buildDeclaration({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${projects.main.filePath('tsconfig.json')}'`,
Expand All @@ -1591,7 +1591,7 @@ describe.skip('CLI: --build --dry', () => {
`;
projects.children.a.write(INPUT_SFC, aCode);

let buildResult = await projects.root.build({ flags: ['--dry'] });
let buildResult = await projects.root.buildDeclaration({ flags: ['--dry'] });
expect(buildResult.exitCode).toBe(0);
expect(stripAnsi(buildResult.stdout)).toMatch(
`A non-dry build would build project '${projects.main.filePath('tsconfig.json')}'`,
Expand Down
Loading
Loading