-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
👍 denops#plugin#check_type()
shows 'no plugins are loaded' message
#407
Conversation
WalkthroughThe recent changes enhance the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Include tests for c1686ac.
b205ab5
to
33ff712
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (3)
tests/denops/runtime/functions/plugin/reload_test.ts (1)
11-11
: Clarify the unit ofMESSAGE_DELAY
.The comment indicates
msc
, which seems to be a typo. It should bems
for milliseconds.- const MESSAGE_DELAY = 200; // msc + const MESSAGE_DELAY = 200; // mstests/denops/runtime/functions/plugin/load_test.ts (1)
11-11
: Clarify the unit ofMESSAGE_DELAY
.The comment indicates
msc
, which seems to be a typo. It should bems
for milliseconds.- const MESSAGE_DELAY = 200; // msc + const MESSAGE_DELAY = 200; // mstests/denops/runtime/functions/plugin/wait_test.ts (1)
14-14
: Clarify the unit ofMESSAGE_DELAY
.The comment indicates
msc
, which seems to be a typo. It should bems
for milliseconds.- const MESSAGE_DELAY = 200; // msc + const MESSAGE_DELAY = 200; // ms
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (10)
- autoload/denops/plugin.vim (1 hunks)
- doc/denops.txt (1 hunks)
- tests/denops/runtime/functions/plugin/check_type_test.ts (1 hunks)
- tests/denops/runtime/functions/plugin/discover_test.ts (1 hunks)
- tests/denops/runtime/functions/plugin/is_loaded_test.ts (1 hunks)
- tests/denops/runtime/functions/plugin/load_test.ts (1 hunks)
- tests/denops/runtime/functions/plugin/reload_test.ts (1 hunks)
- tests/denops/runtime/functions/plugin/unload_test.ts (1 hunks)
- tests/denops/runtime/functions/plugin/wait_async_test.ts (1 hunks)
- tests/denops/runtime/functions/plugin/wait_test.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- doc/denops.txt
Additional comments not posted (90)
tests/denops/runtime/functions/plugin/discover_test.ts (7)
1-9
: LGTM!The imports and constants are correctly set up for the test case.
15-20
: Approve the test host setup.The test host setup is comprehensive and correctly initializes the necessary components.
38-48
: Approve the plugin loading verification.The step correctly verifies that the denops plugins are loaded by checking the events.
50-60
: Approve the event firing verification.The step correctly verifies that the
DenopsPlugin*
events are fired as expected.
62-71
: Approve the invalid plugin name verification.The step correctly verifies that invalid plugin names are not loaded.
73-75
: Approve the plugin entrypoint verification.The step correctly verifies that the plugin entrypoint is called.
77-83
: Approve the error message verification.The step correctly verifies that an error message is output after a delay.
autoload/denops/plugin.vim (8)
Line range hint
1-3
:
Approve thedenops#plugin#is_loaded
function.The function correctly checks if a plugin is loaded or failed.
Line range hint
5-21
:
Approve thedenops#plugin#wait
function.The function correctly waits for a plugin to be loaded with proper error handling and timeout management.
Line range hint
23-31
:
Approve thedenops#plugin#wait_async
function.The function correctly waits for a plugin to be loaded asynchronously with proper callback handling.
Line range hint
33-35
:
Approve thedenops#plugin#load
function.The function correctly loads a plugin with the given name and script.
Line range hint
37-39
:
Approve thedenops#plugin#unload
function.The function correctly unloads a plugin with the given name.
Line range hint
41-43
:
Approve thedenops#plugin#reload
function.The function correctly reloads a plugin with the given name.
Line range hint
45-55
:
Approve thedenops#plugin#discover
function.The function correctly discovers plugins in the runtime path with proper handling of valid plugin names and file readability.
Line range hint
57-88
:
Approve thedenops#plugin#check_type
function.The function correctly checks the type of plugins with improved readability and user feedback.
However, ensure that the function usage matches the updated implementation.
Verification successful
No other usages of
denops#plugin#check_type
found.The function
denops#plugin#check_type
is correctly implemented and there are no other usages of this function in the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `denops#plugin#check_type` match the updated implementation. # Test: Search for the function usage. Expect: Only occurrences of the updated implementation. rg --type vim -A 5 $'denops#plugin#check_type'Length of output: 387
tests/denops/runtime/functions/plugin/check_type_test.ts (11)
1-9
: LGTM!The imports and constants are correctly set up for the test case.
12-27
: Approve the test host setup.The test host setup is comprehensive and correctly initializes the necessary components.
29-40
: Approve the no plugins loaded scenario.The step correctly verifies that an info message is output when no plugins are loaded.
42-56
: Approve the some plugins loaded scenario.The step correctly verifies that a type check message is output when some plugins are loaded.
58-76
: Approve the invalid plugins scenario.The step correctly verifies that an error message is output when invalid plugins are tried to load.
79-87
: Approve the invalid plugin name scenario.The step correctly verifies that an error is thrown when an invalid plugin name is specified.
90-104
: Approve the not yet loaded plugin scenario.The step correctly verifies that an info message is output when a plugin is not yet loaded.
106-124
: Approve the not exists plugin scenario.The step correctly verifies that an error message is output when a plugin does not exist.
126-147
: Approve the loaded plugin scenario.The step correctly verifies that a type check message is output when a plugin is loaded.
149-179
: Approve the unloaded plugin scenario.The step correctly verifies that a type check message is output when a plugin is unloaded.
181-211
: Approve the reloaded plugin scenario.The step correctly verifies that a type check message is output when a plugin is reloaded.
tests/denops/runtime/functions/plugin/is_loaded_test.ts (8)
31-39
: Test case for invalid plugin name looks good.The test correctly verifies that an error is thrown for an invalid plugin name.
42-50
: Test case for unloaded plugin looks good.The test correctly verifies that the function returns 0 when the plugin is not loaded.
52-89
: Comprehensive test case for plugin entrypoint errors looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
91-137
: Comprehensive test case for plugin dispose method errors looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
139-183
: Comprehensive test case for plugin loading looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
185-237
: Comprehensive test case for plugin unloading looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
240-309
: Comprehensive test case for plugin reloading looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
313-316
:resolve
function implementation looks good.The function correctly constructs the path to test data scripts.
tests/denops/runtime/functions/plugin/wait_async_test.ts (8)
32-43
: Test case for invalid plugin name looks good.The test correctly verifies that an error is thrown for an invalid plugin name.
46-84
: Comprehensive test case for asynchronous plugin loading looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
86-119
: Comprehensive test case for plugin loading looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
122-152
: Comprehensive test case for already loaded plugin looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
155-197
: Comprehensive test case for plugin reloading looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
201-241
: Comprehensive test case for already reloaded plugin looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
244-273
: Comprehensive test case for plugin loading failures looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
275-308
: Comprehensive test case for plugin load failures looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
tests/denops/runtime/functions/plugin/unload_test.ts (8)
33-42
: Test case for invalid plugin name looks good.The test correctly verifies that an error is thrown for an invalid plugin name.
44-67
: Comprehensive test case for unloaded plugin looks good.The test covers various scenarios and ensures correct return values.
69-106
: Comprehensive test case for plugin dispose method errors looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
108-135
: Comprehensive test case for plugin loading looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
137-171
: Comprehensive test case for already loaded plugin looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
173-219
: Comprehensive test case for plugin unloading looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
221-263
: Comprehensive test case for already unloaded plugin looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
265-313
: Comprehensive test case for plugin reloading looks good.The test covers various stages of the plugin lifecycle and ensures correct return values.
tests/denops/runtime/functions/plugin/reload_test.ts (12)
1-7
: Ensure import paths are correct and dependencies are up-to-date.The imports from
jsr:@std
and/denops-testutil
should be verified to ensure they are correct and up-to-date. If these paths are incorrect, the tests will fail to run.
13-14
: Verify the script paths.Ensure that the paths to
dummy_valid_plugin.ts
anddummy_invalid_dispose_plugin.ts
are correct and the files exist in the specified location.
16-21
: Good structure for test setup.The
testHost
function is well-structured, setting up the test environment and specifying the postlude script.
33-42
: Test case for invalid plugin name is well-implemented.The test case correctly checks for an error when an invalid plugin name is provided. The usage of
assertRejects
with the expected error message is appropriate.
44-67
: Test case for non-loaded plugin is comprehensive.The test case covers multiple scenarios for a plugin that is not yet loaded, including checking for no reload, no events, and no output messages. The use of
assertRejects
andassertEquals
is appropriate.
69-107
: Test case for plugin with throwing dispose method is thorough.The test case handles a plugin whose dispose method throws an error. It checks for reloading, event firing, and error message output. The use of
assertMatch
to check the error message is appropriate.
110-140
: Test case for loading plugin is well-structured.The test case covers scenarios for a plugin that is currently loading, including reloading, event firing, and entry point calls. The use of
assertMatch
to check the output is appropriate.
142-178
: Test case for loaded plugin is comprehensive.The test case covers scenarios for a plugin that is already loaded, including reloading, event firing, and entry point calls. The use of
assertMatch
to check the output is appropriate.
180-219
: Test case for unloading plugin is thorough.The test case handles scenarios for a plugin that is currently unloading, including checking for no reload, event firing, and output messages. The use of
assertMatch
to check the output is appropriate.
221-293
: Test case for unloaded plugin is comprehensive.The test case covers scenarios for a plugin that is already unloaded, including reloading, event firing, and entry point calls. The use of
assertMatch
to check the output is appropriate.
315-361
: Test case for reloaded plugin is comprehensive.The test case covers scenarios for a plugin that is already reloaded, including waiting for the plugin to load, returning the correct result, and event firing. The use of
assertMatch
to check the output is appropriate.
364-367
: Resolve function is well-implemented.The
resolve
function correctly constructs the path to the test data scripts. Ensure that the paths are correct and the files exist.tests/denops/runtime/functions/plugin/load_test.ts (14)
1-7
: Ensure import paths are correct and dependencies are up-to-date.The imports from
jsr:@std
and/denops-testutil
should be verified to ensure they are correct and up-to-date. If these paths are incorrect, the tests will fail to run.
13-15
: Verify the script paths.Ensure that the paths to
dummy_valid_plugin.ts
,dummy_invalid_plugin.ts
, anddummy_valid_dispose_plugin.ts
are correct and the files exist in the specified location.
17-22
: Good structure for test setup.The
testHost
function is well-structured, setting up the test environment and specifying the postlude script.
34-43
: Test case for invalid plugin name is well-implemented.The test case correctly checks for an error when an invalid plugin name is provided. The usage of
assertRejects
with the expected error message is appropriate.
45-69
: Test case for non-loaded plugin is comprehensive.The test case covers multiple scenarios for a plugin that is not yet loaded, including checking for loading, event firing, and entry point calls. The use of
assertMatch
to check the output is appropriate.
71-99
: Test case for plugin with throwing entrypoint is thorough.The test case handles a plugin whose entrypoint throws an error. It checks for loading failure, event firing, and error message output. The use of
assertMatch
to check the error message is appropriate.
101-127
: Test case for same script with different name is well-structured.The test case covers scenarios for loading the same script with a different name, including event firing and entry point calls. The use of
assertMatch
to check the output is appropriate.
130-166
: Test case for loading plugin is comprehensive.The test case covers scenarios for a plugin that is currently loading, including checking for no double loading, event firing, and entry point calls. The use of
assertMatch
to check the output is appropriate.
168-201
: Test case for loaded plugin is thorough.The test case handles scenarios for a plugin that is already loaded, including checking for no double loading, event firing, and output messages. The use of
assertMatch
to check the output is appropriate.
203-248
: Test case for unloading plugin is comprehensive.The test case covers scenarios for a plugin that is currently unloading, including unloading, event firing, and dispose method calls. The use of
assertMatch
to check the output is appropriate.
250-293
: Test case for unloaded plugin is well-structured.The test case covers scenarios for a plugin that is already unloaded, including reloading, event firing, and entry point calls. The use of
assertMatch
to check the output is appropriate.
295-343
: Test case for reloading plugin is comprehensive.The test case covers scenarios for a plugin that is currently reloading, including waiting for the plugin to load, returning the correct result, and event firing. The use of
assertMatch
to check the output is appropriate.
345-387
: Test case for reloaded plugin is thorough.The test case handles scenarios for a plugin that is already reloaded, including waiting for the plugin to load, returning the correct result, and event firing. The use of
assertMatch
to check the output is appropriate.
391-394
: Resolve function is well-implemented.The
resolve
function correctly constructs the path to the test data scripts. Ensure that the paths are correct and the files exist.tests/denops/runtime/functions/plugin/wait_test.ts (14)
1-11
: Ensure import paths are correct and dependencies are up-to-date.The imports from
jsr:@std
and/denops-testutil
should be verified to ensure they are correct and up-to-date. If these paths are incorrect, the tests will fail to run.
16-19
: Verify the script paths.Ensure that the paths to
dummy_valid_plugin.ts
,dummy_invalid_plugin.ts
,dummy_valid_wait_plugin.ts
, anddummy_invalid_wait_plugin.ts
are correct and the files exist in the specified location.
21-26
: Good structure for test setup.The
testHost
function is well-structured, setting up the test environment and specifying the postlude script.
38-47
: Test case for invalid plugin name is well-implemented.The test case correctly checks for an error when an invalid plugin name is provided. The usage of
assertRejects
with the expected error message is appropriate.
49-81
: Test case for loading plugin is comprehensive.The test case covers scenarios for a plugin that is currently loading, including waiting for the plugin to load, returning the correct result, and event firing. The use of
assertArrayIncludes
to check the events is appropriate.
83-115
: Test case for loaded plugin is thorough.The test case handles scenarios for a plugin that is already loaded, including waiting for the plugin to load, returning the correct result, and event firing. The use of
assertLess
to check the elapsed time is appropriate.
117-159
: Test case for reloading plugin is comprehensive.The test case covers scenarios for a plugin that is currently reloading, including waiting for the plugin to load, returning the correct result, and event firing. The use of
assertArrayIncludes
to check the events is appropriate.
161-201
: Test case for reloaded plugin is well-structured.The test case covers scenarios for a plugin that is already reloaded, including waiting for the plugin to load, returning the correct result, and event firing. The use of
assertLess
to check the elapsed time is appropriate.
204-236
: Test case for loading and failing plugin is thorough.The test case handles scenarios for a plugin that is loading and fails, including waiting for the plugin to fail, returning the correct result, and event firing. The use of
assertArrayIncludes
to check the events is appropriate.
238-272
: Test case for failed plugin is comprehensive.The test case covers scenarios for a plugin that has failed to load, including waiting for the plugin to fail, returning the correct result, and event firing. The use of
assertLess
to check the elapsed time is appropriate.
274-337
: Test case for timeout scenarios is well-implemented.The test case handles scenarios where the plugin wait times out, including checking for the correct result and output messages. The use of
assertStringIncludes
to check the error message is appropriate.
341-355
: Test case for internal timeout is thorough.The test case covers scenarios where the internal timeout expires, including checking for the correct result and warning messages. The use of
assertStringIncludes
to check the warning message is appropriate.
357-425
: Test case for stopped server is comprehensive.The test case handles scenarios where the Denops server is stopped, including checking for the correct result and output messages. The use of
assertStringIncludes
to check the error message is appropriate.
431-433
: Resolve function is well-implemented.The
resolve
function correctly constructs the path to the test data scripts. Ensure that the paths are correct and the files exist.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #407 +/- ##
==========================================
- Coverage 95.52% 95.44% -0.08%
==========================================
Files 23 23
Lines 1384 1384
Branches 174 174
==========================================
- Hits 1322 1321 -1
- Misses 59 60 +1
Partials 3 3 ☔ View full report in Codecov by Sentry. |
Fixes #406
Include to split functions/plugin tests. But test codes only changed for
denops#plugin#check_type()
.Why is a split test included? Because splitting it revealed this bug.
Summary by CodeRabbit
New Features
Bug Fixes
Tests