Files
MagicMirror/tests/e2e/port_spec.js
Kristjan ESPERANTO 462abf7027 [tests] migrate from jest to vitest (#3940)
This is a big change, but I think it's a good move, as `vitest` is much
more modern than `jest`.

I'm excited about the UI watch feature (run `npm run test:ui`), for
example - it's really helpful and saves time when debugging tests. I had
to adjust a few tests because they had time related issues, but
basically we are now testing the same things - even a bit better and
less flaky (I hope).

What do you think?
2025-11-03 19:47:01 +01:00

34 lines
930 B
JavaScript

const helpers = require("./helpers/global-setup");
describe("port directive configuration", () => {
describe("Set port 8090", () => {
beforeAll(async () => {
await helpers.startApplication("tests/configs/port_8090.js");
});
afterAll(async () => {
await helpers.stopApplication();
});
it("should return 200", async () => {
const port = global.testPort || 8080;
const res = await fetch(`http://localhost:${port}`);
expect(res.status).toBe(200);
});
});
describe("Set port 8100 on environment variable MM_PORT", () => {
beforeAll(async () => {
await helpers.startApplication("tests/configs/port_8090.js", (process.env.MM_PORT = 8100));
});
afterAll(async () => {
await helpers.stopApplication();
});
it("should return 200", async () => {
const port = global.testPort || 8080;
const res = await fetch(`http://localhost:${port}`);
expect(res.status).toBe(200);
});
});
});