ebt-vue3 2.54.52 → 2.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nameforma/task/0Pt4Lwr7004e2GXovkeA7W.json +78 -0
- package/.nameforma/world.json +13 -0
- package/package.json +10 -10
- package/test/audio-store.mjs +1 -2
- package/test/idb-sutta.mjs +2 -2
- package/test/test-setup.mjs +26 -1
- package/test/test-utils.mjs +21 -2
- package/vitest.config.js +19 -0
- package/scripts/i18n-translate.mjs +0 -66
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "0Pt4Lwr7004e2GXovkeA7W",
|
|
3
|
+
"name": "Replace mocha with vitest",
|
|
4
|
+
"summary": "",
|
|
5
|
+
"rawActions": [
|
|
6
|
+
{
|
|
7
|
+
"id": "0Pt4NH8W004e2GXovkeA7W",
|
|
8
|
+
"name": "Install vitest and update package.json",
|
|
9
|
+
"summary": "",
|
|
10
|
+
"status": "done",
|
|
11
|
+
"statusNote": "done: vitest installed, npm scripts updated, all 134 tests passing"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "0Pt4NH9L004e2GXovkeA7W",
|
|
15
|
+
"name": "Create vitest config (vitest.config.js or inline in vite.config.js)",
|
|
16
|
+
"summary": "",
|
|
17
|
+
"status": "done",
|
|
18
|
+
"statusNote": "done: vitest.config.js created with setupFiles for fake-indexeddb"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "0Pt4NHAC004e2GXovkeA7W",
|
|
22
|
+
"name": "Update test/test-setup.mjs for vitest (setupFiles config)",
|
|
23
|
+
"summary": "",
|
|
24
|
+
"status": "done",
|
|
25
|
+
"statusNote": "done: mocha this.timeout() syntax replaced with vitest timeout options"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": "0Pt4NHB4004e2GXovkeA7W",
|
|
29
|
+
"name": "Update npm test scripts in package.json",
|
|
30
|
+
"summary": "",
|
|
31
|
+
"status": "done",
|
|
32
|
+
"statusNote": "done: npm test scripts using vitest"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "0Pt4NHBx004e2GXovkeA7W",
|
|
36
|
+
"name": "Run full test suite to verify compatibility",
|
|
37
|
+
"summary": "",
|
|
38
|
+
"status": "done",
|
|
39
|
+
"statusNote": "done: full test suite runs, 134 tests passing"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "0Pt4NHCn004e2GXovkeA7W",
|
|
43
|
+
"name": "Remove mocha and vulnerable dependencies (diff, serialize-javascript)",
|
|
44
|
+
"summary": "",
|
|
45
|
+
"status": "done",
|
|
46
|
+
"statusNote": "done: mocha and vulnerable dependencies removed, 0 vulnerabilities"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "0Pt4QO6z004e2GXovkeA7W",
|
|
50
|
+
"name": "Fix test/audio-store.mjs (6 failing tests - indexedDB environment)",
|
|
51
|
+
"summary": "",
|
|
52
|
+
"status": "done",
|
|
53
|
+
"statusNote": "done: test/audio-store.mjs all 9 tests passing"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "0Pt4QO7q004e2GXovkeA7W",
|
|
57
|
+
"name": "Fix test/suttas-store.mjs (3 failing tests - indexedDB environment)",
|
|
58
|
+
"summary": "",
|
|
59
|
+
"status": "done",
|
|
60
|
+
"statusNote": "done: test/suttas-store.mjs all 8 tests passing"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"id": "0Pt4QO8i004e2GXovkeA7W",
|
|
64
|
+
"name": "Fix test/idb-audio.mjs (3 failing tests - indexedDB environment)",
|
|
65
|
+
"summary": "",
|
|
66
|
+
"status": "done",
|
|
67
|
+
"statusNote": "done: test/idb-audio.mjs all 8 tests passing"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "0Pt4QO9Y004e2GXovkeA7W",
|
|
71
|
+
"name": "Fix unhandled rejection errors (indexedDB, document)",
|
|
72
|
+
"summary": "",
|
|
73
|
+
"status": "done",
|
|
74
|
+
"statusNote": "done: document mock resolves unhandled rejection errors"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"rawReferences": []
|
|
78
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ebt-vue3",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.55.1",
|
|
4
4
|
"description": "Vue3 Library for SuttaCentral Voice EBT-Sites",
|
|
5
5
|
"author": "Karl Lew",
|
|
6
6
|
"scripts": {
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"schedule-action": "scripts/schedule-action",
|
|
24
24
|
"update:vuetify": "scripts/update-vuetify",
|
|
25
25
|
"test": "npm run test:verbose",
|
|
26
|
-
"test:one": "
|
|
27
|
-
"test:test": "
|
|
28
|
-
"test:verbose": "
|
|
29
|
-
"test:watch": "
|
|
30
|
-
"test:debug": "
|
|
26
|
+
"test:one": "vitest -t TESTTEST",
|
|
27
|
+
"test:test": "vitest -t TESTTEST",
|
|
28
|
+
"test:verbose": "vitest",
|
|
29
|
+
"test:watch": "vitest --watch",
|
|
30
|
+
"test:debug": "vitest --inspect-brk --inspect --no-coverage",
|
|
31
31
|
"test:coverage": "echo 'Coverage not configured yet'",
|
|
32
32
|
"version": "scripts/version.sh",
|
|
33
33
|
"vite": "vite",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"merkle-json": "^2.15.0",
|
|
47
47
|
"pinia": "^2.0.16",
|
|
48
48
|
"roboto-fontface": "*",
|
|
49
|
-
"scv-esm": "^1.136.
|
|
49
|
+
"scv-esm": "^1.136.54",
|
|
50
50
|
"serve-favicon": "^2.5.0",
|
|
51
|
-
"uuid": "^
|
|
51
|
+
"uuid": "^14.0.0",
|
|
52
52
|
"vite-plugin-vuetify": "^2.0.3",
|
|
53
53
|
"vue": "^3.4.21",
|
|
54
54
|
"vue-i18n": "^9.10.2",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@babel/eslint-parser": "^7.24.0",
|
|
61
61
|
"@eslint/js": "^9.16.0",
|
|
62
62
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
63
|
+
"@vitest/ui": "^4.1.5",
|
|
63
64
|
"@vue/tsconfig": "^0.5.1",
|
|
64
|
-
"ebt-deepl": "^1.58.0",
|
|
65
65
|
"eslint": "^9.16.0",
|
|
66
66
|
"eslint-plugin-vue": "^9.28.0",
|
|
67
67
|
"execa": "^6.1.0",
|
|
@@ -71,7 +71,6 @@
|
|
|
71
71
|
"markdown-it": "^14.1.1",
|
|
72
72
|
"markdown-it-footnote": "^3.0.3",
|
|
73
73
|
"memo-again": "^0.13.0",
|
|
74
|
-
"mocha": "^11.7.5",
|
|
75
74
|
"mock-local-storage": "^1.0.4",
|
|
76
75
|
"node-fetch": "^3.2.10",
|
|
77
76
|
"prettier": "^3.3.3",
|
|
@@ -80,6 +79,7 @@
|
|
|
80
79
|
"supertest": "^7.0.0",
|
|
81
80
|
"typescript": "^5.9.3",
|
|
82
81
|
"vite": "^6.3.5",
|
|
82
|
+
"vitest": "^4.1.5",
|
|
83
83
|
"vue-cli-plugin-vuetify": "^2.0.6",
|
|
84
84
|
"vue-tsc": "^2.1.10"
|
|
85
85
|
},
|
package/test/audio-store.mjs
CHANGED
|
@@ -31,8 +31,7 @@ const MSDAY = 24*3600*MSSEC;
|
|
|
31
31
|
const SERVER_ROOT = 'https://www.api.sc-voice.net/scv';
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
(typeof describe === 'function') && describe("stores/audio.mjs", function () {
|
|
35
|
-
this.timeout(5*1000);
|
|
34
|
+
(typeof describe === 'function') && describe("stores/audio.mjs", { timeout: 5*1000 }, function () {
|
|
36
35
|
beforeEach(() => {
|
|
37
36
|
window.localStorage = global.localStorage
|
|
38
37
|
setActivePinia(createPinia());
|
package/test/idb-sutta.mjs
CHANGED
|
@@ -368,8 +368,8 @@ const TESTMLDOC_EN = {
|
|
|
368
368
|
);
|
|
369
369
|
should(dstSutta.segments.length).equal(4);
|
|
370
370
|
});
|
|
371
|
-
it("TESTTESThighlightExamples()", async function() {
|
|
372
|
-
|
|
371
|
+
it("TESTTESThighlightExamples()", { timeout: 5000 }, async function() {
|
|
372
|
+
// Examples.replaceAll requires time to load/process data
|
|
373
373
|
logger.logLevel = "error";
|
|
374
374
|
let suttaBefore = IdbSutta.create(TESTMLDOC_EN);
|
|
375
375
|
let suttaAfter = IdbSutta.create(TESTMLDOC_EN);
|
package/test/test-setup.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Global test setup for ebt-vue3
|
|
3
|
-
* This file is automatically loaded
|
|
3
|
+
* This file is automatically loaded before running tests
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import 'fake-indexeddb/auto';
|
|
6
7
|
import { setupTestEnvironment } from './test-utils.mjs';
|
|
8
|
+
import { afterEach } from 'vitest';
|
|
7
9
|
|
|
8
10
|
// Setup global test environment
|
|
9
11
|
setupTestEnvironment();
|
|
@@ -21,4 +23,27 @@ if (typeof process !== 'undefined' && process.env.LOG_LEVEL) {
|
|
|
21
23
|
process.env.LOG_LEVEL = 'warn';
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
// Track unhandled errors during tests
|
|
27
|
+
let unhandledErrors = [];
|
|
28
|
+
|
|
29
|
+
const originalOnError = process.listeners('uncaughtException');
|
|
30
|
+
const originalOnRejection = process.listeners('unhandledRejection');
|
|
31
|
+
|
|
32
|
+
process.on('uncaughtException', (err) => {
|
|
33
|
+
unhandledErrors.push(err);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
process.on('unhandledRejection', (reason) => {
|
|
37
|
+
unhandledErrors.push(new Error(`Unhandled Rejection: ${reason}`));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Fail test if unhandled errors occurred
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
if (unhandledErrors.length > 0) {
|
|
43
|
+
const err = unhandledErrors[0];
|
|
44
|
+
unhandledErrors = [];
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
24
49
|
console.log('Test environment setup complete');
|
package/test/test-utils.mjs
CHANGED
|
@@ -41,6 +41,24 @@ export const mockLocalStorage = () => {
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Mock document object for Node.js environment
|
|
46
|
+
*/
|
|
47
|
+
export const mockDocument = () => {
|
|
48
|
+
if (global.document) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
global.document = {
|
|
53
|
+
getElementById: () => null,
|
|
54
|
+
getElementsByClassName: () => [],
|
|
55
|
+
querySelector: () => null,
|
|
56
|
+
querySelectorAll: () => [],
|
|
57
|
+
createElement: () => ({}),
|
|
58
|
+
createTextNode: () => ({}),
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
44
62
|
/**
|
|
45
63
|
* Mock window object for Node.js environment
|
|
46
64
|
*/
|
|
@@ -48,7 +66,7 @@ export const mockWindow = () => {
|
|
|
48
66
|
if (!global.window) {
|
|
49
67
|
global.window = {};
|
|
50
68
|
}
|
|
51
|
-
|
|
69
|
+
|
|
52
70
|
// Add localStorage to window if not present
|
|
53
71
|
if (!global.window.localStorage && global.localStorage) {
|
|
54
72
|
global.window.localStorage = global.localStorage;
|
|
@@ -62,8 +80,9 @@ export const mockWindow = () => {
|
|
|
62
80
|
*/
|
|
63
81
|
export const setupTestEnvironment = (options = {}) => {
|
|
64
82
|
const { navigatorLanguages = ['en-US'] } = options;
|
|
65
|
-
|
|
83
|
+
|
|
66
84
|
mockNavigator(navigatorLanguages);
|
|
67
85
|
mockLocalStorage();
|
|
86
|
+
mockDocument();
|
|
68
87
|
mockWindow();
|
|
69
88
|
};
|
package/vitest.config.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import { default as EbtConfig } from './ebt-config.mjs'
|
|
4
|
+
import vuetify from 'vite-plugin-vuetify'
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
base: EbtConfig.basePath,
|
|
8
|
+
plugins: [
|
|
9
|
+
vue(),
|
|
10
|
+
vuetify({ autoImport: true }),
|
|
11
|
+
],
|
|
12
|
+
test: {
|
|
13
|
+
globals: true,
|
|
14
|
+
environment: 'node',
|
|
15
|
+
setupFiles: ['test/test-setup.mjs'],
|
|
16
|
+
include: ['test/**/*.mjs'],
|
|
17
|
+
exclude: ['node_modules', '.git', 'local', 'test/test-setup.mjs', 'test/test-utils.mjs'],
|
|
18
|
+
},
|
|
19
|
+
})
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
import { default as EN } from "../src/i18n/en.mjs"
|
|
6
|
-
import {
|
|
7
|
-
DeepLAdapter,
|
|
8
|
-
} from "ebt-deepl";
|
|
9
|
-
|
|
10
|
-
let [nodePath, scriptPath, ...args] = process.argv;
|
|
11
|
-
let script = path.basename(scriptPath);
|
|
12
|
-
const msg = `${script}`;
|
|
13
|
-
|
|
14
|
-
const srcLang = 'en';
|
|
15
|
-
let [ dstLang ] = args;
|
|
16
|
-
if (dstLang == null) {
|
|
17
|
-
console.log(msg, "[1] Expected destination language code");
|
|
18
|
-
process.exit(-1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let outPath = path.join(scriptPath, '../../src/i18n', `${dstLang}.mjs`);
|
|
22
|
-
|
|
23
|
-
(async()=>{
|
|
24
|
-
let dlt = await DeepLAdapter.create({srcLang, dstLang});
|
|
25
|
-
|
|
26
|
-
async function translate(src, dst={}) {
|
|
27
|
-
const msg = `${script}.translate()`;
|
|
28
|
-
let keys = Object.keys(src);
|
|
29
|
-
for (let i=0; i<keys.length; i++) {
|
|
30
|
-
let key = keys[i];
|
|
31
|
-
let srcVal = src[key];
|
|
32
|
-
if (key === 'languageCode') {
|
|
33
|
-
switch (dstLang) {
|
|
34
|
-
case 'it':
|
|
35
|
-
dst[key] = "Italiano / IT";
|
|
36
|
-
break;
|
|
37
|
-
case 'pt':
|
|
38
|
-
dst[key] = "Português / PT";
|
|
39
|
-
break;
|
|
40
|
-
case 'es':
|
|
41
|
-
dst[key] = "Español / ES";
|
|
42
|
-
break;
|
|
43
|
-
case 'ru':
|
|
44
|
-
dst[key] = "Русский / RU";
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
} else if (typeof srcVal === 'object') {
|
|
48
|
-
console.warn(msg, '[2]object', key);
|
|
49
|
-
dst[key] = await translate(srcVal);
|
|
50
|
-
} else {
|
|
51
|
-
let trans = await dlt.translate([srcVal]);
|
|
52
|
-
console.warn(msg, '[3]translate', key, trans);
|
|
53
|
-
dst[key] = trans[0];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return dst;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
let xlt = await translate(EN);
|
|
60
|
-
console.warn(msg, '[4]writing', outPath);
|
|
61
|
-
|
|
62
|
-
let json = JSON.stringify(xlt, null, 2);
|
|
63
|
-
let js = 'export default ' + json;
|
|
64
|
-
await fs.promises.writeFile(outPath, js);
|
|
65
|
-
console.warn(msg, '[5]done');
|
|
66
|
-
})();
|