From 5f5a82e718a46e17513218ba861d91cd16c2c08d Mon Sep 17 00:00:00 2001 From: squidfunk Date: Mon, 2 Jan 2017 23:18:44 +0100 Subject: [PATCH] Remove unfinished test infrastructure until after release --- Gulpfile.babel.js | 4 +- lib/tasks/tests/regression/foo.js | 72 ----------------- lib/tasks/tests/unit.js | 36 --------- lib/tasks/tests/unit/watch.js | 22 +++--- mkdocs.yml | 1 + tests/.eslintrc | 23 ------ tests/karma.conf.js | 125 ------------------------------ tests/unit/Marker.jsx | 75 ------------------ 8 files changed, 12 insertions(+), 346 deletions(-) delete mode 100644 lib/tasks/tests/regression/foo.js delete mode 100644 lib/tasks/tests/unit.js delete mode 100644 tests/.eslintrc delete mode 100644 tests/karma.conf.js delete mode 100644 tests/unit/Marker.jsx diff --git a/Gulpfile.babel.js b/Gulpfile.babel.js index 658f4278e..8d6d46094 100755 --- a/Gulpfile.babel.js +++ b/Gulpfile.babel.js @@ -313,8 +313,8 @@ gulp.task("watch", [ gulp.start("mkdocs:serve") /* Start karma test runner */ - if (args.karma) - gulp.start("tests:unit:watch") + // if (args.karma) + // gulp.start("tests:unit:watch") /* Rebuild stylesheets */ gulp.watch([ diff --git a/lib/tasks/tests/regression/foo.js b/lib/tasks/tests/regression/foo.js deleted file mode 100644 index 5bc60af9c..000000000 --- a/lib/tasks/tests/regression/foo.js +++ /dev/null @@ -1,72 +0,0 @@ - -import * as selenium from "./selenium" -import path from "path" -import Gemini from "gemini" - -export default (gulp, config) => { - return done => { - selenium.start(() => { - // const file = require( - // path.resolve(process.cwd(), - // config.tests.regression.geminiConfigPath, - // ".gemini-local.json" - // )) - - const configx = { - "rootUrl": "http://localhost:8000", - "gridUrl": "http://localhost:4444/wd/hub", - "screenshotsDir": "./tests/regression/baseline/local", - "browsers": { - "chrome": { - "desiredCapabilities": { - "browserName": "chrome" - } - } - }, - "system": { - "projectRoot": "../../../", - "sourceRoot": "src/assets/stylesheets" - } - } - - // https://www.npmjs.com/package/gemini-sauce - - console.log("running gemini...") - const gemini = new Gemini(configx) - - gemini.test("tests/regression/styleguide.js", { - reporters: ["html"] - }) - .then(() => { - console.log("success") - selenium.stop() - done() - }, err => { - console.log("fail") - selenium.stop() - throw err - }) - }) - // selenium.start(() => { - // const geminiConfig = require( - // path.resolve( - // process.cwd(), - // config.tests.regression.geminiConfigPath, - // ".gemini-local.json" - // )) - // geminiConfig.rootUrl = `http://127.0.0.1:${config.patternlabServer.port}` - // - // const gemini = new Gemini(geminiConfig) - // gemini.test(config.tests.regression.patternlabToGeminiOutput, { - // reporters: ["html"] - // }) - // .then(() => { - // selenium.stop() - // done() - // }, err => { - // selenium.stop() - // throw err - // }) - // }) - } -} diff --git a/lib/tasks/tests/unit.js b/lib/tasks/tests/unit.js deleted file mode 100644 index 59e8f7908..000000000 --- a/lib/tasks/tests/unit.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2016 Martin Donath - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -import path from "path" -import { Server } from "karma" - -/* ---------------------------------------------------------------------------- - * Task: start karma test runner - * ------------------------------------------------------------------------- */ - -export default (gulp, config) => { - return done => { - new Server({ - configFile: path.join(process.cwd(), config.tests.unit) - }, done).start() - } -} diff --git a/lib/tasks/tests/unit/watch.js b/lib/tasks/tests/unit/watch.js index 9c7ca18e8..65f57c25f 100644 --- a/lib/tasks/tests/unit/watch.js +++ b/lib/tasks/tests/unit/watch.js @@ -32,18 +32,14 @@ export default () => { new Server({ configFile: path.join(process.cwd(), "tests/karma.conf.js") }, done).start() + + /* Register signal handler for all relevant events */ + for (const signal of ["SIGTERM", "SIGINT", "exit"]) + process.on(signal, () => { + return stopper.stop({ + port: 9876, + logLevel: "OFF" + }) + }) } } - -/* ---------------------------------------------------------------------------- - * Signal handler - * ------------------------------------------------------------------------- */ - -/* Register signal handler for all relevant events */ -for (const signal of ["SIGTERM", "SIGINT", "exit"]) - process.on(signal, () => { - return stopper.stop({ - port: 9876, - logLevel: "OFF" - }) - }) diff --git a/mkdocs.yml b/mkdocs.yml index e6b8afffe..71289b1c8 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -83,4 +83,5 @@ pages: - PyMdown: extensions/pymdown.md - Specimen: specimen.md - Customization: customization.md + - Contributing: contributing.md - License: license.md diff --git a/tests/.eslintrc b/tests/.eslintrc deleted file mode 100644 index bda0f6c45..000000000 --- a/tests/.eslintrc +++ /dev/null @@ -1,23 +0,0 @@ -{ - "env": { - "mocha": true - }, - "parserOptions": { - "ecmaFeatures": { - "jsx": true - } - }, - "plugins": [ - "mocha" - ], - "rules": { - "mocha/no-exclusive-tests": 2, - "mocha/no-global-tests": 2, - "mocha/no-identical-title": 2, - "mocha/no-mocha-arrows": 2, - "mocha/no-pending-tests": 1, - "mocha/no-skipped-tests": 1, - "no-use-before-define": 0, - "prefer-arrow-callback": 0 - } -} \ No newline at end of file diff --git a/tests/karma.conf.js b/tests/karma.conf.js deleted file mode 100644 index 7cfde9669..000000000 --- a/tests/karma.conf.js +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2016 Martin Donath - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -const path = require("path") -const webpack = require("webpack") - -/* ---------------------------------------------------------------------------- - * Definition - * ------------------------------------------------------------------------- */ - -module.exports = karma => { - const config = { - basePath: "../", - frameworks: ["mocha"], - - /* Include babel polyfill to support older browsers */ - files: [ - "node_modules/babel-polyfill/dist/polyfill.js", - "tests/unit/*.spec.+(js|jsx)" - ], - - /* Test reporters */ - reporters: ["spec", "coverage"], - - /* Silence calls to console.log */ - client: { - captureConsole: false - }, - - /* Preprocess test files */ - preprocessors: { - "tests/unit/*.spec.+(js|jsx)": ["webpack", "sourcemap"] - }, - - /* Configuration for webpack */ - webpack: { - module: { - - /* Transpile ES6 to ES5 with Babel */ - loaders: [ - { - loader: "babel-loader", - test: /\.jsx?$/ - } - ] - }, - plugins: [ - - /* Don't emit assets that include errors */ - new webpack.NoErrorsPlugin(), - - /* Provide JSX helper */ - new webpack.ProvidePlugin({ - JSX: path.join(process.cwd(), "lib/providers/jsx.js") - }) - ], - - /* Module resolver */ - resolve: { - modulesDirectories: [ - "src/assets/javascripts", - "node_modules" - ], - extensions: [ - "", - ".js", - ".jsx" - ] - }, - - /* Sourcemap support */ - devtool: "inline-source-map" - }, - - /* Suppress messages by webpack */ - webpackServer: { - noInfo: true - }, - - /* Code coverage */ - coverageReporter: { - dir: "./coverage", - reporters: [ - { type: "json" } - ] - } - } - - /* Setup for continuous integration */ - if (process.env.CI) { - // TODO TBD - - /* Setup for local development environment */ - } else if (process.env.WATCH) { - delete config.reporters - delete config.client.captureConsole - - /* Setup for local testing */ - } else { - config.browsers = ["Chrome"] - config.singleRun = true - } - - /* Persist configuration */ - karma.set(config) -} diff --git a/tests/unit/Marker.jsx b/tests/unit/Marker.jsx deleted file mode 100644 index a4ed79e30..000000000 --- a/tests/unit/Marker.jsx +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2016 Martin Donath - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -import chai from "chai" - -import Marker from - "../../src/assets/javascripts/components/Material/Nav/Blur" - -describe("Karma test runner", function() { - chai.should() - - // TODO: sandbox shit! should be okay once? - beforeEach(function() { - - for (let i = 0; i < 25; i++) - document.body.appendChild( -

{i + 1}

- ) - - document.body.appendChild( -
    - {[...Array(25)].map((_, i) => { - return ( -
  • - {i + 1} -
  • - ) - })} -
- ) - }) - - it("should compile JSX correctly", - shouldCompileJSXCorrectly) -}) - -// iframe? -function shouldCompileJSXCorrectly(done) { - const marker = new Marker("a") - marker.listen() - - // window.location.hash = "#_5" - // window.addEventListener("hashchange", function(e) { - // console.log(document.querySelectorAll("[data-md-blurred]")) - // done() - // }) - window.scrollTo(200, 200) - setTimeout(() => { - console.log(document.querySelectorAll("[data-md-blurred]")) - done() - }, 100) - - // console.log(marker) - // return true - -}