Fix test errors in node 12+

(cherry picked from commit 839dbf96677156b719a7b073ab0e9076c4c4d40e)
This commit is contained in:
wk333 2022-04-11 17:12:44 +08:00 committed by openeuler-sync-bot
parent 1eb4bffdeb
commit aa8645a8f4
2 changed files with 24 additions and 1 deletions

19
node-gyp-node12.patch Normal file
View File

@ -0,0 +1,19 @@
commit 89a002e41ee6e4ba590335d5eb2226d179daf20e
Author: Tom Hughes <tom@compton.nu>
Date: Fri Jul 26 08:57:22 2019 +0100
Fix tests for changes in Node.js 12.x
diff --git a/test/node_modules/hello_world/hello.cc b/test/node_modules/hello_world/hello.cc
index 89bfd7a..7065896 100644
--- a/test/node_modules/hello_world/hello.cc
+++ b/test/node_modules/hello_world/hello.cc
@@ -6,7 +6,7 @@ void Method(const Nan::FunctionCallbackInfo<v8::Value>& info) {
void Init(v8::Local<v8::Object> exports) {
exports->Set(Nan::New("hello").ToLocalChecked(),
- Nan::New<v8::FunctionTemplate>(Method)->GetFunction());
+ Nan::GetFunction(Nan::New<v8::FunctionTemplate>(Method)).ToLocalChecked());
}
NODE_MODULE(hello, Init)

View File

@ -1,7 +1,7 @@
%{?nodejs_find_provides_and_requires}
Name: node-gyp
Version: 3.6.0
Release: 3
Release: 4
Summary: Node.js native addon build tool
License: MIT
URL: https://github.com/nodejs/node-gyp
@ -11,6 +11,7 @@ Patch1: node-gyp-addon-gypi.patch
Patch2: node-gyp-system-gyp.patch
Patch3: node-gyp-python.patch
Patch4: node-gyp-python3.patch
Patch5: node-gyp-node12.patch
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
Requires: gyp nodejs-devel libuv-devel http-parser-devel gcc-c++
@ -51,6 +52,9 @@ ln -sf ../lib/node_modules/node-gyp/bin/node-gyp.js %{buildroot}%{_bindir}/node-
%{_bindir}/node-gyp
%changelog
* Mon Apr 11 2022 wangkai <wangkai385@h-partners.com> - 3.6.0-4
- Fix test errors in node 12+
* Thu Jan 21 2021 lingsheng <lingsheng@huawei.com> - 3.6.0-3
- Limit npm(nan) version to fix test errors