TestWindow 不是 Stenciljs 单元测试中的构造函数

TestWindow is not a constructor in Stenciljs Unit test

当我 运行 对组件进行单元测试时出现错误 1) TestWindow 不是构造函数 2) 无法读取未定义的 属性 'textContent' 无法理解如何进一步进行。当我尝试控制台元素和 testWindow 时,两者都未定义。

    **tsx file**
    import { Component } from '@stencil/core';
    @Component({
        tag: 'my-header',
        styleUrl: 'my-header.css'
    })
    export class MyHeader {
        render() {
            return (
                <div>
                    <p>Hello MyHeader!</p>
                </div>
            );
        }
    }
    **Spec file**
    import { TestWindow } from '@stencil/core/testing';
    import { MyHeader } from './my-header';

    describe('my-header', () => {
      it('should build', () => {
        expect(new MyHeader()).toBeTruthy();
      });

      describe('rendering', () => {
        let element: HTMLMyHeaderElement;
        let testWindow: TestWindow;
        beforeEach(async () => {
          testWindow = new TestWindow();
          element = await testWindow.load({
            components: [MyHeader],
            html: '<my-header></my-header>'
          });

        });
        console.log("element ",element);
        console.log("testWindow ",testWindow);
        it('should show content', () => {
          expect(element.textContent).toEqual('');
        });

      });
    });

package.json "devDependencies":{ "@stencil/core": "~0.16.4", "@stencil/sass": "^0.1.1", "@types/jest": "23.3.11", "@types/puppeteer": "1.6.4", "jest": "^23.6.0", "jest-cli": "23.6.0", "puppeteer": "1.8.0", "workbox-build": "3.4.1" } 我怎样才能摆脱这些错误或者我遗漏了一些东西。

整个 Stencil 单元测试在最新版本中发生了变化。 TestWindow 现在已弃用,取而代之的是 Jest 和 Puppeteer 的组合。 您应该查阅文档以获取有关如何测试代码的进一步说明:end to end testing in Stencil