Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Mocha for VS Code",
"description": "Run and debug Mocha tests right within VS Code.",
"publisher": "coderline",
"version": "1.3.1",
"version": "1.3.2",
"icon": "icon.png",
"engines": {
"vscode": "^1.83.0"
Expand Down
16 changes: 16 additions & 0 deletions src/discoverer/evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ export class EvaluationTestDiscoverer implements ITestDiscoverer {
function placeholder(): unknown {
return new Proxy(placeholder, {
get: (obj, target) => {

// ES2026 symbols
// see https://github.com/CoderLine/mocha-vscode/discussions/378
if ('toPrimitive' in Symbol && target === Symbol.toPrimitive) {
return () => {
return '[object Proxy]'
};
}

if ('toStringTag' in Symbol && target === Symbol.toStringTag) {
return () => {
return '[object Proxy]'
};
}

// standard nested proxy accessors
try {
const desc = Object.getOwnPropertyDescriptor(obj, target);
if (desc && !desc.writable && !desc.configurable) {
Expand Down
32 changes: 32 additions & 0 deletions src/test/unit/extract/evaluate-typescript.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,36 @@ describe('evaluate typescript', () => {
},
]);
});

it('extracts basic suite import string', async () => {
const src = await extractWithEvaluation(
"import a from './test';", //
"const _ = String(a)",
"suite('hello', () => {",
" it('works', () => { a() });",
'})',
);
expect(src).to.deep.equal([
{
name: 'hello',
kind: NodeKind.Suite,
startLine: 2,
startColumn: 0,
endColumn: 1,
endLine: 4,
children: [
{
name: 'works',
kind: NodeKind.Test,
startLine: 3,
startColumn: 2,
endColumn: Number.MAX_SAFE_INTEGER,
endLine: 3,
children: [],
},
],
},
]);
});

});
Loading