Skip to content

Commit 021cc3d

Browse files
committed
cleanup
1 parent b08e2c4 commit 021cc3d

File tree

2 files changed

+8
-32
lines changed

2 files changed

+8
-32
lines changed

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535
"prettier": "^2.8.3",
3636
"selenium-webdriver": "^4.8.0",
3737
"es-main":"^1.3.0",
38-
"lws": "^4.2.0",
39-
"lws-cors": "^4.2.1",
40-
"lws-index": "^3.1.1",
41-
"lws-log": "^3.0.0",
42-
"lws-static": "^3.1.1"
38+
"local-web-server": "^5.4.0"
4339
}
4440
}

tests/server.mjs

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
// Simple server for local testing.
2-
1+
// Simple local server
32
import * as path from "path";
43
import commandLineArgs from "command-line-args";
54
import esMain from "es-main";
6-
import LocalWebServer from "lws";
7-
import "lws-cors";
8-
import "lws-index";
9-
import "lws-log";
10-
import "lws-static";
5+
import LocalWebServer from "local-web-server";
116

127
const ROOT_DIR = path.join(process.cwd(), "./");
138

@@ -19,35 +14,20 @@ export default async function serve(port) {
1914
directory: ROOT_DIR,
2015
corsOpenerPolicy: "same-origin",
2116
corsEmbedderPolicy: "require-corp",
22-
logFormat: "dev",
23-
stack: ["lws-log", "lws-cors", "lws-static", "lws-index"],
2417
});
25-
await verifyStartup(ws, port);
26-
18+
console.log(`Server started on http://localhost:${port}`);
2719
process.on("exit", () => ws.server.close());
28-
2920
return {
3021
close() {
3122
ws.server.close();
32-
},
23+
}
3324
};
3425
}
3526

36-
async function verifyStartup(ws, port) {
37-
await new Promise((resolve, reject) => {
38-
ws.server.on("listening", () => {
39-
console.log(`Server started on http://localhost:${port}`);
40-
resolve();
41-
});
42-
ws.server.on("error", (e) => {
43-
console.error("Error while starting the server", e);
44-
reject(e);
45-
});
46-
});
47-
}
48-
4927
function main() {
50-
const optionDefinitions = [{ name: "port", type: Number, defaultValue: 8010, description: "Set the test-server port, The default value is 8010." }];
28+
const optionDefinitions = [
29+
{ name: "port", type: Number, defaultValue: 8010, description: "Set the test-server port, The default value is 8010." },
30+
];
5131
const options = commandLineArgs(optionDefinitions);
5232
serve(options.port);
5333
}

0 commit comments

Comments
 (0)