mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-18 17:30:36 +03:00
simplify test server setup
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
port: 8080,
|
||||
root: path.join(__dirname, '../'),
|
||||
build: '.build',
|
||||
html: {
|
||||
input: 'index.html',
|
||||
@@ -8,4 +12,8 @@ module.exports = {
|
||||
input: 'index.browser',
|
||||
output: 'build',
|
||||
},
|
||||
dev: {
|
||||
servePort: 18080,
|
||||
livereloadPort: 28080,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -181,15 +181,14 @@ const setupRollupTest = async (rootDir, testPath, cacheDir, watch) => {
|
||||
rollupPluginServe({
|
||||
contentBase: dist,
|
||||
historyApiFallback: `/${deploymentConfig.html.output}`,
|
||||
port: 18080,
|
||||
port: deploymentConfig.dev.servePort,
|
||||
onListening(server) {
|
||||
rollupServers.push(server);
|
||||
},
|
||||
}),
|
||||
rollupPluginLivereload({
|
||||
watch: dist,
|
||||
verbose: true,
|
||||
port: 28080,
|
||||
port: deploymentConfig.dev.livereloadPort,
|
||||
}),
|
||||
]
|
||||
: []),
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
const path = require('path');
|
||||
const express = require('express');
|
||||
const deploymentConfig = require('./jest-puppeteer.rollup.config.js');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(express.static(path.join(__dirname, '../')));
|
||||
|
||||
app.listen(process.env.TEST_SERVER_PORT);
|
||||
app.use(express.static(deploymentConfig.root));
|
||||
app.listen(deploymentConfig.port);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const path = require('path');
|
||||
const jestPuppeteerConfig = require('../jest-puppeteer.config.base');
|
||||
const deploymentConfig = require('./jest-puppeteer.rollup.config.js');
|
||||
|
||||
module.exports = {
|
||||
process: (src, filePath, config) => {
|
||||
const deploymentPath = path.relative(path.dirname(config.globals.baseConfig), filePath);
|
||||
process: (src, filePath) => {
|
||||
const deploymentPath = path.relative(deploymentConfig.root, filePath);
|
||||
const split = deploymentPath.split(path.sep);
|
||||
return `module.exports = ${JSON.stringify(`http://localhost:${jestPuppeteerConfig.server.port}/${path.posix.join(...split)}`)}`;
|
||||
return `module.exports = ${JSON.stringify(`http://localhost:${deploymentConfig.port}/${path.posix.join(...split)}`)}`;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user