Skip to content

Commit

Permalink
test: Fix troublesome test for ui5.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
maxreichmann committed Apr 15, 2024
1 parent 6d42145 commit 286b7e8
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/linter/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ function transformVirtualPathToFilePath(
return path.join(srcFsBasePath, posixPath.relative(srcVirBasePath, virtualPath));
} else if (testFsBasePath && testVirBasePath && virtualPath.startsWith(testVirBasePath)) {
return path.join(testFsBasePath, posixPath.relative(testVirBasePath, virtualPath));
} else if (virtualPath.startsWith("/")) {
return posixPath.relative("/", virtualPath);
} else {
throw new Error(
`Resource path ${virtualPath} is not located within the virtual source or test directories of the project`);
Expand Down
2 changes: 1 addition & 1 deletion src/linter/yaml/UI5YamlLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class UI5YamlLinter {
#resourcePath = "";
#context: LinterContext;

constructor(content: string, resourcePath: string, context: LinterContext) {
constructor(resourcePath: string, content: string, context: LinterContext) {
this.#content = content;
this.#resourcePath = resourcePath;
this.#context = context;
Expand Down
2 changes: 1 addition & 1 deletion test/lib/linter/UI5YamlLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ framework:
const context = new LinterContext({rootDir: projectPath});

// Create UI5YamlLinter instance with resource content
const linter = new UI5YamlLinter(resourceContent, resourcePath, context);
const linter = new UI5YamlLinter(resourcePath, resourceContent, context);
// Run UI5YamlLinter report
await linter.lint();

Expand Down
20 changes: 19 additions & 1 deletion test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -1227,4 +1227,22 @@ Generated by [AVA](https://avajs.dev).

> Snapshot 1
[]
[
{
coverageInfo: [],
errorCount: 1,
fatalErrorCount: 0,
filePath: 'ui5.yaml',
messages: [
{
column: 7,
fatal: undefined,
line: 11,
message: 'Use of deprecated library \'sap.landvisz\'',
ruleId: 'ui5-linter-no-deprecated-api',
severity: 2,
},
],
warningCount: 0,
},
]
Binary file modified test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap
Binary file not shown.
Binary file modified test/lib/linter/snapshots/linter.ts.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion test/lib/linter/xmlTemplate/snapshots/transpiler.ts.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Snapshot report for `test/lib/linter/xml/transpiler.ts`
# Snapshot report for `test/lib/linter/xmlTemplate/transpiler.ts`

The actual snapshot is saved in `transpiler.ts.snap`.

Expand Down

0 comments on commit 286b7e8

Please sign in to comment.