Skip to content

Commit

Permalink
fix: ts test case
Browse files Browse the repository at this point in the history
  • Loading branch information
onlylovermb committed Mar 31, 2022
1 parent a0647ad commit 712f025
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions test/ts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,21 +355,10 @@ describe('test/ts.test.js', () => {
fs.writeFileSync(path.resolve(cwd, './package.json'), JSON.stringify(pkgJson, null, 2));
});

it('should not load egg-ts-helper without flag and egg.declarations', () => {
return coffee.fork(eggBin, [ 'dev' ], { cwd })
// .debug()
.expect('stdout', /"typescript":true/)
.notExpect('stdout', /application log/)
.notExpect('stdout', /"declarations":true/)
.notExpect('stdout', /started/)
.expect('code', 1)
.end();
});

it('should load egg-ts-helper with dts flag', () => {
fs.mkdirSync(path.join(cwd, 'typings'));
return coffee.fork(eggBin, [ 'dev', '--dts' ], { cwd })
.debug()
// .debug()
.expect('stdout', /application log/)
.expect('stdout', /"typescript":true/)
.expect('stdout', /started/)
Expand All @@ -381,15 +370,25 @@ describe('test/ts.test.js', () => {
fs.mkdirSync(path.join(cwd, 'typings'));
pkgJson.egg.declarations = true;
fs.writeFileSync(path.resolve(cwd, './package.json'), JSON.stringify(pkgJson, null, 2));

return coffee.fork(eggBin, [ 'dev' ], { cwd })
.debug()
// .debug()
.expect('stdout', /application log/)
.expect('stdout', /"typescript":true/)
.expect('stdout', /"declarations":true/)
.expect('stdout', /started/)
.expect('code', 0)
.end();
});

it('should not load egg-ts-helper without flag and egg.declarations', () => {
return coffee.fork(eggBin, [ 'dev' ], { cwd })
// .debug()
.expect('stdout', /"typescript":true/)
.notExpect('stdout', /application log/)
.notExpect('stdout', /"declarations":true/)
.notExpect('stdout', /started/)
.expect('code', 1)
.end();
});
});
});

0 comments on commit 712f025

Please sign in to comment.