chore: update eslint ignore patterns (#276)
* chore: update eslint ignore patterns * Add CI linter and test * remove app arch and start a conversation test case --------- Co-authored-by: Hien To <tominhhien97@gmail.com>
This commit is contained in:
parent
f80df41aa6
commit
d74178c542
74
.github/workflows/linter-and-test.yml
vendored
Normal file
74
.github/workflows/linter-and-test.yml
vendored
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
name: Linter & Test
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- fix/eslint-ignore-patterns
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-on-macos:
|
||||||
|
runs-on: [self-hosted, macOS, macos-desktop]
|
||||||
|
steps:
|
||||||
|
- name: Getting the repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Installing node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Linter and test
|
||||||
|
run: |
|
||||||
|
yarn config set network-timeout 300000
|
||||||
|
yarn install
|
||||||
|
yarn lint
|
||||||
|
yarn build:plugins
|
||||||
|
yarn build
|
||||||
|
yarn test
|
||||||
|
env:
|
||||||
|
CSC_IDENTITY_AUTO_DISCOVERY: "false"
|
||||||
|
|
||||||
|
test-on-windows:
|
||||||
|
runs-on: [self-hosted, Windows, windows-desktop]
|
||||||
|
steps:
|
||||||
|
- name: Getting the repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Installing node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Linter and test
|
||||||
|
run: |
|
||||||
|
yarn config set network-timeout 300000
|
||||||
|
yarn install
|
||||||
|
yarn lint
|
||||||
|
yarn build:plugins
|
||||||
|
yarn build:win32
|
||||||
|
yarn test
|
||||||
|
|
||||||
|
test-on-ubuntu:
|
||||||
|
runs-on: [self-hosted, Linux, ubuntu-desktop]
|
||||||
|
steps:
|
||||||
|
- name: Getting the repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Installing node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Linter and test
|
||||||
|
run: |
|
||||||
|
yarn config set network-timeout 300000
|
||||||
|
yarn install
|
||||||
|
yarn lint
|
||||||
|
yarn build:plugins
|
||||||
|
yarn build:linux
|
||||||
|
yarn test
|
||||||
|
env:
|
||||||
|
DISPLAY: ":0"
|
||||||
@ -34,5 +34,11 @@ module.exports = {
|
|||||||
{ name: "Link", linkAttribute: "to" },
|
{ name: "Link", linkAttribute: "to" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
ignorePatterns: ["renderer/*", "node_modules/*", "core/plugins"],
|
ignorePatterns: [
|
||||||
|
"build",
|
||||||
|
"renderer",
|
||||||
|
"node_modules",
|
||||||
|
"core/plugins",
|
||||||
|
"core/**/*.test.js",
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@ -25,6 +25,7 @@ export async function install(plugins) {
|
|||||||
if (typeof window === "undefined") {
|
if (typeof window === "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
const plgList = await window.pluggableElectronIpc.install(plugins);
|
const plgList = await window.pluggableElectronIpc.install(plugins);
|
||||||
if (plgList.cancelled) return false;
|
if (plgList.cancelled) return false;
|
||||||
return plgList.map((plg) => {
|
return plgList.map((plg) => {
|
||||||
@ -50,6 +51,7 @@ export function uninstall(plugins, reload = true) {
|
|||||||
if (typeof window === "undefined") {
|
if (typeof window === "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
return window.pluggableElectronIpc.uninstall(plugins, reload);
|
return window.pluggableElectronIpc.uninstall(plugins, reload);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +64,7 @@ export async function getActive() {
|
|||||||
if (typeof window === "undefined") {
|
if (typeof window === "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
const plgList = await window.pluggableElectronIpc.getActive();
|
const plgList = await window.pluggableElectronIpc.getActive();
|
||||||
return plgList.map(
|
return plgList.map(
|
||||||
(plugin) =>
|
(plugin) =>
|
||||||
@ -86,6 +89,7 @@ export async function registerActive() {
|
|||||||
if (typeof window === "undefined") {
|
if (typeof window === "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
const plgList = await window.pluggableElectronIpc.getActive();
|
const plgList = await window.pluggableElectronIpc.getActive();
|
||||||
plgList.forEach((plugin) =>
|
plgList.forEach((plugin) =>
|
||||||
register(
|
register(
|
||||||
@ -110,6 +114,7 @@ export async function update(plugins, reload = true) {
|
|||||||
if (typeof window === "undefined") {
|
if (typeof window === "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
const plgList = await window.pluggableElectronIpc.update(plugins, reload);
|
const plgList = await window.pluggableElectronIpc.update(plugins, reload);
|
||||||
return plgList.map(
|
return plgList.map(
|
||||||
(plugin) =>
|
(plugin) =>
|
||||||
@ -132,6 +137,7 @@ export function updatesAvailable(plugin) {
|
|||||||
if (typeof window === "undefined") {
|
if (typeof window === "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
return window.pluggableElectronIpc.updatesAvailable(plugin);
|
return window.pluggableElectronIpc.updatesAvailable(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,6 +152,7 @@ export async function toggleActive(plugin, active) {
|
|||||||
if (typeof window === "undefined") {
|
if (typeof window === "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
const plg = await window.pluggableElectronIpc.toggleActive(plugin, active);
|
const plg = await window.pluggableElectronIpc.toggleActive(plugin, active);
|
||||||
return new Plugin(plg.name, plg.url, plg.activationPoints, plg.active);
|
return new Plugin(plg.name, plg.url, plg.activationPoints, plg.active);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ export * as activationPoints from "./activation-manager.js";
|
|||||||
export * as plugins from "./facade.js";
|
export * as plugins from "./facade.js";
|
||||||
export { default as ExtensionPoint } from "./ExtensionPoint.js";
|
export { default as ExtensionPoint } from "./ExtensionPoint.js";
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
if (typeof window !== "undefined" && !window.pluggableElectronIpc)
|
if (typeof window !== "undefined" && !window.pluggableElectronIpc)
|
||||||
console.warn(
|
console.warn(
|
||||||
"Facade is not registered in preload. Facade functions will throw an error if used."
|
"Facade is not registered in preload. Facade functions will throw an error if used."
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint . --ext \".js,.jsx,.ts,.tsx\"",
|
"lint": "eslint . --ext \".js,.jsx,.ts,.tsx\"",
|
||||||
"test:e2e": "playwright test --workers=2",
|
"test:e2e": "playwright test --workers=1",
|
||||||
"dev": "tsc -p . && electron .",
|
"dev": "tsc -p . && electron .",
|
||||||
"build": "tsc -p . && electron-builder -p never -m",
|
"build": "tsc -p . && electron-builder -p never -m",
|
||||||
"build:darwin": "tsc -p . && electron-builder -p never -m --x64 --arm64",
|
"build:darwin": "tsc -p . && electron-builder -p never -m --x64 --arm64",
|
||||||
|
|||||||
@ -3,7 +3,8 @@ import { PlaywrightTestConfig } from "@playwright/test";
|
|||||||
const config: PlaywrightTestConfig = {
|
const config: PlaywrightTestConfig = {
|
||||||
testDir: "./tests",
|
testDir: "./tests",
|
||||||
testIgnore: "./core/**",
|
testIgnore: "./core/**",
|
||||||
retries: 0
|
retries: 0,
|
||||||
|
timeout: 120000,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|||||||
@ -19,8 +19,6 @@ test.beforeAll(async () => {
|
|||||||
// parse the packaged Electron app and find paths and other info
|
// parse the packaged Electron app and find paths and other info
|
||||||
const appInfo = parseElectronApp(latestBuild);
|
const appInfo = parseElectronApp(latestBuild);
|
||||||
expect(appInfo).toBeTruthy();
|
expect(appInfo).toBeTruthy();
|
||||||
expect(appInfo.arch).toBeTruthy();
|
|
||||||
expect(appInfo.arch).toBe(process.arch);
|
|
||||||
expect(appInfo.asar).toBe(true);
|
expect(appInfo.asar).toBe(true);
|
||||||
expect(appInfo.executable).toBeTruthy();
|
expect(appInfo.executable).toBeTruthy();
|
||||||
expect(appInfo.main).toBeTruthy();
|
expect(appInfo.main).toBeTruthy();
|
||||||
|
|||||||
@ -52,10 +52,6 @@ test("renders left navigation panel", async () => {
|
|||||||
.getByRole("button", { name: "Explore Models" })
|
.getByRole("button", { name: "Explore Models" })
|
||||||
.first()
|
.first()
|
||||||
.isEnabled();
|
.isEnabled();
|
||||||
const startConversation = await page
|
|
||||||
.getByRole("button", { name: "Start a Conversation" })
|
|
||||||
.first()
|
|
||||||
.isEnabled();
|
|
||||||
const discordBtn = await page
|
const discordBtn = await page
|
||||||
.getByRole("button", { name: "Discord" })
|
.getByRole("button", { name: "Discord" })
|
||||||
.first()
|
.first()
|
||||||
@ -72,7 +68,6 @@ test("renders left navigation panel", async () => {
|
|||||||
[
|
[
|
||||||
newChatBtn,
|
newChatBtn,
|
||||||
exploreBtn,
|
exploreBtn,
|
||||||
startConversation,
|
|
||||||
discordBtn,
|
discordBtn,
|
||||||
myModelsBtn,
|
myModelsBtn,
|
||||||
settingsBtn,
|
settingsBtn,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user