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

fix: Always explicitly exit() to avoid hangs #51

Merged
merged 2 commits into from
Jan 18, 2023

Conversation

maranomynet
Copy link
Contributor

@maranomynet maranomynet commented Sep 23, 2022

Description

Fixes this problem:

import o from 'ospec';

o.spec('This dangling setInterval', () => {
  setInterval(() => undefined, 100);

  o('causes ospec to hang', () => {
    o(true).equals(true);
  });
});

Motivation and Context

Tests that import code from 3rd party libraries can cause ospec to unexpectedly hang, even though your own code and tests are perfectly fine.

How Has This Been Tested?

By pasting the above code into a file called hangtest.mjs and running ospec hangtest.mjs.

Without the fix the process doesn't exit.

With the fix it exits like normal.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation change

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read all applicable contributing documents.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the change log (if applicable).

BTW: I Can't get the package tests to pass locally (MacOS 12.5) — not even on the untouched main branch:

git clone git@github.com:MithrilJS/ospec.git
cd ospec
git checkout main  # Already on 'main'
yarn install
yarn run test
# 30 out of 4024 assertions failed
yarn run self-test
# 30 out of 4024 assertions failed

@maranomynet maranomynet marked this pull request as ready for review September 23, 2022 13:53
Fixes this:
```js
o.spec('This dangling setInterval', () => {
  setInterval(() => undefined, 100);
  o.only('causes ospec to hang', () => {
    o(true).equals(true);
  });
});
```
@maranomynet
Copy link
Contributor Author

yarn patch ospec is currently saving my a**. 😅

@maranomynet
Copy link
Contributor Author

maranomynet commented Jan 12, 2023

Any comments @pygy ?

@pygy
Copy link
Member

pygy commented Jan 17, 2023

That sounds good, could you push a dummy commit to re-launch CI? The logs have expired, and I can't find how to relaunch these jobs (neither can I relaunch old Mithril jobs, so it could be an expiration thing here too).

@maranomynet
Copy link
Contributor Author

Pushed a trivial fix to the README, for luck.

@pygy
Copy link
Member

pygy commented Jan 18, 2023

Merging, I'll publish a new version this evening and investigate where pnpm fails.

@pygy
Copy link
Member

pygy commented Jan 18, 2023

Many thanks for raising the issue and providing a patch.

@pygy pygy merged commit dbae999 into MithrilJS:main Jan 18, 2023
@pygy
Copy link
Member

pygy commented Jan 20, 2023

@maranomynet @v4.1.7 is out

@maranomynet
Copy link
Contributor Author

Thank you.

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

2 participants