2023-01-29 09:08:50 -05:00
|
|
|
import path from 'path';
|
|
|
|
import request from 'supertest';
|
2024-09-29 09:03:29 -05:00
|
|
|
import { test } from 'vitest';
|
2023-01-29 09:08:50 -05:00
|
|
|
|
|
|
|
import { HTTP_STATUS } from '@verdaccio/core';
|
2023-02-04 05:34:33 -05:00
|
|
|
import { logger, setup } from '@verdaccio/logger';
|
2023-01-29 09:08:50 -05:00
|
|
|
|
|
|
|
import { log } from '../src';
|
|
|
|
import { getApp } from './helper';
|
|
|
|
|
|
|
|
setup({
|
|
|
|
type: 'file',
|
|
|
|
path: path.join(__dirname, './verdaccio.log'),
|
|
|
|
level: 'trace',
|
|
|
|
format: 'json',
|
|
|
|
});
|
|
|
|
|
|
|
|
test('should log request', async () => {
|
|
|
|
const app = getApp([]);
|
|
|
|
// @ts-ignore
|
2023-02-04 05:34:33 -05:00
|
|
|
app.use(log(logger));
|
2023-01-29 09:08:50 -05:00
|
|
|
// @ts-ignore
|
|
|
|
app.get('/:package', (req, res) => {
|
|
|
|
res.status(HTTP_STATUS.OK).json({});
|
|
|
|
});
|
|
|
|
|
|
|
|
// TODO: pending output
|
|
|
|
return request(app).get('/react').expect(HTTP_STATUS.OK);
|
|
|
|
});
|