Skip to content

Commit

Permalink
chore: fix tests for Terramate new merge blocks behavior. (#16)
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Natel <[email protected]>
  • Loading branch information
i4ki authored Nov 16, 2023
1 parent 2124077 commit 0569b23
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.17"
go-version: "1.20"
- uses: actions/setup-node@v2
with:
node-version: ^18
Expand All @@ -30,13 +30,13 @@ jobs:
'stable',
'insiders'
]
os: [macos-10.15, ubuntu-20.04, windows-2019]
os: [macos-12, ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.17"
go-version: "1.20"
- uses: actions/setup-node@v2
with:
node-version: ^18
Expand Down
2 changes: 0 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

import * as path from 'path';

import {
workspace,
ExtensionContext,
Expand Down
17 changes: 9 additions & 8 deletions src/test/lint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ suite('Should report diagnostics for the invalid fixtures', () => {
{
name: "invalid/multiple-tm-config-git/tm2.tm",
diags: [new vscode.Diagnostic(
range(begin(2, 8), end(2, 13)),
'multiple terramate.config.git blocks',
range(begin(3, 12), end(3, 26)),
'terramate schema error: attribute "default_branch" redeclared in file',
vscode.DiagnosticSeverity.Error
)]
},
];

testcases.forEach((tc) => {
const testFixture = getDocPath(tc.name);
test('lint file: '+testFixture, async () => {
await testLint(vscode.Uri.file(testFixture), tc.diags);
const file = vscode.Uri.file(testFixture);
test('lint file: '+file, async () => {
await testLint(file, tc.diags);
});
});
});
Expand All @@ -59,17 +60,17 @@ suite('Should not report diagnostics for the valid files', () => {
const filents = fs.readdirSync(dir, {withFileTypes: true});
const fileNames = filents.
filter(filent => filent.isFile()).
map(filent => path.resolve(dir, filent.name));
map(filent => path.resolve(dir, filent.name)).
sort();
if (fileNames.length == 0) {
return;
}

// we chose one file to report diagnostics but other files in the
// directory will be also checked.
const file = fileNames[0];

const file = vscode.Uri.file(path.resolve(testDir, fileNames[0]));
test('test file: '+file, async () => {
await testLint(vscode.Uri.file(path.resolve(testDir, file)), []);
await testLint(file, []);
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion testFixture/invalid/multiple-tm-config-git/tm1.tm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terramate {
config {
git {

default_branch = "main"
}
}
}
2 changes: 1 addition & 1 deletion testFixture/invalid/multiple-tm-config-git/tm2.tm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terramate {
config {
git {

default_branch = "trunk"
}
}
}
File renamed without changes.

0 comments on commit 0569b23

Please sign in to comment.