-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The test was rewritten to use `node:test`.
- Loading branch information
1 parent
fa14735
commit 71f7300
Showing
3 changed files
with
16 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
out/ | ||
*.md | ||
.vscode-test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
const assert = require('node:assert') | ||
const assert = require('node:assert/strict') | ||
const fs = require('node:fs/promises') | ||
const path = require('node:path') | ||
|
||
const {test} = require('node:test') | ||
const {commands, extensions, window, workspace} = require('vscode') | ||
|
||
module.exports.run = async () => { | ||
const filePath = path.join(__dirname, 'test.md') | ||
try { | ||
const ext = extensions.getExtension('unifiedjs.vscode-remark') | ||
await ext?.activate() | ||
|
||
const ext = extensions.getExtension('unifiedjs.vscode-remark') | ||
await ext?.activate() | ||
|
||
await test('use the language server', async () => { | ||
await fs.writeFile(filePath, '- remark\n- lsp\n- vscode\n') | ||
const doc = await workspace.openTextDocument(filePath) | ||
await window.showTextDocument(doc) | ||
await commands.executeCommand('editor.action.formatDocument') | ||
|
||
assert.equal( | ||
doc.getText(), | ||
'* remark\n* lsp\n* vscode\n', | ||
'format document' | ||
) | ||
} catch (error) { | ||
throw error | ||
} finally { | ||
await fs.rm(filePath) | ||
} | ||
assert.equal(doc.getText(), '* remark\n* lsp\n* vscode\n') | ||
}) | ||
|
||
await fs.rm(filePath, {force: true}) | ||
} |