diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 00000000..73aa3eae --- /dev/null +++ b/jest.config.js @@ -0,0 +1,15 @@ +module.exports = { + "verbose": true, + "preset": "jest-puppeteer", + "globals": { + "__DEV__": true + }, + "testRegex": "./test/*.spec.js", + "rootDir": ".", + "testTimeout": 30000, + "transform": { + "^.+\\.js$": "babel-jest", + ".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub" + } +}; + diff --git a/package.json b/package.json index 7511e93d..c838efee 100644 --- a/package.json +++ b/package.json @@ -115,15 +115,5 @@ "stylelint-config-standard": "~22.0.0", "typescript": "~4.4.3", "vite": "~2.6.4" - }, - "jest": { - "verbose": true, - "preset": "jest-puppeteer", - "globals": { - "__DEV__": true - }, - "testRegex": "./test/*.spec.js", - "rootDir": ".", - "testTimeout": 30000 } } diff --git a/src/main.js b/src/main.js index 79ba2d1d..14b87f49 100644 --- a/src/main.js +++ b/src/main.js @@ -43,3 +43,9 @@ app.component("Editable", contenteditable); app.component("FontAwesomeIcon", FontAwesomeIcon); app.mount("#app"); + +// Expose the vue instance for development +if (process.env.NODE_ENV === "development") { + console.log("Dev Only: window.app is the vue instance"); + window.app = app._instance; +} diff --git a/src/util.js b/src/util.js index 64ac2f6f..7fb50c5b 100644 --- a/src/util.js +++ b/src/util.js @@ -74,7 +74,7 @@ class TimeLogger { this.startTime = dayjs().valueOf(); } print(name) { - if (exports.isDev && process && process.env.TIMELOGGER === "1") { + if (exports.isDev && process.env.TIMELOGGER === "1") { console.log(name + ": " + (dayjs().valueOf() - this.startTime) + "ms"); } } diff --git a/src/util.ts b/src/util.ts index 45005049..6e911998 100644 --- a/src/util.ts +++ b/src/util.ts @@ -86,7 +86,7 @@ export class TimeLogger { } print(name: string) { - if (isDev && process && process.env.TIMELOGGER === "1") { + if (isDev && process.env.TIMELOGGER === "1") { console.log(name + ": " + (dayjs().valueOf() - this.startTime) + "ms") } } diff --git a/test/test.spec.js b/test/test.spec.js index 91c8459b..af8da323 100644 --- a/test/test.spec.js +++ b/test/test.spec.js @@ -2,6 +2,7 @@ const { Page, Browser } = require("puppeteer"); const { sleep } = require("../src/util"); const axios = require("axios"); +const { currentLocale } = require("../src/i18n"); /** * Set back the correct data type for page object @@ -223,6 +224,14 @@ describe("Init", () => { }); }); +describe("Test i18n.js", () => { + + it("currentLocale()", () => { + expect(currentLocale()).toMatch(""); + }); + +}); + async function login(username, password) { await input(page, "#floatingInput", username); await input(page, "#floatingPassword", password); diff --git a/test/test_install_script/ubuntu.dockerfile b/test/test_install_script/ubuntu.dockerfile index 07d8a25a..fc9dcd3f 100644 --- a/test/test_install_script/ubuntu.dockerfile +++ b/test/test_install_script/ubuntu.dockerfile @@ -6,5 +6,4 @@ FROM ubuntu # RUN ln -s /usr/bin/nodejs /usr/bin/node # RUN node -v -COPY ./install.sh . -RUN bash install.sh local /opt/uptime-kuma 3000 0.0.0.0 +RUN curl -o kuma_install.sh http://git.kuma.pet/install.sh && bash kuma_install.sh local /opt/uptime-kuma 3000 0.0.0.0