Skip to content

Conversation

su-chang
Copy link
Member

I'm submitting a...

[ ] Bug Fix
[ ] Feature
[ ] Other (Refactoring, Added tests, Documentation, ...)

Checklist

  • Commit Messages follow the Conventional Commits pattern
    • A feature commit message is prefixed "feat:"
    • A bugfix commit message is prefixed "fix:"
  • Tests for the changes have been added

Description

please describe the changes that you are making

for features, please describe how to use the new feature

please include a reference to an existing issue, if applicable

Does this PR introduce a breaking change?

[ ] Yes
[ ] No

@su-chang su-chang requested a review from lijiarui as a code owner February 20, 2020 05:00
@su-chang
Copy link
Member Author

Related issue: #1914

Copy link
Member

@huan huan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sending this improvement!

I believe it will be good after you revert all modifications in the unit tests because we need to mock the puppet to confirm the system works.

@su-chang
Copy link
Member Author

In wechaty-puppet-mock will use FileBox from 'file-box', so we should import FileBox from wechaty-puppet?

@huan
Copy link
Member

huan commented Feb 20, 2020

Yes. As discussed with @windmemory, we should import FileBox from wechaty-puppet in everywhere, including the wechaty-puppet-mock.

@su-chang
Copy link
Member Author

So this PR will be test green after wechaty-puppet-mock PR merged? Right?

@huan
Copy link
Member

huan commented Feb 20, 2020

No, it cannot.

Because the unit test needs to instantiate a puppet for testing purposes.

@su-chang
Copy link
Member Author

But now it can not pass the CI test, could you give me some advices for this case?

@huan
Copy link
Member

huan commented Feb 20, 2020

Cloud you please make sure you can pass the unit tests in your local environment by running npm test?

After that, I believe you can pass the CI.

@su-chang
Copy link
Member Author

It can't, but the log of failed test show that:

Error: Cannot find module 'file-box'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPadplus/wechaty/node_modules/wechaty-puppet-mock/src/puppet-mock.ts:21:1)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/suchang/Desktop/PROJECT/Test/testPadplus/wechaty/node_modules/wechaty-puppet-mock/src/index.ts:1:1)

So I think this error maybe due to the FileBox in wechaty-puppet-mock is from file-box?

@huan
Copy link
Member

huan commented Feb 20, 2020

Yes. So I'd like to suggest that you can keep the dependencies of the file-box for now. I will remove it by later.

Copy link
Member

@huan huan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for make it passing the CI!

@huan huan merged commit b8a14b4 into wechaty:master Feb 20, 2020
@su-chang su-chang deleted the file-box branch June 30, 2020 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants