File tree Expand file tree Collapse file tree 8 files changed +41
-5
lines changed
metacall_typescript_tsx_test Expand file tree Collapse file tree 8 files changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ services:
5656 SERIAL_LIBRARY_PATH : $METACALL_PATH/build
5757 DETOUR_LIBRARY_PATH : $METACALL_PATH/build
5858 PORT_LIBRARY_PATH : $METACALL_PATH/build
59+ NODE_PATH : /usr/lib/node_modules
5960 depends_on :
6061 - deps
6162
Original file line number Diff line number Diff line change @@ -172,6 +172,6 @@ add_subdirectory(metacall_function_test)
172172add_subdirectory (metacall_cobol_test)
173173add_subdirectory (metacall_file_test)
174174add_subdirectory (metacall_typescript_test)
175- # add_subdirectory(metacall_typescript_tsx_test) # TODO: Implement dependency management for React and ReactDOM
175+ add_subdirectory (metacall_typescript_tsx_test)
176176add_subdirectory (metacall_lua_test)
177177add_subdirectory (metacall_rpc_test)
Original file line number Diff line number Diff line change @@ -4,6 +4,32 @@ if(NOT OPTION_BUILD_LOADERS OR NOT OPTION_BUILD_LOADERS_NODE OR NOT OPTION_BUILD
44 return ()
55endif ()
66
7+ #
8+ # External dependencies
9+ #
10+
11+ set (NODEJS_EXECUTABLE_ONLY ON )
12+
13+ find_package (NodeJS 10.22.0)
14+
15+ if (NOT NODEJS_FOUND)
16+ message (STATUS "NodeJS executable not found" )
17+ return ()
18+ endif ()
19+
20+ # Detect if React is available
21+ execute_process (
22+ COMMAND ${NODEJS_EXECUTABLE} -e "require('react'); require('react-dom')"
23+ RESULT_VARIABLE NODEJS_REACT_FOUND
24+ ERROR_QUIET
25+ OUTPUT_QUIET
26+ )
27+
28+ if ("${NODEJS_REACT_FOUND} " EQUAL "1" )
29+ message (WARNING "NodeJS React not found, skipping the TypeScript X templating test" )
30+ return ()
31+ endif ()
32+
733#
834# Executable name and options
935#
Original file line number Diff line number Diff line change 2323source ../../hooks/env
2424
2525# Base arguments
26- METACALL_INSTALL_OPTIONS=" root base python ruby netcore2 nodejs file rapidjson funchook swig" # v8rep51 pack and coverage not needed in DockerHub
26+ METACALL_INSTALL_OPTIONS=" root base python ruby netcore2 nodejs typescript file rapidjson funchook swig" # v8rep51 pack and coverage not needed in DockerHub
2727
2828# Base environment variables
2929DEBIAN_FRONTEND=noninteractive
Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ ENV LOADER_LIBRARY_PATH=$METACALL_PATH/build \
3838 SERIAL_LIBRARY_PATH=$METACALL_PATH/build \
3939 DETOUR_LIBRARY_PATH=$METACALL_PATH/build \
4040 PORT_LIBRARY_PATH=$METACALL_PATH/build \
41- DEBIAN_FRONTEND=noninteractive
41+ DEBIAN_FRONTEND=noninteractive \
42+ NODE_PATH=/usr/lib/node_modules
4243
4344# Define working directory
4445WORKDIR $METACALL_PATH
Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ sub_nodejs(){
9696# TypeScript
9797sub_typescript (){
9898 echo " clean typescript"
99+
100+ # Clear React dependencies of tests
101+ npm uninstall -g react@latest
102+ npm uninstall -g react-dom@latest
99103}
100104
101105# File
Original file line number Diff line number Diff line change @@ -275,7 +275,11 @@ sub_nodejs(){
275275
276276# TypeScript
277277sub_typescript (){
278- echo " configure typesecript"
278+ echo " configure typescript"
279+
280+ # Install React dependencies in order to run the tests
281+ npm i react@latest -g
282+ npm i react-dom@latest -g
279283}
280284
281285# File
Original file line number Diff line number Diff line change 2323source ../../hooks/env
2424
2525# Core arguments
26- METACALL_RUNTIME_OPTIONS=" root base python ruby netcore2 nodejs file ports clean" # v8
26+ METACALL_RUNTIME_OPTIONS=" root base python ruby netcore2 nodejs typescript file ports clean" # v8
2727
2828# Core environment variables
2929DEBIAN_FRONTEND=noninteractive
You can’t perform that action at this time.
0 commit comments