Skip to content

🔧 Add parameter --port in codecept-ui command to start app #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bin/codecept-ui.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node
const debug = require('debug')('codepress:codepress');
const { getPort } = require('../lib/config/env');

// initialize CodeceptJS
require('../lib/commands/init')();
Expand All @@ -13,7 +14,7 @@ const snapshotStore = require('../lib/model/snapshot-store');
const scenarioStatusRepository = require('../lib/model/scenario-status-repository');

// Base port
const PORT = 3000;
const PORT = getPort();

// Serve frontend from dist
const AppDir = path.join(__dirname, '..', 'dist');
Expand Down
3 changes: 2 additions & 1 deletion lib/api/list-steps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const { getUrl } = require('../config/url');
const { event } = require('codeceptjs');
const codeceptjsFactory = require('../model/codeceptjs-factory');

const WS_URL = 'http://localhost:3000';
const WS_URL = getUrl();
const TestProjectDir = process.cwd();


Expand Down
3 changes: 2 additions & 1 deletion lib/codeceptjs/brk.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { getUrl } = require('../config/url');
const container = require('codeceptjs').container;
const store = require('codeceptjs').store;
const recorder = require('codeceptjs').recorder;
Expand Down Expand Up @@ -32,7 +33,7 @@ const pause = function () {
};

function pauseSession() {
socket = require('socket.io-client')('http://localhost:3000');
socket = require('socket.io-client')(getUrl());
rl = readline.createInterface(process.stdin, process.stdout);

recorder.session.start('pause');
Expand Down
5 changes: 5 additions & 0 deletions lib/config/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
getPort() {
return Number(process.env.port) || 3000;
}
};
8 changes: 8 additions & 0 deletions lib/config/url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { getPort } = require('./env');

module.exports = {
getUrl() {
const PORT = getPort();
return `http://localhost:${PORT}`;
}
};
3 changes: 2 additions & 1 deletion lib/model/ws-events.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const WS_URL = 'http://localhost:3000';
const { getUrl } = require('../config/url');
const WS_URL = getUrl();

const socket = require('socket.io-client')(WS_URL);

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ Vue.use(Buefy);
Vue.use(VueHighlightJS);

const store = require('./store').default;
const PORT = process.env.port || 3000;
Vue.use(new VueSocketIO({
debug: true,
connection: 'http://localhost:3000',
connection: `http://localhost:${PORT}`,
vuex: {
store,
actionPrefix: 'SOCKET_',
Expand Down
4 changes: 3 additions & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const { getUrl } = require('./lib/config/url');

module.exports = {
devServer: {
proxy: {
'^/api': {
target: 'http://localhost:3001/',
target: getUrl(),
}
}
}
Expand Down