mirror of
https://github.com/go-gitea/gitea
synced 2026-02-03 11:10:40 +00:00
snapshots
This commit is contained in:
@@ -17,26 +17,40 @@ test('filters workflow command lines from log output', () => {
|
||||
{index: 9, timestamp: 1008, message: 'Build complete'},
|
||||
];
|
||||
|
||||
const expectedVisibleMessages = [
|
||||
'Starting build process',
|
||||
'Running tests...',
|
||||
'Test suite started',
|
||||
'::workflow-command::echo some-output',
|
||||
'All tests passed',
|
||||
'Build complete',
|
||||
];
|
||||
|
||||
const visibleLines = filterLogLines(inputLogLines);
|
||||
|
||||
expect(visibleLines.length).toBe(6);
|
||||
|
||||
const visibleMessages = visibleLines.map((line) => line.message);
|
||||
expect(visibleMessages).toEqual(expectedVisibleMessages);
|
||||
|
||||
expect(visibleMessages).not.toContain('::add-matcher::.github/problem-matcher.json');
|
||||
expect(visibleMessages).not.toContain('##[add-matcher].github/eslint.json');
|
||||
expect(visibleMessages).toContain('::workflow-command::echo some-output');
|
||||
expect(visibleMessages).not.toContain('::remove-matcher::owner=eslint');
|
||||
expect(filterLogLines(inputLogLines)).toMatchInlineSnapshot(`
|
||||
[
|
||||
{
|
||||
"index": 1,
|
||||
"message": "Starting build process",
|
||||
"timestamp": 1000,
|
||||
},
|
||||
{
|
||||
"index": 3,
|
||||
"message": "Running tests...",
|
||||
"timestamp": 1002,
|
||||
},
|
||||
{
|
||||
"index": 5,
|
||||
"message": "Test suite started",
|
||||
"timestamp": 1004,
|
||||
},
|
||||
{
|
||||
"index": 6,
|
||||
"message": "::workflow-command::echo some-output",
|
||||
"timestamp": 1005,
|
||||
},
|
||||
{
|
||||
"index": 7,
|
||||
"message": "All tests passed",
|
||||
"timestamp": 1006,
|
||||
},
|
||||
{
|
||||
"index": 9,
|
||||
"message": "Build complete",
|
||||
"timestamp": 1008,
|
||||
},
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
test('preserves non-workflow command lines including group commands', () => {
|
||||
@@ -49,12 +63,33 @@ test('preserves non-workflow command lines including group commands', () => {
|
||||
{index: 6, timestamp: 1005, message: 'Done'},
|
||||
];
|
||||
|
||||
const visibleLines = filterLogLines(inputLogLines);
|
||||
|
||||
expect(visibleLines.length).toBe(5);
|
||||
|
||||
const visibleMessages = visibleLines.map((line) => line.message);
|
||||
expect(visibleMessages).toContain('::group::Installation');
|
||||
expect(visibleMessages).toContain('::endgroup::');
|
||||
expect(visibleMessages).not.toContain('::add-matcher::.github/npm.json');
|
||||
expect(filterLogLines(inputLogLines)).toMatchInlineSnapshot(`
|
||||
[
|
||||
{
|
||||
"index": 1,
|
||||
"message": "Normal log line",
|
||||
"timestamp": 1000,
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"message": "::group::Installation",
|
||||
"timestamp": 1001,
|
||||
},
|
||||
{
|
||||
"index": 3,
|
||||
"message": "Installing dependencies",
|
||||
"timestamp": 1002,
|
||||
},
|
||||
{
|
||||
"index": 5,
|
||||
"message": "::endgroup::",
|
||||
"timestamp": 1004,
|
||||
},
|
||||
{
|
||||
"index": 6,
|
||||
"message": "Done",
|
||||
"timestamp": 1005,
|
||||
},
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// Copyright 2025 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
export type LogLine = {
|
||||
index: number;
|
||||
timestamp: number;
|
||||
|
||||
Reference in New Issue
Block a user