Fix travis build of example tests.
Example tests must have the examples built first.
This required upgrading the node-fs-extra package.
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -99,6 +99,16 @@ add_custom_target(
)
add_test(NAME get_data_files COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target data_files)
+add_custom_command(OUTPUT "${GEOJS_DEPLOY_DIR}/examples/bundle.js"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+ COMMAND npm run build-examples
+ COMMENT "Build examples"
+ VERBATIM
+)
+add_custom_target(examples DEPENDS "${GEOJS_DEPLOY_DIR}/examples/bundle.js")
+add_test(NAME build_examples COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target examples)
+set_property(TEST "build_examples" APPEND PROPERTY DEPENDS "get_data_files")
+
if(FFHEADLESS_TESTS)
find_program(NPM_EXECUTABLE npm)
add_test(
@@ -119,7 +129,7 @@ if(FFHEADLESS_TESTS)
set_property(TEST "examplesheadless" APPEND PROPERTY ENVIRONMENT "CTEST_IMAGE_PATH=${CMAKE_CURRENT_BINARY_DIR}/images")
set_property(TEST "examplesheadless" APPEND PROPERTY ENVIRONMENT "TEST_SAVE_IMAGE=${TEST_SAVE_IMAGE}")
set_property(TEST "total-coverage" APPEND PROPERTY DEPENDS "examplesheadless")
- set_property(TEST "examplesheadless" APPEND PROPERTY DEPENDS "get_data_files")
+ set_property(TEST "examplesheadless" APPEND PROPERTY DEPENDS "build_examples")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/testing/test-runners/baseline_images.py"
@@ -134,6 +144,8 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/base-images.tgz"
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target data_files
# Run the ffheadless test, asking to save all images
COMMAND TEST_SAVE_IMAGE=all npm run ffci
+ # Build examples to make sure that they are available.
+ COMMAND npm run build-examples
# Run the examplesheadless test, asking to save all images
COMMAND TEST_SAVE_IMAGE=all npm run examplesci
# Make a tarball of all of the images

MODIFY
package.json
package.json
"express": "^4.13.4",
"file-loader": "^0.8.5",
"forever": "^0.15.2",
+ "fs-extra": "^1.0.0",
"gl-mat3": "^1.0.0",
"gl-mat4": "^1.1.4",
"gl-vec2": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.7.0",
"mousetrap": "^1.6.0",
- "node-fs-extra": "^0.8.1",
"node-resemble": "^1.1.3",
"phantomjs-prebuilt": "^2.1.5",
"proj4": "^2.3.14",

MODIFY
testing/test-data/base-images.tgz.md5
testing/test-data/base-images.tgz.md5
-564b1810e1b404bbc758c10d2c72f604
\ No newline at end of file
+3a85dd50f321e7ac897b416eade4a5ab
\ No newline at end of file

MODIFY
testing/test-data/base-images.tgz.url
testing/test-data/base-images.tgz.url
-https://data.kitware.com/api/v1/file/586af8348d777f05f44a57ce/download
\ No newline at end of file
+https://data.kitware.com/api/v1/file/586ba6ed8d777f05f44a57d1/download
\ No newline at end of file

MODIFY
tests/example-cases/lines.js
tests/example-cases/lines.js
@@ -13,7 +13,7 @@ describe('lines example', function () {
imageTest.imageTest('exampleLines', '#map', 0.0015, done, null, 0, 2, '#map.ready');
}, 10000);
it('more lines', function (done) {
- base$ = $('iframe#map')[0].contentWindow.$;
+ base$ = $('iframe#map')[0].contentWindow.jQuery;
base$('#lines').val(100000).trigger('change');
imageTest.imageTest('exampleLines100k', '#map', 0.0015, done, null, 0, 2, '#map.ready');
}, 10000);

MODIFY
tests/image-test.js
tests/image-test.js
@@ -149,13 +149,13 @@ module.exports.imageTest = function (name, elemSelector, threshold, doneFunc, id
var selFunc = readyFunc;
var selWaitFunc;
selWaitFunc = function () {
- var base$ = $,
+ var baseJquery = $,
base = $('iframe#map');
if (base.length) {
- base$ = base[0].contentWindow.$;
+ baseJquery = base[0].contentWindow.jQuery;
}
- if (!base$ || !base$(readySelector).length) {
- window.setTimeout(selWaitFunc, 10);
+ if (!baseJquery || !baseJquery(readySelector).length) {
+ window.setTimeout(selWaitFunc, 50);
return;
}
selFunc();

Fix travis build of example tests.

Example tests must have the examples built first.

This required upgrading the node-fs-extra package.