我想创建一个可重复使用的React组件库,对于样板,我遇到了create-react-library-https://www.npmjs.com/package/create-react-library。
我按照步骤使用npx命令创建新库,并且成功完成了。
我发现我无法运行npm run test
,但是如果我在命令提示符下运行eslint .
则效果很好,所以不确定是否收到此错误。
代码编辑器:Visual Studio代码。
MacBook:testlib xx$ npm run test
> testlib@1.0.0 test /Users/xx/Documents/Repos/testlib
> run-s test:unit test:lint test:build
> testlib@1.0.0 test:unit /Users/xx/Documents/Repos/testlib
> cross-env CI=1 react-scripts test --env=jsdom
PASS src/index.test.tsx
ExampleComponent
✓ is truthy (6ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 5.4s
Ran all test suites.
> testlib@1.0.0 test:lint /Users/xx/Documents/Repos/testlib
> eslint .
Oops! Something went wrong! :(
ESLint: 6.8.0.
No files matching the pattern "." were found.
Please check for typing mistakes in the pattern.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! testlib@1.0.0 test:lint: `eslint .`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the testlib@1.0.0 test:lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xx/.npm/_logs/2020-08-06T10_19_00_172Z-debug.log
ERROR: "test:lint" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! testlib@1.0.0 test: `run-s test:unit test:lint test:build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the testlib@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xx/.npm/_logs/2020-08-06T10_19_00_222Z-debug.log