From fb820f4b8124b9ba53754dff0db491c732aeed72 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Mon, 3 Jul 2017 16:34:28 -0600 Subject: [PATCH] Run tests on Firefox in Travis --- .travis.yml | 9 +------- Makefile | 48 +++++------------------------------------ package.json | 6 ++++-- test/karma.config.js | 51 ++------------------------------------------ 4 files changed, 12 insertions(+), 102 deletions(-) diff --git a/.travis.yml b/.travis.yml index 089ab6968d..e851feb2a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false language: node_js node_js: - - "6.1" + - "8" addons: firefox: "52.0" @@ -14,9 +14,6 @@ cache: env: - DISPLAY=:99.0 -before_install: - - "npm prune" - before_script: - "rm src/ol/renderer/webgl/*shader.js" - "sh -e /etc/init.d/xvfb start" @@ -24,10 +21,6 @@ before_script: script: "make ci" -after_success: - - "make test-coverage" - - "cat coverage/lcov.info | ./node_modules/.bin/coveralls" - branches: only: - master diff --git a/Makefile b/Makefile index 2aac3d0e20..32a6116174 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,6 @@ SRC_SHADER_JS := $(patsubst %shader.glsl,%shader.js,$(SRC_GLSL)) SRC_JS := $(filter-out $(SRC_SHADER_JS),$(shell find src -name '*.js')) SRC_JSDOC = $(shell find src -type f -name '*.jsdoc') -SPEC_JS := $(shell find test/spec -type f -name '*.js') -SPEC_RENDERING_JS := $(shell find test_rendering/spec -name '*.js') - EXAMPLES := $(shell find examples -type f) EXAMPLES_HTML := $(filter-out examples/index.html,$(shell find examples -maxdepth 1 -type f -name '*.html')) EXAMPLES_JS := $(patsubst %.html,%.js,$(EXAMPLES_HTML)) @@ -56,7 +53,6 @@ help: @echo "Other less frequently used targets are:" @echo @echo "- build Build ol.js, ol-debug.js, ol.js.map and ol.css" - @echo "- lint Check the code with the linter" @echo "- ci Run the full continuous integration process" @echo "- apidoc Build the API documentation using JSDoc" @echo "- cleanall Remove all the build artefacts" @@ -70,7 +66,7 @@ apidoc: build/timestamps/jsdoc-$(BRANCH)-timestamp build: build/ol.css build/ol.js build/ol-debug.js build/ol.js.map .PHONY: check -check: lint build/ol.js test +check: build/ol.js test .PHONY: check-examples check-examples: $(CHECK_EXAMPLE_TIMESTAMPS) @@ -86,21 +82,18 @@ check-deps: done ;\ .PHONY: ci -ci: lint build test test-rendering package compile-examples check-examples apidoc +ci: build test package compile-examples check-examples apidoc .PHONY: compile-examples compile-examples: build/compiled-examples/all.combined.js .PHONY: clean clean: - rm -f build/timestamps/eslint-timestamp rm -f build/timestamps/check-*-timestamp rm -f build/ol.css rm -f build/ol.js rm -f build/ol.js.map rm -f build/ol-debug.js - rm -f build/test_requires.js - rm -f build/test_rendering_requires.js rm -rf build/examples rm -rf build/compiled-examples rm -rf build/package @@ -119,9 +112,6 @@ examples: $(BUILD_EXAMPLES) .PHONY: install install: build/timestamps/node-modules-timestamp -.PHONY: lint -lint: build/timestamps/eslint-timestamp - .PHONY: npm-install npm-install: build/timestamps/node-modules-timestamp @@ -129,24 +119,12 @@ npm-install: build/timestamps/node-modules-timestamp shaders: $(SRC_SHADER_JS) .PHONY: serve -serve: build/test_requires.js build/test_rendering_requires.js +serve: node tasks/serve.js .PHONY: test -test: build/timestamps/node-modules-timestamp build/test_requires.js - node tasks/test.js - -.PHONY: test-coverage -test-coverage: build/timestamps/node-modules-timestamp - node tasks/test-coverage.js - -.PHONY: test-rendering -test-rendering: build/timestamps/node-modules-timestamp \ - build/test_rendering_requires.js - @rm -rf build/slimerjs-profile - @mkdir -p build/slimerjs-profile - @cp -r test_rendering/slimerjs-profile/* build/slimerjs-profile/ - node tasks/test-rendering.js +test: build/timestamps/node-modules-timestamp + npm test .PHONY: host-examples host-examples: $(BUILD_HOSTED_EXAMPLES) \ @@ -248,14 +226,6 @@ $(BUILD_HOSTED)/build/ol-deps.js: host-libraries --root_with_prefix "$(BUILD_HOSTED)/closure-library/third_party ../../third_party" \ --output_file $@ -build/timestamps/eslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \ - $(TASKS_JS) $(EXAMPLES_JS) \ - build/timestamps/node-modules-timestamp - @mkdir -p $(@D) - @echo "Running eslint..." - @./node_modules/.bin/eslint tasks test test_rendering src examples - @touch $@ - build/timestamps/node-modules-timestamp: package.json @mkdir -p $(@D) npm install @@ -291,14 +261,6 @@ build/ol-debug.js: config/ol-debug.json $(SRC_JS) $(SRC_SHADER_JS) \ @$(STAT_COMPRESSED) /tmp/ol-debug.js.gz @rm /tmp/ol-debug.js.gz -build/test_requires.js: $(SPEC_JS) $(SRC_JS) - @mkdir -p $(@D) - @node tasks/generate-requires.js $^ > $@ - -build/test_rendering_requires.js: $(SPEC_RENDERING_JS) - @mkdir -p $(@D) - @node tasks/generate-requires.js $^ > $@ - %shader.js: %shader.glsl src/ol/webgl/shader.mustache bin/pyglslunit.py build/timestamps/node-modules-timestamp @python bin/pyglslunit.py --input $< | ./node_modules/.bin/mustache - src/ol/webgl/shader.mustache > $@ diff --git a/package.json b/package.json index 91bec39a15..b6095cfc36 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,10 @@ "install": "node tasks/install.js", "postinstall": "closure-util update", "start": "node tasks/serve.js", - "pretest": "eslint tasks test src examples", + "lint": "eslint tasks test src examples", "lint-package": "eslint --fix build/package", - "test": "node tasks/test.js", + "pretest": "npm run lint", + "test": "npm run karma -- --single-run", "debug-server": "node tasks/serve-lib.js", "karma": "node tasks/test-all.js start test/karma.config.js" }, @@ -64,6 +65,7 @@ "jscodeshift": "^0.3.30", "karma": "^1.7.0", "karma-chrome-launcher": "^2.1.1", + "karma-firefox-launcher": "^1.0.1", "karma-mocha": "^1.3.0", "karma-sauce-launcher": "^1.1.0", "marked": "0.3.6", diff --git a/test/karma.config.js b/test/karma.config.js index 739d466bb0..e4c27cda52 100644 --- a/test/karma.config.js +++ b/test/karma.config.js @@ -1,4 +1,3 @@ -var pkg = require('../package.json'); var path = require('path'); /** @@ -48,55 +47,9 @@ module.exports = function(karma) { }); if (process.env.TRAVIS) { - if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) { - process.stderr.write('SAUCE_USERNAME or SAUCE_ACCESS_KEY not set\n'); - process.exit(1); - } - - // see https://wiki.saucelabs.com/display/DOCS/Platform+Configurator - // for platform and browserName options (Selenium API, node.js code) - var customLaunchers = { - SL_Chrome: { - base: 'SauceLabs', - browserName: 'chrome' - }, - SL_Firefox: { - base: 'SauceLabs', - browserName: 'firefox' - }, - SL_IE: { - base: 'SauceLabs', - platform: 'Windows 10', - browserName: 'internet explorer' - }, - SL_Edge: { - base: 'SauceLabs', - platform: 'Windows 10', - browserName: 'MicrosoftEdge' - }, - SL_Safari: { - base: 'SauceLabs', - platform: 'macos 10.12', - browserName: 'safari' - } - }; karma.set({ - sauceLabs: { - testName: pkg.name + ' ' + pkg.version, - recordScreenshots: false, - connectOptions: { - port: 5757 - }, - startConnect: false, - tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER, - username: process.env.SAUCE_USERNAME, - accessKey: process.env.SAUCE_ACCESS_KEY - }, - reporters: ['dots', 'saucelabs'], - captureTimeout: 240000, - browserNoActivityTimeout: 240000, - customLaunchers: customLaunchers, - browsers: Object.keys(customLaunchers) + reporters: ['dots'], + browsers: ['Firefox'] }); } else { karma.set({