next.js
0625d0d1 - [ts-next-plugin] test: add metadata warn no type test (#78505)

Commit
239 days ago
[ts-next-plugin] test: add metadata warn no type test (#78505) ### Why? This PR initiates the migration of manual testing of the Next.js TypeScript plugin to an automated language service plugin test. It replaced the existing metadata `missing-type-warning` fixture with the `warn-no-type` test (naming for consistency, such as future `error-on-client`). ### Testing Plan This PR adds the tests and fixtures for the metadata plugin to **warn when no type is provided** for metadata config exports (`metadata` and `generateMetadata`). 1. The fixtures are tested into two categories: 1) "**has type**": expects no warning, and 2) "**no type**": expects a warning. 2. For "has type", the types are from `next` or custom. 3. Each section consists of inline exports and separate exports (`export { ... }`). 4. For the fixtures of `generateMetadata`, it is divided into a function, an arrow function, and a function expression divided with sync and async. <details><summary>Structure Details</summary> <p> #### `metadata` ``` . ├── has-type/ │ ├── export-inline/ │ │ ├── from-next │ │ └── from-others │ └── export-separate/ │ ├── from-next │ └── from-others └── no-type/ ├── export-inline └── export-separate ``` #### `gerenateMetadata` ``` . ├── has-type/ │ ├── export-inline/ │ │ ├── from-next/ │ │ │ ├── async/ │ │ │ │ ├── arrow-function │ │ │ │ ├── function-declaration │ │ │ │ └── function-expression │ │ │ └── sync/ │ │ │ ├── arrow-function │ │ │ ├── function-declaration │ │ │ └── function-expression │ │ └── from-others/ │ │ ├── async/ │ │ │ └── ... │ │ └── sync/ │ │ └── ... │ └── export-separate/ │ ├── from-next/ │ │ ├── async/ │ │ │ └── ... │ │ └── sync/ │ │ └── ... │ └── from-others/ │ ├── async/ │ │ └── ... │ └── sync/ │ └── ... └── no-type/ ├── export-inline/ │ ├── async/ │ │ └── ... │ └── sync/ │ └── ... └── export-separate/ ├── async/ │ └── ... └── sync/ └── ... ``` </p> </details> ### Follow Up The metadata currently has one more feature: an error when using metadata exports within Client Components.
Author
Parents
Loading