MagicMirror/tests/e2e/helpers/basic-auth.js
Kristjan ESPERANTO 679a413788
Review eslint config (#3269)
- Remove "prettier" from plugin array, because it's already enabled by
"plugin:prettier/recommended"
- Remove "jsdoc" from plugin array, because it's already enabled by
"plugin:jsdoc/recommended"
- Enable recommended import rules
- Add two additional import rules

Note: To avoid overloading this PR I'll tackle the jest part with
another PR after this one has been dealt with.
2023-11-20 08:03:29 +01:00

31 lines
666 B
JavaScript

const path = require("path");
const auth = require("express-basic-auth");
const express = require("express");
const app = express();
const basicAuth = auth({
realm: "MagicMirror² Area restricted.",
users: { MagicMirror: "CallMeADog" }
});
app.use(basicAuth);
// Set available directories
const directories = ["/tests/configs", "/tests/mocks"];
const rootPath = path.resolve(`${__dirname}/../../../`);
for (let directory of directories) {
app.use(directory, express.static(path.resolve(rootPath + directory)));
}
let server;
exports.listen = (...args) => {
server = app.listen.apply(app, args);
};
exports.close = async () => {
await server.close();
};