fix tests

This commit is contained in:
ArjixWasTaken
2025-12-30 22:01:53 +02:00
parent 2b15f0a87c
commit 6c881a265a
6 changed files with 89 additions and 56 deletions

View File

@ -18,51 +18,89 @@ export default tsEslint.config(
{ {
plugins: { plugins: {
stylistic, stylistic,
importPlugin importPlugin,
}, },
languageOptions: { languageOptions: {
parser: tsEslint.parser, parser: tsEslint.parser,
parserOptions: { parserOptions: {
project: true, project: ['tsconfig.json', 'tsconfig.test.json'],
sourceType: 'module', sourceType: 'module',
ecmaVersion: 'latest' ecmaVersion: 'latest',
} },
}, },
rules: { rules: {
'stylistic/arrow-parens': ['error', 'always'], 'stylistic/arrow-parens': ['error', 'always'],
'stylistic/object-curly-spacing': ['error', 'always'], 'stylistic/object-curly-spacing': ['error', 'always'],
'stylistic/jsx-pascal-case': 'error', 'stylistic/jsx-pascal-case': 'error',
'stylistic/jsx-curly-spacing': ['error', { when: 'never', children: true }], 'stylistic/jsx-curly-spacing': [
'error',
{ when: 'never', children: true },
],
'stylistic/jsx-sort-props': 'error', 'stylistic/jsx-sort-props': 'error',
'prettier/prettier': ['error', { singleQuote: true, semi: true, tabWidth: 2, trailingComma: 'all', quoteProps: 'preserve' }], 'prettier/prettier': [
'error',
{
singleQuote: true,
semi: true,
tabWidth: 2,
trailingComma: 'all',
quoteProps: 'preserve',
},
],
'@typescript-eslint/no-floating-promises': 'off', '@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-misused-promises': ['off', { checksVoidReturn: false }], '@typescript-eslint/no-misused-promises': [
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], 'off',
{ checksVoidReturn: false },
],
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_' },
],
'@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/consistent-type-imports': ['error', { '@typescript-eslint/consistent-type-imports': [
fixStyle: 'inline-type-imports', 'error',
prefer: 'type-imports', {
disallowTypeAnnotations: false, fixStyle: 'inline-type-imports',
}], prefer: 'type-imports',
disallowTypeAnnotations: false,
},
],
'importPlugin/first': 'error', 'importPlugin/first': 'error',
'importPlugin/newline-after-import': 'off', 'importPlugin/newline-after-import': 'off',
'importPlugin/no-default-export': 'off', 'importPlugin/no-default-export': 'off',
'importPlugin/no-duplicates': 'error', 'importPlugin/no-duplicates': 'error',
'importPlugin/no-unresolved': ['error', { ignore: ['^virtual:', '\\?inline$', '\\?raw$', '\\?asset&asarUnpack'] }], 'importPlugin/no-unresolved': [
'importPlugin/order': ['error', { 'error',
'groups': ['builtin', 'external', ['internal', 'index', 'sibling'], 'parent', 'type'], {
'newlines-between': 'always-and-inside-groups', ignore: ['^virtual:', '\\?inline$', '\\?raw$', '\\?asset&asarUnpack'],
'alphabetize': { order: 'ignore', caseInsensitive: false } },
}], ],
'importPlugin/order': [
'error',
{
'groups': [
'builtin',
'external',
['internal', 'index', 'sibling'],
'parent',
'type',
],
'newlines-between': 'always-and-inside-groups',
'alphabetize': { order: 'ignore', caseInsensitive: false },
},
],
'importPlugin/prefer-default-export': 'off', 'importPlugin/prefer-default-export': 'off',
'camelcase': ['error', { properties: 'never' }], 'camelcase': ['error', { properties: 'never' }],
'class-methods-use-this': 'off', 'class-methods-use-this': 'off',
'stylistic/lines-around-comment': ['error', { 'stylistic/lines-around-comment': [
beforeBlockComment: false, 'error',
afterBlockComment: false, {
beforeLineComment: false, beforeBlockComment: false,
afterLineComment: false, afterBlockComment: false,
}], beforeLineComment: false,
afterLineComment: false,
},
],
'stylistic/max-len': 'off', 'stylistic/max-len': 'off',
'stylistic/no-mixed-operators': 'warn', // prettier does not support no-mixed-operators 'stylistic/no-mixed-operators': 'warn', // prettier does not support no-mixed-operators
'stylistic/no-multi-spaces': ['error', { ignoreEOLComments: true }], 'stylistic/no-multi-spaces': ['error', { ignoreEOLComments: true }],
@ -70,16 +108,20 @@ export default tsEslint.config(
'no-void': 'error', 'no-void': 'error',
'no-empty': 'off', 'no-empty': 'off',
'prefer-promise-reject-errors': 'off', 'prefer-promise-reject-errors': 'off',
'stylistic/quotes': ['error', 'single', { 'stylistic/quotes': [
avoidEscape: true, 'error',
allowTemplateLiterals: 'never', 'single',
}], {
avoidEscape: true,
allowTemplateLiterals: 'never',
},
],
'stylistic/quote-props': ['error', 'consistent'], 'stylistic/quote-props': ['error', 'consistent'],
'stylistic/semi': ['error', 'always'], 'stylistic/semi': ['error', 'always'],
}, },
settings: { settings: {
'import/parsers': { 'import/parsers': {
'@typescript-eslint/parser': ['.ts'] '@typescript-eslint/parser': ['.ts'],
}, },
'import/resolver': { 'import/resolver': {
typescript: {}, typescript: {},

View File

@ -168,7 +168,6 @@
"eslint-plugin-solid": "0.14.5", "eslint-plugin-solid": "0.14.5",
"glob": "11.1.0", "glob": "11.1.0",
"node-gyp": "11.4.2", "node-gyp": "11.4.2",
"playwright": "1.55.1",
"ts-morph": "27.0.2", "ts-morph": "27.0.2",
"typescript": "5.9.3", "typescript": "5.9.3",
"typescript-eslint": "8.43.0", "typescript-eslint": "8.43.0",

21
pnpm-lock.yaml generated
View File

@ -343,9 +343,6 @@ importers:
node-gyp: node-gyp:
specifier: 11.4.2 specifier: 11.4.2
version: 11.4.2 version: 11.4.2
playwright:
specifier: 1.55.1
version: 1.55.1
ts-morph: ts-morph:
specifier: 27.0.2 specifier: 27.0.2
version: 27.0.2 version: 27.0.2
@ -3902,21 +3899,11 @@ packages:
engines: {node: '>=18'} engines: {node: '>=18'}
hasBin: true hasBin: true
playwright-core@1.55.1:
resolution: {integrity: sha512-Z6Mh9mkwX+zxSlHqdr5AOcJnfp+xUWLCt9uKV18fhzA8eyxUd8NUWzAjxUh55RZKSYwDGX0cfaySdhZJGMoJ+w==}
engines: {node: '>=18'}
hasBin: true
playwright@1.55.0: playwright@1.55.0:
resolution: {integrity: sha512-sdCWStblvV1YU909Xqx0DhOjPZE4/5lJsIS84IfN9dAZfcl/CIZ5O8l3o0j7hPMjDvqoTF8ZUcc+i/GL5erstA==} resolution: {integrity: sha512-sdCWStblvV1YU909Xqx0DhOjPZE4/5lJsIS84IfN9dAZfcl/CIZ5O8l3o0j7hPMjDvqoTF8ZUcc+i/GL5erstA==}
engines: {node: '>=18'} engines: {node: '>=18'}
hasBin: true hasBin: true
playwright@1.55.1:
resolution: {integrity: sha512-cJW4Xd/G3v5ovXtJJ52MAOclqeac9S/aGGgRzLabuF8TnIb6xHvMzKIa6JmrRzUkeXJgfL1MhukP0NK6l39h3A==}
engines: {node: '>=18'}
hasBin: true
plist@3.1.0: plist@3.1.0:
resolution: {integrity: sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==} resolution: {integrity: sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==}
engines: {node: '>=10.4.0'} engines: {node: '>=10.4.0'}
@ -8933,20 +8920,12 @@ snapshots:
playwright-core@1.55.0: {} playwright-core@1.55.0: {}
playwright-core@1.55.1: {}
playwright@1.55.0: playwright@1.55.0:
dependencies: dependencies:
playwright-core: 1.55.0 playwright-core: 1.55.0
optionalDependencies: optionalDependencies:
fsevents: 2.3.2 fsevents: 2.3.2
playwright@1.55.1:
dependencies:
playwright-core: 1.55.1
optionalDependencies:
fsevents: 2.3.2
plist@3.1.0: plist@3.1.0:
dependencies: dependencies:
'@xmldom/xmldom': 0.8.11 '@xmldom/xmldom': 0.8.11

View File

@ -1,7 +1,7 @@
import path from 'node:path'; import path from 'node:path';
import process from 'node:process'; import process from 'node:process';
import { _electron as electron } from 'playwright';
import { test, expect } from '@playwright/test'; import { test, expect, _electron as electron } from '@playwright/test';
process.env.NODE_ENV = 'test'; process.env.NODE_ENV = 'test';
@ -32,7 +32,11 @@ test('Pear Desktop App - With default settings, app is launched and visible', as
// expect(title.replaceAll(/\s/g, ' ')).toEqual('Pear Desktop'); // expect(title.replaceAll(/\s/g, ' ')).toEqual('Pear Desktop');
const url = window.url(); const url = window.url();
expect(url.startsWith('https://music.\u0079\u006f\u0075\u0074\u0075\u0062\u0065.com')).toBe(true); expect(
url.startsWith(
'https://music.\u0079\u006f\u0075\u0074\u0075\u0062\u0065.com',
),
).toBe(true);
await app.close(); await app.close();
}); });

View File

@ -25,7 +25,8 @@
"exclude": ["./dist"], "exclude": ["./dist"],
"include": [ "include": [
"electron.vite.config.mts", "electron.vite.config.mts",
"playwright.config.ts",
"./src/**/*", "./src/**/*",
"*.config.*js", "*.config.*js"
] ]
} }

8
tsconfig.test.json Normal file
View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"exclude": ["./dist"],
"include": [
"playwright.config.ts",
"./tests/**/*"
]
}