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

Provide unskipped variant of build-watch test #802

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
36 changes: 35 additions & 1 deletion packages/core/__tests__/cli/watch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ describe('CLI: watched typechecking', () => {
await watch.terminate();
});

test.skip('reports on errors introduced and cleared in a script with a .gts extension', async () => {
// TODO: Reinstate this; some reason this doesn't work when `--build` flag is omitted; specifically
// it will detect the change and recompile but doesn't see the error.
test.skip('reports on errors introduced and cleared in a script with a .gts extension (without --build)', async () => {
project.setGlintConfig({ environment: 'ember-template-imports' });

let code = stripIndent`
Expand Down Expand Up @@ -249,6 +251,38 @@ describe('CLI: watched typechecking', () => {
await watch.terminate();
});

test('reports on errors introduced and cleared in a script with a .gts extension (with --build)', async () => {
project.setGlintConfig({ environment: 'ember-template-imports' });

let code = stripIndent`
export default class MyClass {
private startupTime = new Date().toISOString();

public render(): void {
console.log(this.startupTime);
}
}
`;

project.write('index.gts', code);

let watch = project.checkWatch({ reject: true, build: true });
let output = await watch.awaitOutput('Watching for file changes.');
expect(output).toMatch('Found 0 errors.');

project.write('index.gts', code.replace('this.startupTime', 'this.startupTimee'));

output = await watch.awaitOutput('Watching for file changes.');
expect(output).toMatch('Found 1 error.');

project.write('index.gts', code);

output = await watch.awaitOutput('Watching for file changes.');
expect(output).toMatch('Found 0 errors.');

await watch.terminate();
});

test.skip('reports correct diagnostics given @glint-expect-error and @glint-ignore directives', async () => {
project.setGlintConfig({ environment: 'ember-loose' });

Expand Down
5 changes: 4 additions & 1 deletion test-packages/test-utils/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,11 @@ export class Project {
});
}

public checkWatch(options: Options & { flags?: string[] } = {}): Watch {
public checkWatch(options: Options & { flags?: string[], build?: boolean } = {}): Watch {
let flags = ['--watch', ...(options.flags ?? [])];
if (options.build) {
flags.unshift('--build');
}
return new Watch(this.check({ ...options, flags, reject: false }));
}

Expand Down
Loading