Reputation: 1430
Pact
depends on a package called make-error-cause
. In its index.js
it declares a method, then a var immediately afterwards with the same name.
Jest/Typescript does not like this. NOTHING we do will allow our test to run when ran with Jest
, we continuously get this error:
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
:
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.
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"
If i change var makeErrorCause;
to var makeErrorCause2;
, the problem goes away. Obviously this won't work for anyone else trying to build it....
Any help appreciated.
Upvotes: 2
Views: 404
Reputation: 4065
See https://github.com/pact-foundation/pact-js/issues/606, the issue was relating to a jest config problem:
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
Upvotes: 0
Reputation: 4065
Well, that sucks! This issue should belong at 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.
Upvotes: 1