Skip to content

Commit edbaebd

Browse files
committed
chore: added the tests
1 parent 33817e0 commit edbaebd

File tree

10 files changed

+5650
-1308
lines changed

10 files changed

+5650
-1308
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,16 @@ Complete logout implementation that properly terminates both the local session a
131131
```javascript
132132
import helmet from 'helmet';
133133

134-
app.use(helmet({
135-
contentSecurityPolicy: {
136-
directives: {
137-
defaultSrc: ["'self'"],
138-
scriptSrc: ["'self'", "'unsafe-eval'", "'unsafe-inline'"],
134+
app.use(
135+
helmet({
136+
contentSecurityPolicy: {
137+
directives: {
138+
defaultSrc: ["'self'"],
139+
scriptSrc: ["'self'", "'unsafe-eval'", "'unsafe-inline'"],
140+
},
139141
},
140-
},
141-
}));
142+
}),
143+
);
142144
```
143145

144146
At minimum, configure:

eslint.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,20 @@ export default [
2525
...tsPlugin.configs.recommended.rules,
2626
},
2727
},
28+
{
29+
files: [
30+
'**/*.test.ts',
31+
'**/*.test.js',
32+
'**/*.spec.ts',
33+
'**/*.spec.js',
34+
'test/**/*.ts',
35+
'test/**/*.js',
36+
],
37+
languageOptions: {
38+
globals: {
39+
...globals.jest,
40+
...globals.node,
41+
},
42+
},
43+
},
2844
];

jest.config.mjs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
export default {
2+
preset: 'ts-jest/presets/default-esm',
3+
transform: {
4+
'^.+\\.m?[tj]sx?$': [
5+
'ts-jest',
6+
{
7+
useESM: true,
8+
tsconfig: 'tsconfig.jest.json',
9+
},
10+
],
11+
},
12+
testEnvironment: 'node',
13+
testMatch: ['**/*.+(spec|test).[tj]s?(x)'],
14+
moduleFileExtensions: [
15+
'ts',
16+
'tsx',
17+
'js',
18+
'mjs',
19+
'jsx',
20+
'mts',
21+
'json',
22+
'node',
23+
],
24+
testPathIgnorePatterns: ['/node_modules/', '/frontend/', '/dist/'],
25+
resetModules: false,
26+
collectCoverage: true,
27+
coverageDirectory: './build/coverage',
28+
collectCoverageFrom: ['src/**/*.{ts,tsx,js,jsx}', '!src/**/*.d.ts'],
29+
coverageReporters: ['clover', 'cobertura', 'lcov'],
30+
coveragePathIgnorePatterns: ['/dist/', '/node_modules/'],
31+
testTimeout: 60000,
32+
globalSetup: './test/setup.js',
33+
extensionsToTreatAsEsm: ['.ts', '.tsx', '.mts'],
34+
moduleNameMapper: {
35+
'^(\\.{1,2}/.*)\\.js$': '$1',
36+
},
37+
reporters: [
38+
'default',
39+
[
40+
'jest-junit',
41+
{
42+
outputDirectory: './build/reports',
43+
outputName: 'junit.xml',
44+
},
45+
],
46+
],
47+
};

knip.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line no-undef
12
module.exports = {
23
ignoreDependencies: ['handlebars'],
34
};

0 commit comments

Comments
 (0)