Merge pull request #38 from Brooooooklyn/node14

ci: add node14 to test matrix
This commit is contained in:
LongYinan 2020-04-30 18:50:58 +08:00 committed by GitHub
commit 4b52a40206
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 22 deletions

View file

@ -7,7 +7,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
node: ['10', '12', '13'] node: ['10', '12', '13', '14']
version: version:
- stable - stable
- nightly - nightly

View file

@ -7,7 +7,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
node: ['10', '12', '13'] node: ['10', '12', '13', '14']
version: version:
- stable - stable
- nightly - nightly

View file

@ -7,7 +7,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
node: ['10', '12', '13'] node: ['10', '12', '13', '14']
version: version:
- stable - stable
- nightly - nightly

View file

@ -16,9 +16,9 @@
## NodeJS ## NodeJS
| Node10 | Node 12 | Node13 | | Node10 | Node 12 | Node13 | Node14 |
| --------- | --------- | --------- | | ------ | ------- | ------ | ------ |
| ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ |
A minimal library for building compiled Node add-ons in Rust. A minimal library for building compiled Node add-ons in Rust.

View file

@ -5,7 +5,7 @@ extern crate napi_rs_derive;
extern crate futures; extern crate futures;
use napi::{Any, Env, Error, Object, Result, Status, Value, CallContext}; use napi::{Any, CallContext, Env, Error, Object, Result, Status, Value};
register_module!(test_module, init); register_module!(test_module, init);
@ -13,21 +13,13 @@ fn init<'env>(
env: &'env Env, env: &'env Env,
exports: &'env mut Value<'env, Object>, exports: &'env mut Value<'env, Object>,
) -> Result<Option<Value<'env, Object>>> { ) -> Result<Option<Value<'env, Object>>> {
exports.set_named_property( exports.set_named_property("testSpawn", env.create_function("testSpawn", test_spawn)?)?;
"testSpawn", exports.set_named_property("testThrow", env.create_function("testThrow", test_throw)?)?;
env.create_function("testSpawn", test_spawn)?,
)?;
exports.set_named_property(
"testThrow",
env.create_function("testThrow", test_throw)?,
)?;
Ok(None) Ok(None)
} }
#[js_function] #[js_function]
fn test_spawn<'a>( fn test_spawn<'a>(ctx: CallContext<'a>) -> Result<Value<'a, Object>> {
ctx: CallContext<'a>
) -> Result<Value<'a, Object>> {
use futures::executor::ThreadPool; use futures::executor::ThreadPool;
use futures::StreamExt; use futures::StreamExt;
let env = ctx.env; let env = ctx.env;
@ -37,7 +29,7 @@ fn test_spawn<'a>(
let (tx, rx) = futures::channel::mpsc::unbounded::<i32>(); let (tx, rx) = futures::channel::mpsc::unbounded::<i32>();
let fut_values = async move { let fut_values = async move {
let fut_tx_result = async move { let fut_tx_result = async move {
(0..100).for_each(|v| { (0..20).for_each(|v| {
tx.unbounded_send(v).expect("Failed to send"); tx.unbounded_send(v).expect("Failed to send");
}) })
}; };
@ -60,8 +52,6 @@ fn test_spawn<'a>(
} }
#[js_function] #[js_function]
fn test_throw<'a>( fn test_throw<'a>(_ctx: CallContext<'a>) -> Result<Value<'a, Any>> {
_ctx: CallContext<'a>,
) -> Result<Value<'a, Any>> {
Err(Error::new(Status::GenericFailure)) Err(Error::new(Status::GenericFailure))
} }