jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.22k stars 507 forks source link

Error when running test with react stitches -- needs TS4 #982

Closed norman-ags closed 3 years ago

norman-ags commented 3 years ago

Current Behavior

yarn test throws an error: TypeError: Cannot read property 'length' of undefined

      TypeError: Cannot read property 'length' of undefined
      at TextImpl.get length [as length] (node_modules/jsdom/lib/jsdom/living/nodes/CharacterData-impl.js:28:23)
      at TextImpl.set data [as data] (node_modules/jsdom/lib/jsdom/living/nodes/CharacterData-impl.js:24:30)
      at Text.textNode [as data] (node_modules/jsdom/lib/jsdom/living/generated/CharacterData.js:248:24)
      at Set.onChange (node_modules/@stitches/react/src/index.js:16:64)
      at Set.addCss (node_modules/@stitches/core/src/CssSet.js:19:9)
      at expressThemedRule (node_modules/@stitches/core/src/index.js:73:16)
      at Function.assign [as className] (node_modules/@stitches/core/src/index.js:82:5)
          at assign (<anonymous>)
      at createCss (node_modules/@stitches/core/src/index.js:343:2)
      at Object.x (node_modules/@stitches/react/src/index.js:39:16)

I'm using react stitches to create my button component. Project setup: https://github.com/norman-ags/tsdx-with-stitches

Expected behavior

Expected the test to pass

Additional context

I have tried this using CRA and the test runs fine.

Your environment

  System:
    OS: Windows 10 10.0.19041
    CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
    Memory: 7.65 GB / 15.93 GB
  Binaries:
    Node: 14.15.5 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 88.0.4324.190
    Edge: Spartan (44.19041.423.0), Chromium (88.0.705.81)
    Internet Explorer: 11.0.19041.1
  npmPackages:
    tsdx: ^0.14.1 => 0.14.1
    typescript: ^4.2.2 => 4.2.2
norman-ags commented 3 years ago

I fixed this by adding a resolution as suggested here: #926