Skip to content

Commit

Permalink
remove silent flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Cang Truong committed Jul 20, 2021
1 parent 1255d6f commit 812156d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
14 changes: 0 additions & 14 deletions packages/modular-scripts/src/__tests__/typecheck.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,6 @@ describe('Modular typecheck', () => {
});
});
});
describe('when run silently', () => {
it('should print a one line error message', async () => {
let output = '';
try {
await execa('yarnpkg', ['modular', 'typecheck', '--silent'], {
all: true,
cleanup: true,
});
} catch ({ stderr }) {
output = stderr as string;
}
expect(output).toMatch('\u0078 Typecheck did not pass');
});
});
});
describe('when there are no type errors', () => {
it('should print a one line success message', async () => {
Expand Down
12 changes: 2 additions & 10 deletions packages/modular-scripts/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,20 +226,12 @@ program
await port(relativePath);
});

interface TypecheckOptions {
silent: boolean;
}

program
.command('typecheck')
.option(
'--silent',
'silences the error messages gathered during the type check',
)
.description('Typechecks the entire project')
.action(async (options: TypecheckOptions) => {
.action(async () => {
const { typecheck } = await import('./typecheck');
await typecheck(options.silent);
await typecheck();
});

void startupCheck()
Expand Down
7 changes: 1 addition & 6 deletions packages/modular-scripts/src/typecheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getPackageMetadata from './utils/getPackageMetadata';
import * as logger from './utils/logger';
import getModularRoot from './utils/getModularRoot';

export async function typecheck(silent = false): Promise<void> {
export async function typecheck(): Promise<void> {
const { typescriptConfig } = await getPackageMetadata();

const { _compilerOptions, ...rest } = typescriptConfig;
Expand Down Expand Up @@ -73,11 +73,6 @@ export async function typecheck(silent = false): Promise<void> {
.concat(emitResult.diagnostics);

if (diagnostics.length) {
if (silent) {
// "x Typecheck did not pass"
throw new Error('\u0078 Typecheck did not pass');
}

if (isCI) {
// formatDiagnostics will return a readable list of error messages, each with its own line
throw new Error(ts.formatDiagnostics(diagnostics, diagnosticHost));
Expand Down

0 comments on commit 812156d

Please sign in to comment.