Compare commits
7 Commits
ea207381ec
...
ef15838047
| Author | SHA1 | Date | |
|---|---|---|---|
| ef15838047 | |||
| 4ee8e73200 | |||
| 40a30b8a87 | |||
| 3e69af7e34 | |||
| aab6aeeeae | |||
| c9ef9be24c | |||
| 7f5a9300d4 |
23
.github/workflows/js-unit-tests.yml
vendored
Normal file
23
.github/workflows/js-unit-tests.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: JS Unit Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.2
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v6.2.0
|
||||
with:
|
||||
node-version: '24'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run tests
|
||||
run: npm run test:unit
|
||||
@@ -1,4 +1,4 @@
|
||||
name: PHP Tests
|
||||
name: PHP Unit Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
uses: actions/checkout@v6.0.2
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1
|
||||
with:
|
||||
php-version: '8.5'
|
||||
tools: composer:v2
|
||||
@@ -21,4 +21,4 @@ jobs:
|
||||
run: composer install --prefer-dist --no-progress
|
||||
|
||||
- name: Run tests
|
||||
run: composer test
|
||||
run: composer test:unit
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -15,9 +15,8 @@ node_modules/
|
||||
# Backend development
|
||||
/vendor/
|
||||
coverage/
|
||||
phpunit.xml.cache
|
||||
.phpunit.cache
|
||||
.phpunit.result.cache
|
||||
.phpunit.coverage
|
||||
.php-cs-fixer.cache
|
||||
.phpstan.cache
|
||||
.phpactor/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"symfony/console": "^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^11.0"
|
||||
"phpunit/phpunit": "^13.0"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
@@ -38,6 +38,7 @@
|
||||
],
|
||||
"post-update-cmd": [
|
||||
],
|
||||
"test": "phpunit --colors=always --testdox"
|
||||
"test:unit": "phpunit --configuration tests/php/phpunit.unit.xml --colors=always --testdox",
|
||||
"test:coverage": "XDEBUG_MODE=coverage phpunit --configuration tests/php/phpunit.unit.xml --coverage-html .phpunit.coverage --coverage-text"
|
||||
}
|
||||
}
|
||||
|
||||
671
composer.lock
generated
671
composer.lock
generated
File diff suppressed because it is too large
Load Diff
1630
package-lock.json
generated
1630
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -7,14 +7,18 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "vite build --mode production",
|
||||
"build:modules": "for dir in modules/*/; do if [ -f \"$dir/package.json\" ]; then echo \"Building $dir\" && npm run build --prefix \"$dir\"; fi; done",
|
||||
"build:all": "npm run build && npm run build:modules",
|
||||
"dev": "vite build --mode development",
|
||||
"dev:modules": "for dir in modules/*/; do if [ -f \"$dir/package.json\" ]; then echo \"Building $dir\" && npm run dev --prefix \"$dir\"; fi; done",
|
||||
"dev:all": "npm run dev && npm run dev:modules",
|
||||
"watch": "vite build --mode development --watch",
|
||||
"typecheck": "vue-tsc --noEmit",
|
||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
||||
"build:modules": "for dir in modules/*/; do if [ -f \"$dir/package.json\" ]; then echo \"Building $dir\" && npm run build --prefix \"$dir\"; fi; done",
|
||||
"build:all": "npm run build && npm run build:modules",
|
||||
"dev:modules": "for dir in modules/*/; do if [ -f \"$dir/package.json\" ]; then echo \"Building $dir\" && npm run dev --prefix \"$dir\"; fi; done",
|
||||
"dev:all": "npm run dev && npm run dev:modules"
|
||||
"test": "vitest run --config tests/js/vitest.config.ts",
|
||||
"test:unit": "vitest run --config tests/js/vitest.config.ts",
|
||||
"test:watch": "vitest watch --config tests/js/vitest.config.ts",
|
||||
"test:coverage": "vitest run --coverage --config tests/js/vitest.config.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fontsource/inter": "5.2.8",
|
||||
@@ -39,10 +43,14 @@
|
||||
"@types/dompurify": "^3.2.0",
|
||||
"@types/node": "25.2.3",
|
||||
"@vitejs/plugin-vue": "6.0.4",
|
||||
"@vitest/coverage-v8": "^4.0.18",
|
||||
"@vitest/ui": "^4.0.18",
|
||||
"@vue/eslint-config-prettier": "10.2.0",
|
||||
"@vue/test-utils": "^2.4.6",
|
||||
"@vue/tsconfig": "0.8.1",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-plugin-vue": "10.7.0",
|
||||
"jsdom": "^28.0.0",
|
||||
"prettier": "3.8.1",
|
||||
"sass": "1.97.3",
|
||||
"sass-loader": "16.0.7",
|
||||
@@ -50,6 +58,7 @@
|
||||
"typescript-eslint": "^8.55.0",
|
||||
"vite": "7.3.1",
|
||||
"vite-plugin-static-copy": "^3.2.0",
|
||||
"vitest": "^4.0.18",
|
||||
"vue-cli-plugin-vuetify": "2.5.8",
|
||||
"vue-tsc": "^3.2.4"
|
||||
}
|
||||
|
||||
30
tests/js/unit/base.test.ts
Normal file
30
tests/js/unit/base.test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
|
||||
describe('Basic Tests', () => {
|
||||
it('should perform basic assertion', () => {
|
||||
expect(true).toBe(true)
|
||||
})
|
||||
|
||||
it('should test array operations', () => {
|
||||
const array = ['foo', 'bar', 'baz']
|
||||
|
||||
expect(array).toHaveLength(3)
|
||||
expect(array).toContain('bar')
|
||||
expect(array[0]).toBe('foo')
|
||||
})
|
||||
|
||||
it('should test string operations', () => {
|
||||
const string = 'Hello, World!'
|
||||
|
||||
expect(string).toContain('World')
|
||||
expect(string.length).toBe(13)
|
||||
})
|
||||
|
||||
it('should test object operations', () => {
|
||||
const obj = { foo: 'bar', count: 42 }
|
||||
|
||||
expect(obj).toHaveProperty('foo')
|
||||
expect(obj.foo).toBe('bar')
|
||||
expect(obj.count).toBeGreaterThan(40)
|
||||
})
|
||||
})
|
||||
33
tests/js/vitest.config.ts
Normal file
33
tests/js/vitest.config.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { defineConfig, configDefaults } from 'vitest/config'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vuetify from 'vite-plugin-vuetify'
|
||||
import path from 'path'
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue(), vuetify()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@KTXC': path.resolve(__dirname, '../../core/src'),
|
||||
},
|
||||
},
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
exclude: [...configDefaults.exclude, 'e2e/**'],
|
||||
root: fileURLToPath(new URL('../../', import.meta.url)),
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
reporter: ['text', 'json', 'html'],
|
||||
exclude: [
|
||||
'node_modules/',
|
||||
'tests/',
|
||||
'**/*.d.ts',
|
||||
'**/*.config.*',
|
||||
'**/dist/**',
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||
colors="true"
|
||||
failOnDeprecation="true"
|
||||
failOnNotice="true"
|
||||
failOnWarning="true"
|
||||
bootstrap="tests/php/bootstrap.php"
|
||||
cacheDirectory=".phpunit.cache"
|
||||
bootstrap="bootstrap.php"
|
||||
cacheDirectory="../../.phpunit.cache"
|
||||
>
|
||||
<php>
|
||||
<ini name="display_errors" value="1" />
|
||||
@@ -18,8 +18,8 @@
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Project Test Suite">
|
||||
<directory>tests/php</directory>
|
||||
<testsuite name="Unit Tests">
|
||||
<directory>unit</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
restrictWarnings="true"
|
||||
>
|
||||
<include>
|
||||
<directory>src</directory>
|
||||
<directory>../../core/lib</directory>
|
||||
<directory>../../shared/lib</directory>
|
||||
</include>
|
||||
|
||||
<deprecationTrigger>
|
||||
Reference in New Issue
Block a user