Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): remove unused cpx dependencies and update used ones to cpx2 #4510

Merged

Conversation

pichlermarc
Copy link
Member

Which problem is this PR solving?

  • replaces cpx with cpx2 where it's used, removes cpx where it's not used anymore.

Supersedes #4506

@pichlermarc pichlermarc added dependencies Pull requests that update a dependency file Skip Changelog labels Feb 27, 2024
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.84%. Comparing base (e49c4c7) to head (5136509).
Report is 9 commits behind head on main.

Current head 5136509 differs from pull request most recent head c3ba45d

Please upload reports for the commit c3ba45d to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4510      +/-   ##
==========================================
- Coverage   93.32%   92.84%   -0.49%     
==========================================
  Files          84      328     +244     
  Lines        1694     9481    +7787     
  Branches      349     2031    +1682     
==========================================
+ Hits         1581     8803    +7222     
- Misses        113      678     +565     

see 269 files with indirect coverage changes

@pichlermarc
Copy link
Member Author

pichlermarc commented Feb 27, 2024

Keeping as draft as I'll have to try that out on windows.
Edit: started working after a branch update

@pichlermarc pichlermarc marked this pull request as ready for review March 6, 2024 12:38
@pichlermarc pichlermarc requested a review from a team as a code owner March 6, 2024 12:38
Copy link
Contributor

@trentm trentm left a comment

Choose a reason for hiding this comment

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

LGTM.

(It looks like cpx2 is only used as a test package for RequireInTheMiddleSingleton, so picking some other module, or manually creating a local module in a fixtures/ subdir and using that directly would work as well. However, using cpx2 seems fine.)

@pichlermarc
Copy link
Member Author

LGTM.

(It looks like cpx2 is only used as a test package for RequireInTheMiddleSingleton, so picking some other module, or manually creating a local module in a fixtures/ subdir and using that directly would work as well. However, using cpx2 seems fine.)

Yep, opened a follow-up issue: #4533

@pichlermarc
Copy link
Member Author

Hmm, interestingly it failed on windows again. 🤔
converting back to draft.

@pichlermarc pichlermarc marked this pull request as draft March 8, 2024 14:43
@trentm
Copy link
Contributor

trentm commented Mar 9, 2024

The windows failure was a timeout:

  RequireInTheMiddleSingleton
    register
      ✔ should return a hooked object
      core module
        AND module name matches
          ✔ should call `onRequire`
        AND module name does not match
          ✔ should not call `onRequire`
      core module with sub-path
        AND module name matches
          ✔ should call `onRequire`
      non-core module
        AND module name matches
          ✔ should call `onRequire` (2809ms)
      non-core module with sub-path
        AND module name matches
          1) should call `onRequire`

  instrumenting a scoped package
    ✔ should patch internal file and main module (122ms)
    ✔ should patch main module


  50 passing (6s)
  1 failing

  1) RequireInTheMiddleSingleton
       register
         non-core module with sub-path
           AND module name matches
             should call `onRequire`:
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\opentelemetry-js\opentelemetry-js\experimental\packages\opentelemetry-instrumentation\test\node\RequireInTheMiddleSingleton.test.ts)
      at processImmediate (node:internal/timers:476:21)

I think mocha has a default timeout of 2s. Even running these tests locally on my dev macOS laptop, those particular test cases are slow:

  RequireInTheMiddleSingleton
    register
      ✔ should return a hooked object
      core module
        AND module name matches
          ✔ should call `onRequire`
        AND module name does not match
          ✔ should not call `onRequire`
      core module with sub-path
        AND module name matches
          ✔ should call `onRequire`
      non-core module
        AND module name matches
          ✔ should call `onRequire` (1043ms)
      non-core module with sub-path
        AND module name matches
          ✔ should call `onRequire` (582ms)

Also, interestingly, the preceding it('should call `onRequire`' test has an explicit timeout of 30s set. My guess is that was set originally to cope with a slow CI runner occasionally failing. So a suggestion would be to add a similar explicit longer timeout to avoid a flaky test:

diff --git a/experimental/packages/opentelemetry-instrumentation/test/node/RequireInTheMiddleSingleton.test.ts b/experimental/packages/opentelemetry-instrumentation/test/node/RequireInTheMiddleSingleton.test.ts
index 1ba41bd0..75cd0ad6 100644
--- a/experimental/packages/opentelemetry-instrumentation/test/node/RequireInTheMiddleSingleton.test.ts
+++ b/experimental/packages/opentelemetry-instrumentation/test/node/RequireInTheMiddleSingleton.test.ts
@@ -178,7 +178,7 @@ describe('RequireInTheMiddleSingleton', () => {
             modulePath,
             baseDir
           );
-        });
+        }).timeout(30000);
       });
     });
   });

Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label May 13, 2024
@github-actions github-actions bot removed the stale label May 20, 2024
@pichlermarc
Copy link
Member Author

Also, interestingly, the preceding it('should call `onRequire`' test has an explicit timeout of 30s set. My guess is that was set originally to cope with a slow CI runner occasionally failing. So a suggestion would be to add a similar explicit longer timeout to avoid a flaky test.

yep that seems to work, marking it as ready-to-review again.

@pichlermarc pichlermarc marked this pull request as ready for review May 27, 2024 12:34
@pichlermarc pichlermarc added this pull request to the merge queue May 28, 2024
Merged via the queue into open-telemetry:main with commit 82b7526 May 28, 2024
19 checks passed
@pichlermarc pichlermarc deleted the deps/cpx-replacement branch May 28, 2024 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file Skip Changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants