crimx / ext-saladict

🥗 All-in-one professional pop-up dictionary and page translator which supports multiple search modes, page translations, new word notebook and PDF selection searching.
https://saladict.crimx.com/
MIT License
11.97k stars 730 forks source link

单元测试失败,编译失败 #393

Closed FishOrBear closed 5 years ago

FishOrBear commented 5 years ago

npm run test

Test Suites: 3 failed, 41 passed, 44 total
Tests:       6 failed, 203 passed, 209 total
Snapshots:   2 failed, 2 passed, 4 total
Time:        12.441s, estimated 17s
Ran all test suites.

`npm run build`

> saladict@6.33.1 build D:\Dev\ext-saladict2
> node scripts/build.js

Creating an optimized production build...
Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks 
instead.
no-use-before-declare is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
Failed to compile.

D:\Dev\ext-saladict2\src\options\components\options\Notebook\WebdavModal.tsx
[tsl] ERROR in D:\Dev\ext-saladict2\src\options\components\options\Notebook\WebdavModal.tsx(224,12)
      TS2322: Type '{ children: any; key: string; type: "danger"; onClick: () => Promise<void>; 
}' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<Button> & Readonly<AnchorButtonProps> & Readonly<...'.
  Type '{ children: any; key: string; type: "danger"; onClick: () => Promise<void>; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Button> & Readonly<AnchorButtonProps> & Readonly<{...'.
    Type '{ children: any; key: string; type: "danger"; onClick: () => Promise<void>; }' is not 
assignable to type 'Readonly<AnchorButtonProps>'.
      Property 'href' is missing in type '{ children: any; key: string; type: "danger"; onClick: () => Promise<void>; }'.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! saladict@6.33.1 build: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the saladict@6.33.1 build 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!     C:\Users\admin\AppData\Roaming\npm-cache\_logs\2019-06-25T10_13_51_631Z-debug.log
crimx commented 5 years ago

请使用 yarn 以安装正确依赖。

FishOrBear commented 5 years ago

好的 我试试

FishOrBear commented 5 years ago

使用yarn后

Test Suites: 2 failed, 42 passed, 44 total
Tests:       4 failed, 205 passed, 209 total
Snapshots:   4 passed, 4 total
Time:        14.112s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
crimx commented 5 years ago

清空了 node_modules 没有

rm -r node_modules
yarn
yarn test
FishOrBear commented 5 years ago

可能是node-sass错误,我检查一下

FishOrBear commented 5 years ago

看起来还是失败的,另外什么不升级依赖呢? typescript3 webpack4 等

crimx commented 5 years ago

目前运行稳定,升级这依赖问题有得捣腾。

crimx commented 5 years ago

我期间换了几台机器都是成功编译的,CI 上也没问题。

crimx commented 5 years ago

不过 Saladict 7 将基于 neutrino 9 开发,以后升级依赖应该会轻松些。

FishOrBear commented 5 years ago

我运行typescript的类型校验也得到一些错误.

tsc --noEmit -w
crimx commented 5 years ago

你这么用 tsc ,用的是全局 TypeScript 吧,跟本项目的不是一个版本。yarn 有 lock file 安装依赖一般是非常一致的。

FishOrBear commented 5 years ago

可以局部用,在package.json里面的Script里面添加后调用就是用项目的.

crimx commented 5 years ago

我检查了 lockfile ,是 TypeScript 版本问题,typescript@^2.8.1 但其实 2.9 跟 2.8 是不兼容的。我先锁上这个版本,你可以用 yarn add --dev typescript@2.8.x 试试。

crimx commented 5 years ago

目前的配置还涉及到 Jest 的一些插件,所以就不升级 typescript 了。下个版本会一并更换掉。