From f5e46c9bf2f50d66a953fa133161fc829cecff06 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Sat, 10 Feb 2024 13:22:13 -0700 Subject: chore: move cli/tests/ -> tests/ (#22369) This looks like a massive PR, but it's only a move from cli/tests -> tests, and updates of relative paths for files. This is the first step towards aggregate all of the integration test files under tests/, which will lead to a set of integration tests that can run without the CLI binary being built. While we could leave these tests under `cli`, it would require us to keep a more complex directory structure for the various test runners. In addition, we have a lot of complexity to ignore various test files in the `cli` project itself (cargo publish exclusion rules, autotests = false, etc). And finally, the `tests/` folder will eventually house the `test_ffi`, `test_napi` and other testing code, reducing the size of the root repo directory. For easier review, the extremely large and noisy "move" is in the first commit (with no changes -- just a move), while the remainder of the changes to actual files is in the second commit. --- tests/testdata/npm/types/main.out | 71 +++++++++++++++++++++++++++++++++++++++ tests/testdata/npm/types/main.ts | 27 +++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 tests/testdata/npm/types/main.out create mode 100644 tests/testdata/npm/types/main.ts (limited to 'tests/testdata/npm/types') diff --git a/tests/testdata/npm/types/main.out b/tests/testdata/npm/types/main.out new file mode 100644 index 000000000..de1f2c145 --- /dev/null +++ b/tests/testdata/npm/types/main.out @@ -0,0 +1,71 @@ +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. + bar: 1, + ~~~ + at [WILDCARD]/npm/types/main.ts:[WILDCARD] + + The expected type comes from property 'bar' which is declared here on type 'Foobar' + bar: string; + ~~~ + at [WILDCARD]/@denotest/types_imported/1.0.0/subpath.d.ts:3:5 + +TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. + prop: 1, + ~~~~ + at [WILDCARD]/npm/types/main.ts:[WILDCARD] + + The expected type comes from property 'prop' which is declared here on type 'SomeInterface' + prop: string; + ~~~~ + at [WILDCARD]/@denotest/types_imported/1.0.0/index.d.ts:2:5 + +TS2322 [ERROR]: Type 'string' is not assignable to type 'number'. + prop2: "asdf", + ~~~~~ + at [WILDCARD]/npm/types/main.ts:[WILDCARD] + + The expected type comes from property 'prop2' which is declared here on type 'SomeInterface' + prop2: number; + ~~~~~ + at [WILDCARD]/@denotest/types_imported/1.0.0/index.d.ts:3:5 + +TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. + fizz: 1, + ~~~~ + at [WILDCARD]/npm/types/main.ts:[WILDCARD] + + The expected type comes from property 'fizz' which is declared here on type 'Fizzbuzz' + fizz: string; + ~~~~ + at [WILDCARD]/@denotest/types/1.0.0/index.d.ts:2:3 + +TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. + buzz: 2, + ~~~~ + at [WILDCARD]/npm/types/main.ts:[WILDCARD] + + The expected type comes from property 'buzz' which is declared here on type 'Fizzbuzz' + buzz: string; + ~~~~ + at [WILDCARD]/@denotest/types/1.0.0/index.d.ts:3:3 + +TS2322 [ERROR]: Type '5' is not assignable to type '"test1"'. +const valueA: "test1" = getClient(); + ~~~~~~ + at [WILDCARD]/npm/types/main.ts:[WILDCARD] + +TS2322 [ERROR]: Type '"import"' is not assignable to type '"test2"'. +const valueB: "test2" = entryImport(); + ~~~~~~ + at [WILDCARD]/types/main.ts:[WILDCARD] + +TS2322 [ERROR]: Type '12' is not assignable to type '"test3"'. +const valueC: "test3" = entryA(); + ~~~~~~ + at [WILDCARD]/types/main.ts:[WILDCARD] + +TS2322 [ERROR]: Type '"types"' is not assignable to type '"test4"'. +const valueD: "test4" = entryTypes(); + ~~~~~~ + at file:///[WILDCARD]/types/main.ts:[WILDCARD] + +Found 9 errors. diff --git a/tests/testdata/npm/types/main.ts b/tests/testdata/npm/types/main.ts new file mode 100644 index 000000000..ae420f6d6 --- /dev/null +++ b/tests/testdata/npm/types/main.ts @@ -0,0 +1,27 @@ +import type { Fizzbuzz } from "npm:@denotest/types"; +import type { SomeInterface } from "npm:@denotest/types_imported"; +import type { Foobar as FooInterface } from "npm:@denotest/types_imported/subpath"; +import { getClient } from "npm:@denotest/types-exports-subpaths/client"; +import { entryImport } from "npm:@denotest/types-exports-subpaths/entry-import"; +import { entryA } from "npm:@denotest/types-exports-subpaths/entry-a"; +import { entryTypes } from "npm:@denotest/types-exports-subpaths/entry-types-last-no-declaration-before"; + +const foobar: FooInterface = { + foo: "foo", + bar: 1, +}; + +const i: SomeInterface = { + prop: 1, + prop2: "asdf", +}; + +const fizzbuzz: Fizzbuzz = { + fizz: 1, + buzz: 2, +}; + +const valueA: "test1" = getClient(); +const valueB: "test2" = entryImport(); +const valueC: "test3" = entryA(); +const valueD: "test4" = entryTypes(); -- cgit v1.2.3