yarn/npm 莫名其妙地在 mocha 和 typescript 中使用了过时的代码
yarn/npm is using out of date code inexplicably with mocha and typescript
这是我见过的最奇怪的事情之一。如果我手动调用我的测试命令,我会得到两个测试结果,但如果我在 yarn/npm 脚本中 运行 相同的命令,它只会显示一个结果。有没有人 运行 以前遇到过这个问题,你是如何解决的?很奇怪。
我尝试删除已编译的 ts 并重新编译,但没有成功。
~/g/tally-bot> npm run testt
> tally-bot@1.2.1 testt /Users/ryan/git/tally-bot
> ts-mocha --recursive --exit **/*.test.ts
/Users/ryan/git/tally-bot/util
bump command
Bumping [test | Global: false] by 1
✓ should run a test
creating tables
1 passing (30ms)
ryan@ryan-macbook-2 ~/g/tally-bot> ts-mocha --recursive --exit **/*.test.ts
/Users/ryan/git/tally-bot/util
bump command
Bumping [test | Global: false] by 1
✓ should run a test
db-new.test.ts
creating tables
hmm
✓ test
2 passing (39ms)
好吧,事实证明这是因为我的 shell 纱线环境不同。
我 运行 以下内容来修复它,因为我将 fish 用于我的 shell。
yarn config set script-shell "/usr/local/bin/fish"
这是我见过的最奇怪的事情之一。如果我手动调用我的测试命令,我会得到两个测试结果,但如果我在 yarn/npm 脚本中 运行 相同的命令,它只会显示一个结果。有没有人 运行 以前遇到过这个问题,你是如何解决的?很奇怪。
我尝试删除已编译的 ts 并重新编译,但没有成功。
~/g/tally-bot> npm run testt
> tally-bot@1.2.1 testt /Users/ryan/git/tally-bot
> ts-mocha --recursive --exit **/*.test.ts
/Users/ryan/git/tally-bot/util
bump command
Bumping [test | Global: false] by 1
✓ should run a test
creating tables
1 passing (30ms)
ryan@ryan-macbook-2 ~/g/tally-bot> ts-mocha --recursive --exit **/*.test.ts
/Users/ryan/git/tally-bot/util
bump command
Bumping [test | Global: false] by 1
✓ should run a test
db-new.test.ts
creating tables
hmm
✓ test
2 passing (39ms)
好吧,事实证明这是因为我的 shell 纱线环境不同。
我 运行 以下内容来修复它,因为我将 fish 用于我的 shell。
yarn config set script-shell "/usr/local/bin/fish"