Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
Enable TypeScript hint for *.js
Browse files Browse the repository at this point in the history
Follow #17 and preparation for #20
  • Loading branch information
kachick committed May 13, 2024
1 parent f631f51 commit 0d48a55
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions test/suite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function run() {

const testsRoot = path.resolve(__dirname, "..");

return new Promise((resolve, reject) => {
return /** @type {Promise<void>} */ (new Promise((resolve, reject) => {
// add the test in this particular order.
// this is so that first the workspace is opened,
// and then the files without causing extra window reloads
Expand All @@ -30,7 +30,7 @@ function run() {
} catch (err) {
reject(err);
}
});
}));
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion test/suite/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const sleep = util.promisify(setTimeout);
* @param {string} dirPath absolute path to test case directory
*/
async function caseDirTest(dirPath) {
process.env.XDG_CONFIG_HOME = path.join(dirPath, "xdg-config-home");
process.env["XDG_CONFIG_HOME"] = path.join(dirPath, "xdg-config-home");

const give = (await vscode.workspace.openTextDocument(vscode.Uri.file(path.join(dirPath, "input.yaml")))).getText();
const want = (await vscode.workspace.openTextDocument(vscode.Uri.file(path.join(dirPath, "result.yaml")))).getText();
Expand Down
3 changes: 3 additions & 0 deletions test/suite/workspace.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ suite("workspace", () => {
for (const tc of testCases) {
test(tc, async () => {
const wsf = vscode.workspace.getWorkspaceFolder(vscode.Uri.file(path.join(casesDir, tc)));
if (!wsf) {
throw Error;
}
await caseDirTest(wsf.uri.fsPath);
});
}
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": ["@tsconfig/strictest/tsconfig", "@tsconfig/node20/tsconfig"],
"compilerOptions": {
"outDir": "out",
"noUnusedLocals": false
"noUnusedLocals": false,
"checkJs": true
},
"include": ["**/*.ts"]
"include": ["**/*.ts", "**/*.js"]
}

0 comments on commit 0d48a55

Please sign in to comment.