Add test script for Node

This commit is contained in:
Scott Kyle 2016-04-19 14:10:10 -07:00
parent 650950fe02
commit 2a58862070
3 changed files with 74 additions and 2 deletions

1
.gitignore vendored
View File

@ -95,7 +95,6 @@ build/
.rvmrc
# node.js
/binding.gyp
node_modules/
npm-debug.log

View File

@ -150,11 +150,30 @@ case "$TARGET" in
echo "********* File location: $(pwd)/tests.xml *********";
cat tests.xml
;;
"node")
pushd src/node
node-gyp configure
# Being explicit about debug mode rather than relying on defaults.
if [[ $CONFIGURATION == 'Debug' ]]; then
node-gyp build --debug
else
node-gyp build --no-debug
fi
popd
# Link to the appropriate module in the build directory.
mkdir -p build
ln -fs "../src/node/build/$CONFIGURATION/realm.node" build
node tests
;;
"object-store")
pushd src/object-store
cmake -DCMAKE_BUILD_TYPE=$CONFIGURATION .
make run-tests
;;
;;
*)
echo "Invalid target '${TARGET}'"
exit 1

54
src/node/binding.gyp Normal file
View File

@ -0,0 +1,54 @@
{
"targets": [
{
"target_name": "realm",
"sources": [
"node_init.cpp",
"../js_realm.cpp",
"../ios/platform.mm",
"../object-store/src/index_set.cpp",
"../object-store/src/list.cpp",
"../object-store/src/object_schema.cpp",
"../object-store/src/object_store.cpp",
"../object-store/src/results.cpp",
"../object-store/src/schema.cpp",
"../object-store/src/shared_realm.cpp",
"../object-store/src/impl/async_query.cpp",
"../object-store/src/impl/transact_log_handler.cpp",
"../object-store/src/impl/realm_coordinator.cpp",
"../object-store/src/impl/apple/external_commit_helper.cpp",
"../object-store/src/impl/apple/weak_realm_notifier.cpp",
"../object-store/src/parser/parser.cpp",
"../object-store/src/parser/query_builder.cpp"
],
"include_dirs": [
"..",
"../object-store/src",
"../object-store/src/impl",
"../object-store/src/impl/apple",
"../object-store/src/parser",
"../object-store/external/pegtl",
"../../core/include",
"../../node_modules/nan"
],
"library_dirs": [
"$(srcdir)/../../core"
],
"defines": ["REALM_HAVE_CONFIG"],
"cflags_cc": ["-fexceptions", "-frtti", "-std=c++14"],
"ldflags": ["-lrealm"],
"xcode_settings": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
"CLANG_CXX_LIBRARY": "libc++",
"MACOSX_DEPLOYMENT_TARGET": "10.8",
"OTHER_CPLUSPLUSFLAGS": ["-fexceptions", "-frtti"],
"OTHER_LDFLAGS": ["-lrealm", "-framework", "Foundation"]
},
"configurations": {
"Debug": {
"defines": ["DEBUG=1"]
}
}
}
]
}