summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/ops/plugins.rs3
-rw-r--r--test_plugin/tests/test.js19
2 files changed, 21 insertions, 1 deletions
diff --git a/cli/ops/plugins.rs b/cli/ops/plugins.rs
index 2673e3d6a..258cd2764 100644
--- a/cli/ops/plugins.rs
+++ b/cli/ops/plugins.rs
@@ -86,7 +86,8 @@ pub fn op_open_plugin(
// The inclusion of prefix and rid is designed to avoid any
// op name collision beyond the bound of a single loaded
// plugin instance.
- let op_id = registry.register(&format!("plugin_{}_{}", rid, op.0), op.1);
+ let op_id = registry
+ .register(&format!("plugin_{}_{}", rid, op.0), state.core_op(op.1));
plugin_resource.ops.insert(op.0, op_id);
}
diff --git a/test_plugin/tests/test.js b/test_plugin/tests/test.js
index 5a127d328..cdbde4769 100644
--- a/test_plugin/tests/test.js
+++ b/test_plugin/tests/test.js
@@ -43,5 +43,24 @@ function runTestAsync() {
}
}
+function runTestOpCount() {
+ const start = Deno.metrics();
+
+ testSync.dispatch(new Uint8Array([116, 101, 115, 116]));
+
+ const end = Deno.metrics();
+
+ if (end.opsCompleted - start.opsCompleted !== 2) {
+ // one op for the plugin and one for Deno.metrics
+ throw new Error("The opsCompleted metric is not correct!");
+ }
+ if (end.opsDispatched - start.opsDispatched !== 2) {
+ // one op for the plugin and one for Deno.metrics
+ throw new Error("The opsDispatched metric is not correct!");
+ }
+}
+
runTestSync();
runTestAsync();
+
+runTestOpCount();