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: cleanup tests and small fix on mockfs.bypass #320

Merged
merged 5 commits into from Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Expand Up @@ -28,11 +28,15 @@ jobs:
- 8
- 10
- 12
- 14
exclude:
# Temporarily excludes node 12 on windows
# Wait for https://github.com/nodejs/node/issues/34514
# Excludes nodejs v12 and v14 on windows
# https://github.com/nodejs/node/issues/34514
# It was patched in nodejs v15+.
- os: windows-latest
node: 12
- os: windows-latest
node: 14

steps:
- name: Clone repository
Expand Down
13 changes: 11 additions & 2 deletions lib/bypass.js
Expand Up @@ -19,8 +19,17 @@ exports = module.exports = function bypass(fn) {
try {
result = fn();
} finally {
if (result && typeof result.finally === 'function') {
result.finally(enable);
if (result && typeof result.then === 'function') {
result.then(
r => {
enable();
return r;
},
err => {
enable();
throw err;
}
);
} else {
enable();
}
Expand Down