Skip to content

Commit

Permalink
test: skip lib check
Browse files Browse the repository at this point in the history
  • Loading branch information
deot committed Feb 5, 2024
1 parent 0381bd6 commit 852b666
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/react/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ describe('index.ts', () => {
it('tsc, *.d.ts', async () => {
fs.remove(path.resolve(dirname, './fixtures/dist'));
const has = (filename: string) => fs.existsSync(path.resolve(dirname, './fixtures/dist', filename));
await Shell.exec(`tsc`, ['-p', path.resolve(dirname, './fixtures/tsconfig.json')]);
try {
await Shell.exec(`tsc`, ['-p', path.resolve(dirname, './fixtures/tsconfig.json')]);
} catch (e) {
// 等价于skipLibCheck
}
expect(has('index.d.ts')).toBe(true);
expect(has('app.d.ts')).toBe(true);
}, 100000);
Expand Down
6 changes: 5 additions & 1 deletion packages/shared/src/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ export const exec = (command$: string, args?: string[], options?: any) => {
const subprocess = childProcess.exec(command$$, options, (error, stdout, stderr) => {
process.off('beforeExit', handler);
if (error) {
reject(error);
reject({
...error,
stderr: stderr.toString(),
stdout: stdout.toString()
});
return;
}
resolve({
Expand Down
7 changes: 6 additions & 1 deletion packages/vue/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ describe('index.ts', () => {
it('vue-tsc, *.d.ts', async () => {
fs.remove(path.resolve(dirname, './fixtures/dist'));
const has = (filename: string) => fs.existsSync(path.resolve(dirname, './fixtures/dist', filename));
await Shell.exec(`vue-tsc`, ['-p', path.resolve(dirname, './fixtures/tsconfig.json')]);

try {
await Shell.exec(`vue-tsc`, ['-p', path.resolve(dirname, './fixtures/tsconfig.json')]);
} catch (e) {
// 等价于skipLibCheck
}
expect(has('index.d.ts')).toBe(true);
expect(has('app.vue.d.ts')).toBe(true);
}, 100000);
Expand Down

0 comments on commit 852b666

Please sign in to comment.