|
| 1 | +/** |
| 2 | + * Copyright (C) Daniel Kuschny (Danielku15) and contributors. |
| 3 | + * Copyright (C) Microsoft Corporation. All rights reserved. |
| 4 | + * |
| 5 | + * Use of this source code is governed by an MIT-style |
| 6 | + * license that can be found in the LICENSE file or at |
| 7 | + * https://opensource.org/licenses/MIT. |
| 8 | + */ |
| 9 | + |
| 10 | +import { expect } from 'chai'; |
| 11 | +import * as vscode from 'vscode'; |
| 12 | +import { captureTestRun, expectTestTree, getController } from '../util'; |
| 13 | + |
| 14 | +describe('typescript-esm', () => { |
| 15 | + it('discovers tests', async () => { |
| 16 | + const c = await getController(); |
| 17 | + |
| 18 | + expectTestTree(c, [['test', [['hello.spec.ts', [['import-meta', [['dirname']]]]]]]]); |
| 19 | + }); |
| 20 | + |
| 21 | + it('runs tests', async () => { |
| 22 | + const c = await getController(); |
| 23 | + const profiles = c.profiles; |
| 24 | + expect(profiles).to.have.lengthOf(2); |
| 25 | + |
| 26 | + const run = await captureTestRun( |
| 27 | + c, |
| 28 | + new vscode.TestRunRequest( |
| 29 | + undefined, |
| 30 | + undefined, |
| 31 | + profiles.find((p) => p.kind === vscode.TestRunProfileKind.Run), |
| 32 | + ), |
| 33 | + ); |
| 34 | + |
| 35 | + run.expectStates({ |
| 36 | + 'test/hello.spec.ts/import-meta/dirname': ['enqueued', 'started', 'passed'], |
| 37 | + }); |
| 38 | + }); |
| 39 | + |
| 40 | + it('debugs tests', async () => { |
| 41 | + const c = await getController(); |
| 42 | + const profiles = c.profiles; |
| 43 | + expect(profiles).to.have.lengthOf(2); |
| 44 | + |
| 45 | + const run = await captureTestRun( |
| 46 | + c, |
| 47 | + new vscode.TestRunRequest( |
| 48 | + undefined, |
| 49 | + undefined, |
| 50 | + profiles.find((p) => p.kind === vscode.TestRunProfileKind.Debug), |
| 51 | + ), |
| 52 | + ); |
| 53 | + |
| 54 | + run.expectStates({ |
| 55 | + 'test/hello.spec.ts/import-meta/dirname': ['enqueued', 'started', 'passed'], |
| 56 | + }); |
| 57 | + }); |
| 58 | +}); |
0 commit comments