generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
413 additions
and
449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
load "common.bats" | ||
|
||
setup() { | ||
cd $BATS_FILE_TMPDIR | ||
cd $BATS_FILE_TMPDIR | ||
} | ||
|
||
teardown() { | ||
bazel shutdown | ||
rm -rf $BATS_FILE_TMPDIR/* | ||
bazel shutdown | ||
rm -rf $BATS_FILE_TMPDIR/* | ||
} | ||
|
||
@test 'should handle 3p dependency upgrade and downgrade gracefully' { | ||
run pnpm add @nestjs/[email protected] @nestjs/[email protected] [email protected] @types/[email protected] --lockfile-only | ||
run pnpm add @nestjs/[email protected] @nestjs/[email protected] [email protected] @types/[email protected] --lockfile-only | ||
|
||
workspace --npm-translate-lock | ||
tsconfig | ||
workspace --npm-translate-lock | ||
tsconfig | ||
|
||
echo 'export * as core from "@nestjs/core"' > source.ts | ||
echo 'console.log("test")' >> source.ts | ||
echo 'export * as core from "@nestjs/core"' >source.ts | ||
echo 'console.log("test")' >>source.ts | ||
|
||
ts_project -l -s "source.ts" -d ":node_modules/@types/node" -d ":node_modules/@nestjs/core" -d ":node_modules/@nestjs/common" | ||
run bazel build :foo | ||
assert_success | ||
refute_output -p "error" "@nestjs/core" "@types/node" | ||
ts_project -l -s "source.ts" -d ":node_modules/@types/node" -d ":node_modules/@nestjs/core" -d ":node_modules/@nestjs/common" | ||
run bazel build :foo | ||
assert_success | ||
refute_output -p "error" "@nestjs/core" "@types/node" | ||
|
||
# upgrade: @nestjs/core from 9.2.0 to 9.2.1 | ||
# dowgrade: @types/node from 18.11.9 to 18.6.1 | ||
run pnpm add @nestjs/[email protected] @types/[email protected] --lockfile-only | ||
# upgrade: @nestjs/core from 9.2.0 to 9.2.1 | ||
# dowgrade: @types/node from 18.11.9 to 18.6.1 | ||
run pnpm add @nestjs/[email protected] @types/[email protected] --lockfile-only | ||
|
||
run bazel build :foo | ||
assert_failure | ||
assert_output -p "error TS2403: Subsequent variable declarations must have the same type. Variable 'AbortSignal' must be of type" | ||
run bazel build :foo | ||
assert_failure | ||
assert_output -p "error TS2403: Subsequent variable declarations must have the same type. Variable 'AbortSignal' must be of type" | ||
|
||
# dowgrade: @nestjs/core from 9.2.1 to 9.2.0 | ||
# upgrade: @types/node from 18.6.1 to 18.11.9 | ||
run pnpm add @nestjs/[email protected] @types/[email protected] --lockfile-only | ||
# dowgrade: @nestjs/core from 9.2.1 to 9.2.0 | ||
# upgrade: @types/node from 18.6.1 to 18.11.9 | ||
run pnpm add @nestjs/[email protected] @types/[email protected] --lockfile-only | ||
|
||
run bazel build :foo | ||
assert_success | ||
refute_output -p "error" "@nestjs/core" "@types/node" | ||
} | ||
run bazel build :foo | ||
assert_success | ||
refute_output -p "error" "@nestjs/core" "@types/node" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,69 @@ | ||
load "common.bats" | ||
|
||
setup() { | ||
cd $BATS_FILE_TMPDIR | ||
cd $BATS_FILE_TMPDIR | ||
} | ||
|
||
teardown() { | ||
bazel shutdown | ||
rm -rf $BATS_FILE_TMPDIR/* | ||
bazel shutdown | ||
rm -rf $BATS_FILE_TMPDIR/* | ||
} | ||
|
||
@test 'build a target that will never succeed' { | ||
workspace | ||
ts_project --src "source.ts" | ||
tsconfig | ||
echo 'const t: string = 1' > source.ts | ||
run bazel build :foo | ||
assert_failure | ||
assert_output -p "source.ts(1,7): error TS2322: Type 'number' is not assignable to type 'string'" "FAILED: Build did NOT complete successfully" | ||
workspace | ||
ts_project --src "source.ts" | ||
tsconfig | ||
echo 'const t: string = 1' >source.ts | ||
run bazel build :foo | ||
assert_failure | ||
assert_output -p "source.ts(1,7): error TS2322: Type 'number' is not assignable to type 'string'" "FAILED: Build did NOT complete successfully" | ||
} | ||
|
||
|
||
@test 'should stop reporting diagnostics' { | ||
workspace | ||
ts_project --src "source.ts" | ||
tsconfig | ||
echo 'const t: string;' > source.ts | ||
run bazel build :foo | ||
assert_failure | ||
assert_output -p "source.ts(1,7): error TS1155: 'const' declarations must be initialized." | ||
workspace | ||
ts_project --src "source.ts" | ||
tsconfig | ||
echo 'const t: string;' >source.ts | ||
run bazel build :foo | ||
assert_failure | ||
assert_output -p "source.ts(1,7): error TS1155: 'const' declarations must be initialized." | ||
|
||
echo 'const t: string = "";' > source.ts | ||
run bazel build :foo | ||
assert_success | ||
refute_output -p "error" | ||
echo 'const t: string = "";' >source.ts | ||
run bazel build :foo | ||
assert_success | ||
refute_output -p "error" | ||
} | ||
|
||
@test 'should stop reporting diagnostics for removed srcs' { | ||
workspace | ||
ts_project --src "source.ts" --src "to_be_removed.ts" | ||
tsconfig | ||
echo 'let t: string;' > source.ts | ||
echo 'const t2: string;' > to_be_removed.ts | ||
run bazel build :foo | ||
assert_failure | ||
assert_output -p "to_be_removed.ts(1,7): error TS1155: 'const' declarations must be initialized." | ||
workspace | ||
ts_project --src "source.ts" --src "to_be_removed.ts" | ||
tsconfig | ||
echo 'let t: string;' >source.ts | ||
echo 'const t2: string;' >to_be_removed.ts | ||
|
||
run bazel build :foo | ||
assert_failure | ||
assert_output -p "to_be_removed.ts(1,7): error TS1155: 'const' declarations must be initialized." | ||
|
||
rm to_be_removed.ts | ||
ts_project --src "source.ts" | ||
run bazel build :foo | ||
assert_success | ||
refute_output -p "error" | ||
rm to_be_removed.ts | ||
ts_project --src "source.ts" | ||
run bazel build :foo | ||
assert_success | ||
refute_output -p "error" | ||
} | ||
|
||
@test 'tsconfig changes should emit new errors' { | ||
workspace | ||
ts_project --src "source.ts" | ||
tsconfig | ||
echo 'export function t(a) { return typeof a != "string" }' > source.ts | ||
|
||
run bazel build :foo | ||
assert_success | ||
refute_output -p "error" | ||
workspace | ||
ts_project --src "source.ts" | ||
tsconfig | ||
echo 'export function t(a) { return typeof a != "string" }' >source.ts | ||
|
||
tsconfig --no-implicit-any | ||
run bazel build :foo | ||
assert_failure | ||
assert_output -p "source.ts(1,19): error TS7006: Parameter 'a' implicitly has an 'any' type." | ||
} | ||
run bazel build :foo | ||
assert_success | ||
refute_output -p "error" | ||
|
||
tsconfig --no-implicit-any | ||
run bazel build :foo | ||
assert_failure | ||
assert_output -p "source.ts(1,19): error TS7006: Parameter 'a' implicitly has an 'any' type." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
load "common.bats" | ||
|
||
setup() { | ||
cd $BATS_FILE_TMPDIR | ||
cd $BATS_FILE_TMPDIR | ||
} | ||
|
||
teardown() { | ||
bazel shutdown | ||
rm -rf $BATS_FILE_TMPDIR/* | ||
bazel shutdown | ||
rm -rf $BATS_FILE_TMPDIR/* | ||
} | ||
|
||
|
||
@test 'should emit .tsbuildinfo' { | ||
workspace | ||
mkdir ./a ./b | ||
workspace | ||
mkdir ./a ./b | ||
|
||
echo "export function a(): string { return 'a'; }" > ./a/index.ts | ||
tsconfig --path ./a --declaration --composite | ||
ts_project --path ./a --name a --src "index.ts" --declaration --composite | ||
echo "export function a(): string { return 'a'; }" >./a/index.ts | ||
tsconfig --path ./a --declaration --composite | ||
ts_project --path ./a --name a --src "index.ts" --declaration --composite | ||
|
||
echo "export function b(): string { return 'b'; }" > ./b/index.ts | ||
tsconfig --path ./b --declaration --composite | ||
ts_project --path ./b --name b --src "index.ts" --declaration --composite | ||
echo "export function b(): string { return 'b'; }" >./b/index.ts | ||
tsconfig --path ./b --declaration --composite | ||
ts_project --path ./b --name b --src "index.ts" --declaration --composite | ||
|
||
echo "export * from './a'; export * from './b'" > index.ts | ||
tsconfig --declaration --composite | ||
echo "export * from './a'; export * from './b'" >index.ts | ||
tsconfig --declaration --composite | ||
|
||
ts_project --src "index.ts" --dep "//a" --dep "//b" --declaration --composite | ||
run bazel build :foo | ||
assert_success | ||
} | ||
ts_project --src "index.ts" --dep "//a" --dep "//b" --declaration --composite | ||
run bazel build :foo | ||
assert_success | ||
} |
Oops, something went wrong.