测试
2023年3月8日大约 1 分钟
测试
在测试之前,请先安装依赖:
npm i
通过以下命令来运行常用的测试:
npm t
你也可以单独运行一部分测试:
- Linting:
npm run lint - 使用 Karma 在 modern Chromium、Firefox、WebKit (Playwright) 以及 ancient WebKit (PhantomJS)中运行单元测试:
npx run-s init bundle test-unit-karma - 在 NodeJS 中运行单元测试:
npx run-s init bundle test-unit-node - 在 Bun 中运行单元测试 (因需要单独安装 Bun,所以并未包含在
npm t中):npx run-s init bundle test-unit-bun - 运行 Test262 测试(并未包含在默认测试中):
npx run-s init bundle-package test262 - 运行 Promises/A+ 和 ES6
Promise测试用例:npx run-s init test-promises - ECMAScript
Observable测试用例:npx run-s init test-observables - CommonJS 入口点测试:
npx run-s init test-entries core-js-compat工具测试:npx run-s init test-compat-toolscore-js-builder测试:npx run-s init test-builder- 如果你想在某个浏览器中运行测试,你应该首先构建 package 并测试:
npx run-s init bundle - 使用这个文件来运行全局版本的单元测试:
tests/unit-browser/global.html - 如果要运行 pure 版本的单元测试,请使用下列文件:
tests/unit-browser/pure.html