Skip to content

Commit

Permalink
get a few composite tests pasing
Browse files Browse the repository at this point in the history
  • Loading branch information
machty committed Jul 2, 2024
1 parent b0ff255 commit 0d89a64
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 49 deletions.
96 changes: 48 additions & 48 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,35 +218,35 @@ 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);
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

0 comments on commit 0d89a64

Please sign in to comment.