Skip to content

SPFx 1.18 scaffolded with --use-heft does not compile because of missing @types/heft-jest package #9172

@ltdu

Description

@ltdu

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • SPFx 1.18 rc1
  • Node.js v16.20.2
  • pnpm 7.32.5

Describe the bug / error

New SPFx v1.18 project scaffolded with --use-heft uses TS configuration, which requires @types/heft-jest package. Trying to build such project results in following error message:

PS C:\Solutions\Experiments\spfx-1.18-rc1-patched> pnpm build

> spfx-1-18-rc-1-patched@0.0.1 build C:\Solutions\Experiments\spfx-1.18-rc1-patched
> heft test --clean

 ---- build started ----
[build:clean] Deleted 1 file and 3 folders
[build:sass] Generating sass typings...
[build:sass] Generated sass typings
[build:typescript] Using TypeScript version 4.7.4
[build:typescript] Encountered 1 TypeScript issue:
[build:typescript] Error: Cannot find type definition file for 'heft-jest'.
[build:typescript]   The file is in the program because:
[build:typescript]     Entry point of type library 'heft-jest' specified in compilerOptions
[build:lint] Using ESLint version 8.7.0
....

Steps to reproduce

  1. Create new project with --use-heft
pnpm --package yo@latest --package @microsoft/generator-sharepoint@next dlx yo @microsoft/sharepoint@next --skip-install --package-manager pnpm --use-heft 
  1. Follow series of question to build your SPFx project of choice (I used simple WebPart with React)
  2. Install dependencies
pnpm install
  1. Build project
pnpm run build

Note: currently build does not work without some additional work (see: #9073)

Expected behavior

It should be possible to build new project without any additional steps and error messages. At the moment it is required to add this dependency manually:

pnpm add @types/heft-jest --save-dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Triage 🔍Awaiting categorization and initial review.type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions