@networkpro/web 1.12.9 → 1.13.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/CHANGELOG.md +65 -1
- package/README.md +26 -18
- package/cspell.json +1 -0
- package/eslint.config.mjs +48 -48
- package/netlify/edge-functions/csp-report.js +31 -31
- package/package.json +3 -3
- package/playwright.config.js +14 -14
- package/postcss.config.mjs +1 -1
- package/scripts/auditScripts.js +16 -16
- package/scripts/bundleCss.js +5 -5
- package/scripts/checkEnv.js +6 -6
- package/scripts/checkNode.js +10 -10
- package/scripts/checkVersions.js +6 -6
- package/scripts/flattenHeaders.js +13 -13
- package/scripts/generateTest.js +5 -5
- package/scripts/openReport.js +3 -3
- package/scripts/validateHeaders.js +13 -13
- package/src/app.html +0 -9
- package/src/hooks.client.ts +1 -1
- package/src/hooks.server.js +31 -32
- package/src/lib/components/Badges.svelte +10 -10
- package/src/lib/components/CodeBlock.svelte +1 -1
- package/src/lib/components/ContainerSection.svelte +1 -1
- package/src/lib/components/FullWidthSection.svelte +3 -3
- package/src/lib/components/LegalNav.svelte +7 -7
- package/src/lib/components/Logo.svelte +9 -9
- package/src/lib/components/MetaTags.svelte +4 -4
- package/src/lib/components/PWAInstallButton.svelte +4 -4
- package/src/lib/components/RedirectPage.svelte +4 -4
- package/src/lib/components/SocialMedia.svelte +16 -16
- package/src/lib/components/foss/FossItemContent.svelte +27 -58
- package/src/lib/components/foss/ObtainiumBlock.svelte +64 -0
- package/src/lib/components/layout/Footer.svelte +18 -18
- package/src/lib/components/layout/HeaderDefault.svelte +16 -16
- package/src/lib/components/layout/HeaderHome.svelte +14 -14
- package/src/lib/data/fossData.js +22 -10
- package/src/lib/images.js +34 -34
- package/src/lib/img/obtainium.png +0 -0
- package/src/lib/img/obtainium.webp +0 -0
- package/src/lib/index.js +15 -15
- package/src/lib/meta.js +29 -29
- package/src/lib/pages/AboutContent.svelte +24 -24
- package/src/lib/pages/FossContent.svelte +13 -13
- package/src/lib/pages/HomeContent.svelte +7 -7
- package/src/lib/pages/LicenseContent.svelte +39 -39
- package/src/lib/pages/PGPContent.svelte +23 -23
- package/src/lib/pages/PrivacyContent.svelte +39 -39
- package/src/lib/pages/PrivacyDashboard.svelte +12 -12
- package/src/lib/pages/TermsConditionsContent.svelte +29 -29
- package/src/lib/pages/TermsUseContent.svelte +26 -26
- package/src/lib/registerServiceWorker.js +25 -25
- package/src/lib/stores/posthog.js +13 -13
- package/src/lib/stores/trackingPreferences.js +19 -19
- package/src/lib/styles/css/default.css +30 -0
- package/src/lib/styles/global.min.css +1 -1
- package/src/lib/types/fossTypes.js +9 -2
- package/src/lib/unregisterServiceWorker.js +1 -1
- package/src/lib/utils/purify.js +4 -4
- package/src/lib/utils/utm.js +2 -2
- package/src/routes/+error.svelte +4 -4
- package/src/routes/+layout.js +6 -6
- package/src/routes/+layout.svelte +29 -29
- package/src/routes/+page.server.js +2 -2
- package/src/routes/+page.svelte +9 -9
- package/src/routes/about/+page.server.js +2 -2
- package/src/routes/about/+page.svelte +7 -7
- package/src/routes/api/mock-csp/+server.js +3 -3
- package/src/routes/consultation/+page.svelte +5 -5
- package/src/routes/contact/+page.svelte +5 -5
- package/src/routes/foss-spotlight/+page.server.js +2 -2
- package/src/routes/foss-spotlight/+page.svelte +7 -7
- package/src/routes/license/+page.server.js +2 -2
- package/src/routes/license/+page.svelte +7 -7
- package/src/routes/pgp/+page.server.js +2 -2
- package/src/routes/pgp/+page.svelte +7 -7
- package/src/routes/pgp/[key]/+server.js +9 -9
- package/src/routes/privacy/+page.server.js +2 -2
- package/src/routes/privacy/+page.svelte +7 -7
- package/src/routes/privacy-dashboard/+page.server.js +2 -2
- package/src/routes/privacy-dashboard/+page.svelte +8 -8
- package/src/routes/privacy-rights/+page.svelte +5 -5
- package/src/routes/status/+page.server.js +2 -2
- package/src/routes/terms-conditions/+page.server.js +2 -2
- package/src/routes/terms-conditions/+page.svelte +7 -7
- package/src/routes/terms-of-use/+page.server.js +2 -2
- package/src/routes/terms-of-use/+page.svelte +7 -7
- package/src/service-worker.js +86 -86
- package/static/bin/heliboard.json +8 -0
- package/static/disableSw.js +2 -2
- package/static/offline.html +7 -7
- package/stylelint.config.js +56 -56
- package/svelte.config.js +6 -6
- package/tests/e2e/app.spec.js +27 -27
- package/tests/e2e/mobile.spec.js +18 -18
- package/tests/e2e/shared/helpers.js +4 -4
- package/tests/internal/auditCoverage.test.js +24 -24
- package/tests/unit/checkEnv.test.js +10 -10
- package/tests/unit/checkVersions.test.js +4 -4
- package/tests/unit/csp-report.test.js +24 -24
- package/tests/unit/demo.test.js +3 -3
- package/tests/unit/lib/utils/purify.test.js +12 -12
- package/tests/unit/routes/page.svelte.test.js +10 -10
- package/tests/unit/unregisterServiceWorker.test.js +5 -5
- package/tests/unit/utm.test.js +13 -13
- package/vite.config.js +5 -5
- package/vitest-setup-client.js +4 -4
- package/vitest.config.client.js +15 -15
- package/vitest.config.server.js +13 -13
|
@@ -17,28 +17,28 @@ This file is part of Network Pro.
|
|
|
17
17
|
/** @file Unit tests for edge-functions/csp-report.js using Vitest */
|
|
18
18
|
/** @typedef {import('vitest').TestContext} TestContext */
|
|
19
19
|
|
|
20
|
-
import { beforeEach, describe, expect, it, vi } from
|
|
21
|
-
import handler from
|
|
20
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
21
|
+
import handler from '../../netlify/edge-functions/csp-report.js';
|
|
22
22
|
|
|
23
23
|
// 🧪 Mock fetch used by sendToNtfy inside the Edge Function
|
|
24
24
|
global.fetch = vi.fn(() =>
|
|
25
|
-
Promise.resolve({ ok: true, status: 200, text: () =>
|
|
25
|
+
Promise.resolve({ ok: true, status: 200, text: () => 'OK' }),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
describe(
|
|
28
|
+
describe('csp-report.js', () => {
|
|
29
29
|
beforeEach(() => {
|
|
30
30
|
vi.clearAllMocks();
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
it(
|
|
34
|
-
const req = new Request(
|
|
35
|
-
method:
|
|
36
|
-
headers: {
|
|
33
|
+
it('should handle a valid CSP report', async () => {
|
|
34
|
+
const req = new Request('http://localhost/api/csp-report', {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
headers: { 'Content-Type': 'application/json' },
|
|
37
37
|
body: JSON.stringify({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
'csp-report': {
|
|
39
|
+
'document-uri': 'https://example.com',
|
|
40
|
+
'violated-directive': 'script-src',
|
|
41
|
+
'blocked-uri': 'https://malicious.site',
|
|
42
42
|
},
|
|
43
43
|
}),
|
|
44
44
|
});
|
|
@@ -47,22 +47,22 @@ describe("csp-report.js", () => {
|
|
|
47
47
|
expect(res.status).toBe(204);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
it(
|
|
51
|
-
const req = new Request(
|
|
52
|
-
method:
|
|
50
|
+
it('should reject non-POST requests', async () => {
|
|
51
|
+
const req = new Request('http://localhost/api/csp-report', {
|
|
52
|
+
method: 'GET',
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
const res = await handler(req, {});
|
|
56
56
|
const text = await res.text();
|
|
57
57
|
expect(res.status).toBe(405);
|
|
58
|
-
expect(text).toContain(
|
|
58
|
+
expect(text).toContain('Method Not Allowed');
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
it(
|
|
62
|
-
const badJson =
|
|
63
|
-
const req = new Request(
|
|
64
|
-
method:
|
|
65
|
-
headers: {
|
|
61
|
+
it('should handle malformed JSON', async () => {
|
|
62
|
+
const badJson = '{ invalid json }';
|
|
63
|
+
const req = new Request('http://localhost/api/csp-report', {
|
|
64
|
+
method: 'POST',
|
|
65
|
+
headers: { 'Content-Type': 'application/json' },
|
|
66
66
|
body: badJson,
|
|
67
67
|
});
|
|
68
68
|
|
|
@@ -70,9 +70,9 @@ describe("csp-report.js", () => {
|
|
|
70
70
|
expect(res.status).toBe(204); // The current handler swallows errors silently
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
it(
|
|
74
|
-
const req = new Request(
|
|
75
|
-
method:
|
|
73
|
+
it('should handle missing body', async () => {
|
|
74
|
+
const req = new Request('http://localhost/api/csp-report', {
|
|
75
|
+
method: 'POST',
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
const res = await handler(req, {});
|
package/tests/unit/demo.test.js
CHANGED
|
@@ -6,10 +6,10 @@ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
|
6
6
|
This file is part of Network Pro.
|
|
7
7
|
========================================================================== */
|
|
8
8
|
|
|
9
|
-
import { describe, expect, it } from
|
|
9
|
+
import { describe, expect, it } from 'vitest';
|
|
10
10
|
|
|
11
|
-
describe(
|
|
12
|
-
it(
|
|
11
|
+
describe('sum test', () => {
|
|
12
|
+
it('adds 1 + 2 to equal 3', () => {
|
|
13
13
|
expect(1 + 2).toBe(3);
|
|
14
14
|
});
|
|
15
15
|
});
|
|
@@ -14,37 +14,37 @@ This file is part of Network Pro.
|
|
|
14
14
|
* @updated 2025-06-01
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { describe, expect, it } from
|
|
18
|
-
import { sanitizeHtml } from
|
|
17
|
+
import { describe, expect, it } from 'vitest';
|
|
18
|
+
import { sanitizeHtml } from '../../../../src/lib/utils/purify.js';
|
|
19
19
|
|
|
20
|
-
describe(
|
|
21
|
-
it(
|
|
20
|
+
describe('sanitizeHtml', () => {
|
|
21
|
+
it('removes dangerous tags like <script>', async () => {
|
|
22
22
|
const dirty = `<div>Hello <script>alert("XSS")</script> world!</div>`;
|
|
23
23
|
const clean = await sanitizeHtml(dirty);
|
|
24
|
-
expect(clean).toBe(
|
|
24
|
+
expect(clean).toBe('<div>Hello world!</div>');
|
|
25
25
|
}); // timeout in ms
|
|
26
26
|
|
|
27
|
-
it(
|
|
27
|
+
it('preserves safe markup like <strong>', async () => {
|
|
28
28
|
const dirty = `<p>This is <strong>important</strong>.</p>`;
|
|
29
29
|
const clean = await sanitizeHtml(dirty);
|
|
30
|
-
expect(clean).toBe(
|
|
30
|
+
expect(clean).toBe('<p>This is <strong>important</strong>.</p>');
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
it(
|
|
33
|
+
it('removes dangerous attributes like onerror', async () => {
|
|
34
34
|
const dirty = `<img src="x" onerror="alert(1)">`;
|
|
35
35
|
const clean = await sanitizeHtml(dirty);
|
|
36
|
-
expect(clean).toBe(
|
|
36
|
+
expect(clean).toBe('<img>');
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
it(
|
|
39
|
+
it('keeps valid external links', async () => {
|
|
40
40
|
const dirty = `<a href="https://example.com">Click</a>`;
|
|
41
41
|
const clean = await sanitizeHtml(dirty);
|
|
42
42
|
expect(clean).toBe('<a href="https://example.com">Click</a>');
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
it(
|
|
45
|
+
it('blocks javascript: URLs', async () => {
|
|
46
46
|
const dirty = `<a href="javascript:alert('XSS')">bad</a>`;
|
|
47
47
|
const clean = await sanitizeHtml(dirty);
|
|
48
|
-
expect(clean).toBe(
|
|
48
|
+
expect(clean).toBe('<a>bad</a>');
|
|
49
49
|
});
|
|
50
50
|
});
|
|
@@ -6,25 +6,25 @@ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
|
6
6
|
This file is part of Network Pro.
|
|
7
7
|
========================================================================== */
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
import { render, screen } from
|
|
11
|
-
import { describe, expect, test } from
|
|
12
|
-
import Page from
|
|
9
|
+
import '@testing-library/jest-dom/vitest';
|
|
10
|
+
import { render, screen } from '@testing-library/svelte';
|
|
11
|
+
import { describe, expect, test } from 'vitest';
|
|
12
|
+
import Page from '../../../src/routes/+page.svelte';
|
|
13
13
|
|
|
14
|
-
describe(
|
|
15
|
-
test(
|
|
14
|
+
describe('/+page.svelte', () => {
|
|
15
|
+
test('should render the home page section', () => {
|
|
16
16
|
const mockData = {
|
|
17
|
-
pathname:
|
|
17
|
+
pathname: '/', // Required because layout uses it
|
|
18
18
|
meta: {
|
|
19
19
|
title:
|
|
20
|
-
|
|
20
|
+
'Locking Down Networks, Unlocking Confidence™ | Security, Networking, Privacy — Network Pro™',
|
|
21
21
|
description:
|
|
22
|
-
|
|
22
|
+
'Locking Down Networks, Unlocking Confidence™ | Security, Networking, Privacy — Network Pro™',
|
|
23
23
|
},
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
render(Page, { props: { data: mockData } });
|
|
27
27
|
|
|
28
|
-
expect(screen.getByTestId(
|
|
28
|
+
expect(screen.getByTestId('home-page')).toBeInTheDocument();
|
|
29
29
|
});
|
|
30
30
|
});
|
|
@@ -6,16 +6,16 @@ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
|
6
6
|
This file is part of Network Pro.
|
|
7
7
|
========================================================================== */
|
|
8
8
|
|
|
9
|
-
import { beforeEach, describe, expect, it, vi } from
|
|
10
|
-
import { unregisterServiceWorker } from
|
|
9
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
10
|
+
import { unregisterServiceWorker } from '../../src/lib/unregisterServiceWorker.js';
|
|
11
11
|
|
|
12
|
-
describe(
|
|
12
|
+
describe('unregisterServiceWorker()', () => {
|
|
13
13
|
beforeEach(() => {
|
|
14
14
|
// Clean up any mocks from previous runs
|
|
15
15
|
vi.restoreAllMocks();
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
it(
|
|
18
|
+
it('should call unregister on all registered service workers', async () => {
|
|
19
19
|
const mockUnregister1 = vi.fn();
|
|
20
20
|
const mockUnregister2 = vi.fn();
|
|
21
21
|
|
|
@@ -24,7 +24,7 @@ describe("unregisterServiceWorker()", () => {
|
|
|
24
24
|
const mockRegistration2 = { unregister: mockUnregister2 };
|
|
25
25
|
|
|
26
26
|
// Stub getRegistrations to return mock service workers
|
|
27
|
-
Object.defineProperty(navigator,
|
|
27
|
+
Object.defineProperty(navigator, 'serviceWorker', {
|
|
28
28
|
configurable: true,
|
|
29
29
|
value: {
|
|
30
30
|
getRegistrations: vi
|
package/tests/unit/utm.test.js
CHANGED
|
@@ -6,44 +6,44 @@ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
|
6
6
|
This file is part of Network Pro.
|
|
7
7
|
========================================================================== */
|
|
8
8
|
|
|
9
|
-
import { appendUTM } from
|
|
10
|
-
import { afterEach, describe, expect, it } from
|
|
9
|
+
import { appendUTM } from '$lib/utils/utm.js';
|
|
10
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
11
11
|
|
|
12
|
-
describe(
|
|
12
|
+
describe('appendUTM', () => {
|
|
13
13
|
const originalWindow = globalThis.window;
|
|
14
14
|
|
|
15
15
|
afterEach(() => {
|
|
16
16
|
globalThis.window = originalWindow;
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
it(
|
|
19
|
+
it('should return null when not in a browser environment', () => {
|
|
20
20
|
// @ts-expect-error – simulating SSR
|
|
21
21
|
delete globalThis.window;
|
|
22
22
|
|
|
23
|
-
const url =
|
|
23
|
+
const url = 'https://example.com';
|
|
24
24
|
const result = appendUTM(url);
|
|
25
25
|
expect(result).toBe(null);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
it(
|
|
28
|
+
it('should return URL with utm_source appended', () => {
|
|
29
29
|
globalThis.window = {
|
|
30
30
|
// @ts-expect-error – mock minimal window for test
|
|
31
|
-
location: { search:
|
|
31
|
+
location: { search: '?utm_source=linkedin' },
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const url =
|
|
34
|
+
const url = 'https://example.com';
|
|
35
35
|
const result = appendUTM(url);
|
|
36
|
-
expect(result).toBe(
|
|
36
|
+
expect(result).toBe('https://example.com?utm_source=linkedin');
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
it(
|
|
39
|
+
it('should return original URL if no utm_source is present', () => {
|
|
40
40
|
globalThis.window = {
|
|
41
41
|
// @ts-expect-error – mock minimal window for test
|
|
42
|
-
location: { search:
|
|
42
|
+
location: { search: '' },
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
const url =
|
|
45
|
+
const url = 'https://example.com';
|
|
46
46
|
const result = appendUTM(url);
|
|
47
|
-
expect(result).toBe(
|
|
47
|
+
expect(result).toBe('https://example.com');
|
|
48
48
|
});
|
|
49
49
|
});
|
package/vite.config.js
CHANGED
|
@@ -6,17 +6,17 @@ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
|
6
6
|
This file is part of Network Pro.
|
|
7
7
|
========================================================================= */
|
|
8
8
|
|
|
9
|
-
import { sveltekit } from
|
|
10
|
-
import { defineConfig } from
|
|
11
|
-
import lightningcssPlugin from
|
|
12
|
-
import tsconfigPaths from
|
|
9
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
10
|
+
import { defineConfig } from 'vite';
|
|
11
|
+
import lightningcssPlugin from 'vite-plugin-lightningcss';
|
|
12
|
+
import tsconfigPaths from 'vite-tsconfig-paths'; // NEW: tsconfig/jsconfig alias support
|
|
13
13
|
|
|
14
14
|
export default defineConfig({
|
|
15
15
|
plugins: [
|
|
16
16
|
tsconfigPaths(), // Insert before sveltekit()
|
|
17
17
|
sveltekit(),
|
|
18
18
|
lightningcssPlugin({
|
|
19
|
-
minify: process.env.NODE_ENV ===
|
|
19
|
+
minify: process.env.NODE_ENV === 'production',
|
|
20
20
|
pruneUnusedFontFaceRules: true,
|
|
21
21
|
pruneUnusedKeyframes: true,
|
|
22
22
|
removeUnusedFontFaces: true,
|
package/vitest-setup-client.js
CHANGED
|
@@ -7,12 +7,12 @@ This file is part of Network Pro.
|
|
|
7
7
|
|
|
8
8
|
/* eslint-env vitest */
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
import { cleanup } from
|
|
12
|
-
import { afterEach, vi } from
|
|
10
|
+
import '@testing-library/jest-dom/vitest';
|
|
11
|
+
import { cleanup } from '@testing-library/svelte';
|
|
12
|
+
import { afterEach, vi } from 'vitest';
|
|
13
13
|
|
|
14
14
|
// required for svelte5 + jsdom as jsdom does not support matchMedia
|
|
15
|
-
Object.defineProperty(window,
|
|
15
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
16
16
|
writable: true,
|
|
17
17
|
enumerable: true,
|
|
18
18
|
value: vi.fn().mockImplementation((query) => ({
|
package/vitest.config.client.js
CHANGED
|
@@ -6,41 +6,41 @@ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
|
6
6
|
This file is part of Network Pro.
|
|
7
7
|
========================================================================= */
|
|
8
8
|
|
|
9
|
-
import { sveltekit } from
|
|
10
|
-
import { svelteTesting } from
|
|
11
|
-
import lightningcssPlugin from
|
|
12
|
-
import { defineConfig } from
|
|
9
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
10
|
+
import { svelteTesting } from '@testing-library/svelte/vite';
|
|
11
|
+
import lightningcssPlugin from 'vite-plugin-lightningcss';
|
|
12
|
+
import { defineConfig } from 'vitest/config';
|
|
13
13
|
|
|
14
14
|
export default defineConfig({
|
|
15
15
|
plugins: [
|
|
16
16
|
sveltekit(),
|
|
17
17
|
svelteTesting(),
|
|
18
18
|
lightningcssPlugin({
|
|
19
|
-
minify: process.env.NODE_ENV ===
|
|
19
|
+
minify: process.env.NODE_ENV === 'production',
|
|
20
20
|
pruneUnusedFontFaceRules: true,
|
|
21
21
|
pruneUnusedKeyframes: true,
|
|
22
22
|
removeUnusedFontFaces: true,
|
|
23
23
|
}),
|
|
24
24
|
],
|
|
25
25
|
test: {
|
|
26
|
-
name:
|
|
27
|
-
environment:
|
|
26
|
+
name: 'client',
|
|
27
|
+
environment: 'jsdom',
|
|
28
28
|
clearMocks: true,
|
|
29
29
|
include: [
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
'tests/unit/**/*.test.{js,mjs,svelte}',
|
|
31
|
+
'tests/internal/**/*.test.{js,mjs,svelte}',
|
|
32
32
|
],
|
|
33
33
|
exclude: [],
|
|
34
|
-
setupFiles: [
|
|
35
|
-
reporters: [
|
|
34
|
+
setupFiles: ['./vitest-setup-client.js'],
|
|
35
|
+
reporters: ['default', 'json'],
|
|
36
36
|
testTimeout: 10000,
|
|
37
37
|
outputFile: {
|
|
38
|
-
json:
|
|
38
|
+
json: './reports/client/results.json',
|
|
39
39
|
},
|
|
40
40
|
coverage: {
|
|
41
|
-
provider:
|
|
42
|
-
reporter: [
|
|
43
|
-
reportsDirectory:
|
|
41
|
+
provider: 'v8',
|
|
42
|
+
reporter: ['html'],
|
|
43
|
+
reportsDirectory: './reports/client/coverage',
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
46
|
});
|
package/vitest.config.server.js
CHANGED
|
@@ -6,34 +6,34 @@ SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
|
6
6
|
This file is part of Network Pro.
|
|
7
7
|
========================================================================= */
|
|
8
8
|
|
|
9
|
-
import { sveltekit } from
|
|
10
|
-
import lightningcssPlugin from
|
|
11
|
-
import { defineConfig } from
|
|
9
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
10
|
+
import lightningcssPlugin from 'vite-plugin-lightningcss';
|
|
11
|
+
import { defineConfig } from 'vitest/config';
|
|
12
12
|
|
|
13
13
|
export default defineConfig({
|
|
14
14
|
plugins: [
|
|
15
15
|
sveltekit(),
|
|
16
16
|
lightningcssPlugin({
|
|
17
|
-
minify: process.env.NODE_ENV ===
|
|
17
|
+
minify: process.env.NODE_ENV === 'production',
|
|
18
18
|
pruneUnusedFontFaceRules: true,
|
|
19
19
|
pruneUnusedKeyframes: true,
|
|
20
20
|
removeUnusedFontFaces: true,
|
|
21
21
|
}),
|
|
22
22
|
],
|
|
23
23
|
test: {
|
|
24
|
-
name:
|
|
25
|
-
environment:
|
|
26
|
-
include: [
|
|
27
|
-
exclude: [
|
|
28
|
-
reporters: [
|
|
24
|
+
name: 'server',
|
|
25
|
+
environment: 'node',
|
|
26
|
+
include: ['tests/unit/**/*.test.{js,mjs}'],
|
|
27
|
+
exclude: ['tests/unit/**/*.svelte.test.{js,mjs}'],
|
|
28
|
+
reporters: ['default', 'json'],
|
|
29
29
|
testTimeout: 10000,
|
|
30
30
|
outputFile: {
|
|
31
|
-
json:
|
|
31
|
+
json: './reports/server/results.json',
|
|
32
32
|
},
|
|
33
33
|
coverage: {
|
|
34
|
-
provider:
|
|
35
|
-
reporter: [
|
|
36
|
-
reportsDirectory:
|
|
34
|
+
provider: 'v8',
|
|
35
|
+
reporter: ['html'],
|
|
36
|
+
reportsDirectory: './reports/server/coverage',
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
});
|