remove passing spec params to SwaggerUIBundle

server test json files via webpack-dev-server
This commit is contained in:
RVKen
2017-07-06 09:51:01 +02:00
parent a3249f0d6f
commit 170dcece36
4 changed files with 3 additions and 10 deletions

View File

@@ -75,7 +75,6 @@
// Build a system
const ui = SwaggerUIBundle({
url: "http://petstore.swagger.io/v2/swagger.json",
spec: spec && JSON.parse(decodeURI(spec)),
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,

View File

@@ -3,6 +3,7 @@ var path = require('path')
var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
var deepExtend = require('deep-extend')
const {gitDescribeSync} = require('git-describe')
@@ -76,17 +77,12 @@ module.exports = function(rules, options) {
plugins.push( new webpack.NoEmitOnErrorsPlugin())
} else { // development mode
var spec
if (specialOptions.testSpecName) {
spec = require('./test/e2e/specs/' + specialOptions.testSpecName)
}
plugins.push(
new HtmlWebpackPlugin({
template: 'dev-helpers/template.ejs',
spec: spec && encodeURI(JSON.stringify(spec)) // using given test spec definition
})
)
plugins.push(new CopyWebpackPlugin([ { from: 'test/e2e/specs', to: 'test-specs' } ]))
}
plugins.push(

View File

@@ -34,8 +34,7 @@
"just-test": "karma start --config karma.conf.js",
"just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs test/swagger-ui-dist-package",
"e2e": "nightwatch test/e2e/scenarios --config test/e2e/nightwatch.json --verbose",
"e2e-initial-render": "nightwatch test/e2e/scenarios --config test/e2e/nightwatch.json --group initial-render",
"dev:e2e": "TEST_SPEC_NAME=1.json webpack-dev-server --host 0.0.0.0 --config webpack-hot-dev-server.config.js --inline --hot --progress --content-base dev-helpers/"
"e2e-initial-render": "nightwatch test/e2e/scenarios --config test/e2e/nightwatch.json --group initial-render"
},
"dependencies": {
"base64-js": "^1.2.0",

View File

@@ -57,7 +57,6 @@ var rules = [
module.exports = require("./make-webpack-config")(rules, {
_special: {
separateStylesheets: false,
testSpecName: process.env['TEST_SPEC_NAME']
},
devtool: "eval",
entry: {