Skip to content

bug: TypeScript errors in generated test files #6686

@mvolkmann

Description

@mvolkmann

Prerequisites

Stencil Version

@stencil/core 4.43.4

Current Behavior

I ran "npm init stencil" to create a new project. Then I cd'ed to that project, ran "npm run generate", and entered "hello-world" for the component tag name. Then I ran "npm run start" and got many TypeScript errors from src/components/hello-world/test/hello-world.e2e.ts and hello-world.spec.tsx. The errors say "Cannot find name" where the name is describe, it, or expect. I suspect this is caused by a recent change in the testing strategy.

Here is what Codex thinks.


This looks like a real Stencil generator mismatch, not user error.

npm init stencil created a Vitest-based starter:

tsconfig.json (line 1) includes @stencil/vitest/globals
vitest.config.ts (line 1) only looks for .unit.test. and .cmp.test.
the starter component test my-component.cmp.test.tsx (line 1) imports describe, it, and expect from @stencil/vitest
But npm run generate is still emitting old integrated-testing templates:

hello-world.spec.tsx (line 1)
hello-world.e2e.ts (line 1)
Those generated files use bare describe/it/expect and the old @stencil/core/testing style, which doesn’t match the new starter’s Vitest setup. I also checked the installed CLI template in @stencil/core@4.43.4, and it still generates that older boilerplate. So the bug is specifically in stencil generate being out of sync with the newer starter/testing setup.

I can’t prove the exact release where it started from public sources alone, but it does look tied to the recent testing transition: Stencil’s upstream v5 breaking-changes discussion explicitly says integrated testing is being deprecated/removed in favor of @stencil/vitest and Playwright (opened February 4, 2026). That fits what we’re seeing: the starter moved, but the generator template hasn’t fully caught up yet.

Expected Behavior

I expected that running a newly created project with a newly generated component would not result in TypeScript errors.

System Info

System: node 24.12.0
    Platform: darwin (25.4.0)
   CPU Model: Apple M1 Pro (10 cpus)
    Compiler: /Users/volkmannm/Documents/dev/web-components/stencil/delete-me/delete-me/node_modules/@stencil/core/compiler/stencil.js
       Build: 1776084048
     Stencil: 4.43.4 🏝
  TypeScript: 5.8.3
      Rollup: 4.44.0
      Parse5: 7.2.1
      jQuery: 4.0.0-pre
      Terser: 5.37.0

Steps to Reproduce

Run npm init stencil
Enter "my-project" for the project name.
Run cd my-project
Run npm run generate
Enter "hello-world" for the component tag name.
Run npm run start

Code Reproduction URL

https://github.com/mvolkmann/stencil-bug

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: ValidatedThis PR or Issue is verified to be a bug within Stencil

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions