TypeError: createColors is not a function (Umi3)
Canoe-Silhouette opened this issue · 3 comments
TypeError: createColors is not a function (Umi3)
Software versions
Please provide at least OS and version of pact-js
- OS: Windows 10
- Consumer Pact library: Pact JS v12.1.0
- Node Version: 16.19.1
Issue Checklist
Please confirm the following:
- I have upgraded to the latest
- I have the read the FAQs in the Readme
- I have triple checked, that there are no unhandled promises in my code and have read the section on intermittent test failures
- I have set my log level to debug and attached a log file showing the complete request/response cycle
- For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem
Expected behaviour
Run PactV3 tests in Umi(v3.5).
Actual behaviour
Our team use Umi(v3.5) as the front-end framework, but we can't run the pact tests.
PS D:\workspace\umi3> yarn test
yarn run v1.22.11
$ umi-test
FAIL tests/pact.test.js
● Test suite failed to run
TypeError: createColors is not a function
1 | import { string} from "@pact-foundation/pact/src/dsl/matchers";
> 2 | const { MatchersV3} = require('@pact-foundation/pact');
| ^
3 | const { atLeastOneLike} = MatchersV3;
4 | export const data = {
5 | code:0,
at Object.<anonymous> (node_modules/pino-pretty/lib/colors.js:19:25)
at Object.<anonymous> (node_modules/pino-pretty/index.js:8:16)
at Object.<anonymous> (node_modules/@pact-foundation/pact-core/src/logger/pino.ts:2:1)
at Object.<anonymous> (node_modules/@pact-foundation/pact-core/src/logger/index.ts:2:1)
at Object.<anonymous> (node_modules/@pact-foundation/pact-core/src/spawn/spawn.ts:5:1)
at Object.<anonymous> (node_modules/@pact-foundation/pact-core/src/spawn/index.ts:1:1)
at Object.<anonymous> (node_modules/@pact-foundation/pact-core/src/service.ts:11:1)
at Object.<anonymous> (node_modules/@pact-foundation/pact-core/src/server.ts:6:1)
at Object.<anonymous> (node_modules/@pact-foundation/pact-core/src/pact.ts:5:1)
at Object.<anonymous> (node_modules/@pact-foundation/pact-core/src/index.ts:1:1)
at Object.<anonymous> (node_modules/@pact-foundation/src/httpPact/index.ts:1:1)
at Object.<anonymous> (node_modules/@pact-foundation/src/index.ts:25:1)
at Object.<anonymous> (tests/overview.js:2:23)
at Object.<anonymous> (tests/pact.test.js:3:1)
We've tried to use Pact JS v9.11.1, this version can run properly in Umi(v3.5), but the matching rules in PactV2 can't meet our needs. So we want to use PactV3 in our project. In addition, Pact JS v12.1.0 can run in Umi4, but it's difficult for us to upgrade the old project.
Steps to reproduce
Do you know why it works with Umi4 and not Umi3? If there is a way we can make it work for you, a PR would be nice.
It sounds like it has something to do with Umi. If it's using a transpiler that could be part of the challenge. The library in which that function is being called (pino
and pino-pretty
) use ES modules, so that could be it.
Whilst I appreciate the repro project (thank you!), because the issue appears to be with Umi (or at least, related to it) that would fall outside of the reasonable scope of support here - i.e. the details of why it works with one framework and not another are not something you could expect a maintainer of Pact to review.
Do you know why it works with Umi4 and not Umi3? If there is a way we can make it work for you, a PR would be nice.
It sounds like it has something to do with Umi. If it's using a transpiler that could be part of the challenge. The library in which that function is being called (
pino
andpino-pretty
) use ES modules, so that could be it.Whilst I appreciate the repro project (thank you!), because the issue appears to be with Umi (or at least, related to it) that would fall outside of the reasonable scope of support here - i.e. the details of why it works with one framework and not another are not something you could expect a maintainer of Pact to review.
Thank you very much for your reply!!!
I'm sorry I don't know the reason why it works with Umi4 and not Umi3. It seems like I need to ask this question in Umi. If I find something, I'll add it in the comments.