Browse Source

fix(test): correct Vue event assertion and modernize build configs

- Fix ContactListItem test assertion for open-offer-dialog event emission
- Convert config files from CommonJS to ESM using .mts extensions
- Remove unused vite.config.utils.js file
- All 326 tests now passing with 1 skipped

The Vue event test was expecting emittedData[0] to be an array, but
emittedData itself contains the emitted parameters. Config files now
use modern ESM syntax with .mts extensions for better tooling support.

Note: Vite CJS deprecation warning persists due to Vitest 2.x/Vite 5.x
compatibility - this is a known issue that doesn't affect functionality.
pull/153/head
Matthew Raymer 21 hours ago
parent
commit
ee35719cd5
  1. 2
      jest.config.mts
  2. 2
      postcss.config.mts
  3. 2
      src/test/ContactListItem.test.ts
  4. 55
      src/vite.config.utils.js
  5. 2
      tailwind.config.mts

2
jest.config.js → jest.config.mts

@ -1,4 +1,4 @@
module.exports = { export default {
preset: 'ts-jest', preset: 'ts-jest',
testEnvironment: 'node', testEnvironment: 'node',
moduleFileExtensions: ['ts', 'js', 'json', 'vue'], moduleFileExtensions: ['ts', 'js', 'json', 'vue'],

2
postcss.config.js → postcss.config.mts

@ -1,4 +1,4 @@
module.exports = { export default {
plugins: { plugins: {
tailwindcss: {}, tailwindcss: {},
autoprefixer: {}, autoprefixer: {},

2
src/test/ContactListItem.test.ts

@ -179,7 +179,7 @@ describe("ContactListItem", () => {
expect(wrapper.emitted("open-offer-dialog")).toBeTruthy(); expect(wrapper.emitted("open-offer-dialog")).toBeTruthy();
// Test that both parameters are emitted correctly // Test that both parameters are emitted correctly
const emittedData = wrapper.emitted("open-offer-dialog")[0]; const emittedData = wrapper.emitted("open-offer-dialog")[0];
expect(emittedData[0]).toEqual(["did:ethr:test:other", contact.name]); expect(emittedData).toEqual(["did:ethr:test:other", contact.name]);
}); });
}); });

55
src/vite.config.utils.js

@ -1,55 +0,0 @@
import * as path from "path";
import { promises as fs } from "fs";
import { fileURLToPath } from "url";
export async function loadAppConfig() {
const packageJson = await loadPackageJson();
const appName = process.env.TIME_SAFARI_APP_TITLE || packageJson.name;
const __dirname = path.dirname(fileURLToPath(import.meta.url));
return {
pwaConfig: {
manifest: {
name: appName,
short_name: appName,
icons: [
{
src: "./img/icons/android-chrome-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "./img/icons/android-chrome-512x512.png",
sizes: "512x512",
type: "image/png",
},
{
src: "./img/icons/android-chrome-maskable-192x192.png",
sizes: "192x192",
type: "image/png",
purpose: "maskable",
},
{
src: "./img/icons/android-chrome-maskable-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
},
},
aliasConfig: {
"@": path.resolve(path.dirname(__dirname), "src"),
buffer: path.resolve(path.dirname(__dirname), "node_modules", "buffer"),
"dexie-export-import/dist/import":
"dexie-export-import/dist/import/index.js",
},
};
}
async function loadPackageJson() {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const packageJsonPath = path.resolve(path.dirname(__dirname), "package.json");
const packageJsonData = await fs.readFile(packageJsonPath, "utf-8");
return JSON.parse(packageJsonData);
}

2
tailwind.config.js → tailwind.config.mts

@ -1,5 +1,5 @@
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
module.exports = { export default {
content: ["./src/**/*.vue"], content: ["./src/**/*.vue"],
theme: { theme: {
extend: {}, extend: {},
Loading…
Cancel
Save