Remove unfinished test infrastructure until after release

This commit is contained in:
squidfunk 2017-01-02 23:18:44 +01:00
parent 1e590ba872
commit 5f5a82e718
8 changed files with 12 additions and 346 deletions

View File

@ -313,8 +313,8 @@ gulp.task("watch", [
gulp.start("mkdocs:serve") gulp.start("mkdocs:serve")
/* Start karma test runner */ /* Start karma test runner */
if (args.karma) // if (args.karma)
gulp.start("tests:unit:watch") // gulp.start("tests:unit:watch")
/* Rebuild stylesheets */ /* Rebuild stylesheets */
gulp.watch([ gulp.watch([

View File

@ -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
// })
// })
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
*
* 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()
}
}

View File

@ -32,18 +32,14 @@ export default () => {
new Server({ new Server({
configFile: path.join(process.cwd(), "tests/karma.conf.js") configFile: path.join(process.cwd(), "tests/karma.conf.js")
}, done).start() }, 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"
})
})

View File

@ -83,4 +83,5 @@ pages:
- PyMdown: extensions/pymdown.md - PyMdown: extensions/pymdown.md
- Specimen: specimen.md - Specimen: specimen.md
- Customization: customization.md - Customization: customization.md
- Contributing: contributing.md
- License: license.md - License: license.md

View File

@ -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
}
}

View File

@ -1,125 +0,0 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
*
* 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)
}

View File

@ -1,75 +0,0 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
*
* 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(
<p id={`anchor_${i + 1}`}>{i + 1}</p>
)
document.body.appendChild(
<ul>
{[...Array(25)].map((_, i) => {
return (
<li>
<a href={`#anchor_${i + 1}`}>{i + 1}</a>
</li>
)
})}
</ul>
)
})
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
}