Skip to content

Commit ce1f97e

Browse files
wip. test checking
1 parent 06fec36 commit ce1f97e

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

packages/devextreme-cli/testing/app-template.test.shared.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports = (env, { port, urls } = { port: '8080', urls: {} }) => {
4242
const isDefaultLayout = layout === defaultLayout;
4343

4444
describe(layout, () => {
45-
const devServer = new DevServer(env);
45+
const devServer = new DevServer(env, { port });
4646

4747
beforeAll(async() => {
4848
try {
@@ -64,13 +64,6 @@ module.exports = (env, { port, urls } = { port: '8080', urls: {} }) => {
6464

6565
afterAll(async() => {
6666
await devServer.stop();
67-
console.log('----afterAll-witing--server stopped--->');
68-
await waitOn({
69-
resources: [appUrl],
70-
reverse: true,
71-
timeout: 10000,
72-
interval: 100,
73-
});
7467
console.log('----afterAll---server stopped--->');
7568
});
7669

packages/devextreme-cli/testing/nextjs-server.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
const runCommand = require('../src/utility/run-command');
2+
const { execSync } = require('child_process');
23

34
module.exports = class NextJsServer {
4-
constructor(env) {
5+
constructor(env, { port } = { port: 3000 }) {
56
this.proc = null;
67
this.env = env;
8+
this.port = port;
79
}
810

911
async start() {
@@ -17,8 +19,17 @@ module.exports = class NextJsServer {
1719

1820
stop() {
1921
if(this.proc) {
20-
console.log('------SIGKILL---->');
22+
console.log('-----NEXTJS SERVER-STOP---->');
2123
this.proc.kill('SIGKILL');
24+
25+
if(process.platform !== 'win32') {
26+
try {
27+
execSync(`lsof -i :${this.port} -t | xargs kill -9`, { stdio: 'ignore' });
28+
} catch(e) {
29+
console.log(`NextJs server on port ${this.port} not found. It's OK`);
30+
}
31+
}
32+
2233
this.proc = null;
2334
}
2435
}

0 commit comments

Comments
 (0)