[英]Pact dependency stopping tests being run
Pact
depends on a package called make-error-cause
. Pact
依赖于名为make-error-cause
的 package 。 In its index.js
it declares a method, then a var immediately afterwards with the same name.在它的index.js
中,它声明了一个方法,然后是一个同名的 var。
Jest/Typescript does not like this. Jest/Typescript 不喜欢这样。 NOTHING we do will allow our test to run when ran with Jest
, we continuously get this error:当使用Jest
运行时,我们所做的任何事情都不会允许我们的测试运行,我们不断收到此错误:
SyntaxError: /Users/user1234/Documents/Workspace/aws_stack/node_modules/make-error-cause/dist/index.js: Identifier 'makeErrorCause' has already been declared (12:4)
And this is the snippet of code from make-error-cause
's index.js
:这是来自make-error-cause
的index.js
的代码片段:
var makeError = require('make-error');
function makeErrorCause(value, _super) {
if (_super === void 0) { _super = makeErrorCause.BaseError; }
return makeError(value, _super);
}
var makeErrorCause;
We have tried @pact-foundation/pact
and pact-jest
both have the same problem.我们试过@pact-foundation/pact
和pact-jest
都有同样的问题。
Versions: "@pact-foundation/pact": "^9.10.0" "typescript": "^3.8.3" "jest": "24.9.0" "ts-jest": "^24.3.0" "@types/jest": "^24.0.25"版本:“@pact-foundation/pact”:“^9.10.0”“typescript”:“^3.8.3”“jest”:“24.9.0”“ts-jest”:“^24.3.0”“@类型/笑话": "^24.0.25"
If i change var makeErrorCause;
如果我改变var makeErrorCause;
to var makeErrorCause2;
到var makeErrorCause2;
, the problem goes away. ,问题就消失了。 Obviously this won't work for anyone else trying to build it....显然,这不适用于其他试图构建它的人......
Any help appreciated.任何帮助表示赞赏。
Well, that sucks!好吧,这很糟糕! This issue should belong at https://github.com/pact-foundation/pact-js .这个问题应该属于https://github.com/pact-foundation/pact-js 。 Looks to be fatal - could you please raise there along with a repro we can use?看起来是致命的——你能把它和我们可以使用的复制品一起提出来吗?
Our builds (both projects) do test Jest in every commit, so it's likely a combination of versions of dependencies we need to sort through.我们的构建(两个项目)在每次提交时都会测试 Jest,因此它可能是我们需要排序的依赖项版本的组合。
See https://github.com/pact-foundation/pact-js/issues/606 , the issue was relating to a jest config problem:请参阅https://github.com/pact-foundation/pact-js/issues/606 ,该问题与开玩笑的配置问题有关:
preset: 'react-native',
// transformIgnorePatterns: ['node_modules/(?!(react-native|uilib)/)'], ## uncomment this, it's fine.
// transformIgnorePatterns: ['node_modules/uilib/'] ## if I uncomment this, it will fail
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.