我只是通过npm安装了web-component-tester并尝试通过wct命令运行测试,但是出现了错误。
WCT命令不起作用cmd无法识别该命令
<head>
<meta charset="UTF-8">
<title>Title</title>
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<script src="../node_modules/web-component-tester/browser.js"></script>
<script src="../button/solid-button.js"></script>
</head>
<body>
<solid-button></solid-button>
<script>
suite('<solid-button>', function () {
let component = document.querySelector('solid-button');
test('renders button', () => {
assert.isOk(component.shadowRoot.querySelector('button'));
});
});
</script>
</body>
const button= document.createElement("button");
button.innerText="solid button";
class SolidButton extends HTMLElement {
constructor() {
super();
this.attachShadow({mode: 'open'});
this.shadowRoot.appendChild(button);
}
connectedCallback(){}
}
window.customElements.define('solid-button', SolidButton);
'wct'不被识别为内部或外部命令, 可操作的程序或批处理文件。