Skip to content

Commit

Permalink
test: Add fixture for sap.ui.suite project
Browse files Browse the repository at this point in the history
There are some special circumstances when linting sap.ui.suite which
were detected by manual testing.
Some findings were only reported with a newer version of UI5 linter.

It turned out that #290 changed
the behavior and fixed the reporting of deprecations within the same
library, as previously the @sapui5/types were not loaded properly.

It is still unknown why exactly this was happening, but it is fixed now
and the added test project should ensure that no similar issues will
appear in the future.
  • Loading branch information
matz3 committed Sep 13, 2024
1 parent d1ab9bc commit 32b5486
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 0 deletions.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sap.ui.define([
"sap/ui/suite/TaskCircle",
"sap/m/DateTimeInput"
], function(TaskCircle, DateTimeInput) {
"use strict";
// The linter used to only detect the DateTimeInput deprecation in this file.
// It has been solved via https://github.com/SAP/ui5-linter/pull/290.
// This test ensures that it continues to work.
});
14 changes: 14 additions & 0 deletions test/lib/linter/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,17 @@ test.serial("lint: All files of library with sap.f namespace", async (t) => {

t.snapshot(preprocessLintResultsForSnapshot(res));
});

test.serial("lint: All files of library with sap.ui.suite namespace", async (t) => {
const projectPath = path.join(fixturesProjectsPath, "sap.ui.suite");
const {lintProject} = t.context;

const res = await lintProject({
rootDir: projectPath,
pathsToLint: [],
reportCoverage: true,
includeMessageDetails: true,
});

t.snapshot(preprocessLintResultsForSnapshot(res));
});
48 changes: 48 additions & 0 deletions test/lib/linter/snapshots/linter.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -1163,3 +1163,51 @@ Generated by [AVA](https://avajs.dev).
warningCount: 0,
},
]

## lint: All files of library with sap.ui.suite namespace

> Snapshot 1
[
{
coverageInfo: [],
errorCount: 0,
fatalErrorCount: 0,
filePath: 'src/sap/ui/suite/library.js',
messages: [],
warningCount: 0,
},
{
coverageInfo: [],
errorCount: 0,
fatalErrorCount: 0,
filePath: 'src/sap/ui/suite/TaskCircle.js',
messages: [],
warningCount: 0,
},
{
coverageInfo: [],
errorCount: 2,
fatalErrorCount: 0,
filePath: 'test/sap/ui/suite/qunit/TaskCircle.qunit.js',
messages: [
{
column: 2,
line: 2,
message: 'Import of deprecated module \'sap/ui/suite/TaskCircle\'',
messageDetails: 'Deprecated test message',
ruleId: 'ui5-linter-no-deprecated-api',
severity: 2,
},
{
column: 2,
line: 3,
message: 'Import of deprecated module \'sap/m/DateTimeInput\'',
messageDetails: 'Deprecated test message',
ruleId: 'ui5-linter-no-deprecated-api',
severity: 2,
},
],
warningCount: 0,
},
]
Binary file modified test/lib/linter/snapshots/linter.ts.snap
Binary file not shown.

0 comments on commit 32b5486

Please sign in to comment.