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

lib/stateを使用しているテストでmockを使用するよう修正 #844

Merged
merged 1 commit into from Aug 1, 2023

Conversation

hakatashi
Copy link
Member

Jestの open handle error が表示される確率が下がります。たぶん

↓こういうの

$ npm test -- achievements

> slackbot@1.0.0 test
> jest --verbose --detectOpenHandles --forceExit achievements

 PASS  achievements/achievements.test.ts (20.418 s)
  achievements
    ✓ all ids are unique (10 ms)
    ✓ all titles are unique (1 ms)
    ✓ no isolated category exists (10 ms)
    ✓ value is defined if counter is defined (21 ms)

 PASS  achievements/index_production.test.ts
  achievements
    ✓ unlock chat achievement when chat is posted (18 ms)

Test Suites: 2 passed, 2 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        21.666 s, estimated 22 s
Ran all test suites matching /achievements/i.

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  ●  Timeout

      31 | };
      32 |
    > 33 | schedule.scheduleJob('0 * * * *', (date) => {
         |          ^
      34 |         logger.info(`Firestore usage at ${date}: ${inspect(usageCount)}`);
      35 |         usageCount.clear();
      36 | });

      at Timeout.Object.<anonymous>.Timeout.start (node_modules/long-timeout/index.js:41:20)
      at new Timeout (node_modules/long-timeout/index.js:22:8)
      at Object.<anonymous>.exports.setTimeout (node_modules/long-timeout/index.js:5:10)
      at runOnDate (node_modules/node-schedule/lib/Invocation.js:224:13)
      at prepareNextInvocation (node_modules/node-schedule/lib/Invocation.js:251:33)
      at scheduleInvocation (node_modules/node-schedule/lib/Invocation.js:234:3)
      at scheduleNextRecurrence (node_modules/node-schedule/lib/Invocation.js:334:3)
      at Job.Object.<anonymous>.Job.schedule (node_modules/node-schedule/lib/Job.js:218:11)
      at Object.scheduleJob (node_modules/node-schedule/lib/schedule.js:39:11)
      at Object.<anonymous> (lib/state.ts:33:10)
      at Object.<anonymous> (achievements/index_production.ts:11:1)
      at Object.<anonymous> (achievements/index_production.test.ts:8:1)

@hakatashi hakatashi self-assigned this Aug 1, 2023
@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.02% ⚠️

Comparison is base (adaa6fa) 23.32% compared to head (2cb8f74) 23.31%.
Report is 1 commits behind head on master.

❗ Current head 2cb8f74 differs from pull request most recent head 8c2a4db. Consider uploading reports for the commit 8c2a4db to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #844      +/-   ##
==========================================
- Coverage   23.32%   23.31%   -0.02%     
==========================================
  Files         173      173              
  Lines       15264    15264              
  Branches     3489     3489              
==========================================
- Hits         3561     3559       -2     
- Misses      10296    10298       +2     
  Partials     1407     1407              

see 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hakatashi hakatashi merged commit 4c4b817 into master Aug 1, 2023
5 checks passed
@hakatashi hakatashi deleted the add-lib-state-mocks branch August 1, 2023 13:36
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.

None yet

3 participants