Skip to content

Commit

Permalink
test: add test patterns for --tsconfig-path CLI option
Browse files Browse the repository at this point in the history
  • Loading branch information
nokazn committed Apr 13, 2022
1 parent 3302d61 commit bec1a97
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ module.exports = [
args: ["run", "-t", "test/fixtures/with-type-errors/ts-error.ts"],
expect: { code: 0 }
},
{
args: ["run", "test/fixtures/ts-extends/any-args.ts"],
expect (code, stdout, stderr) {
return code === 1 && stderr.toString().indexOf('any-args.ts(4,20)') !== -1 && stderr.toString().indexOf('TS7006') !== -1;
}
},
{
args: ["run", "test/fixtures/ts-extends/any-args.ts", "--tsconfig-path", "test/fixtures/ts-extends/tsconfig.build.json"],
expect: { code: 0 }
},
{
args: ["build", "-o", "tmp", "test/fixtures/test.cjs"],
expect (code, stdout, stderr) {
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/ts-extends/any-args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* throws error (TS7006: an implicit 'any' type) if strict options is set to true, or otherwise passes compilation
*/
function something(args) {
return args;
}
6 changes: 6 additions & 0 deletions test/fixtures/ts-extends/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"strict": false
}
}
5 changes: 5 additions & 0 deletions test/fixtures/ts-extends/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"strict": true
}
}

0 comments on commit bec1a97

Please sign in to comment.