File tree Expand file tree Collapse file tree 3 files changed +39
-30
lines changed Expand file tree Collapse file tree 3 files changed +39
-30
lines changed Original file line number Diff line number Diff line change 11import { mkdirp } from 'fs-extra'
2- import { URI } from 'vscode-uri'
3- import { stub } from 'sinon'
4- import mock from 'mock-require'
52import { TEMP_DIR , ENV_DIR } from './constants'
3+ require ( '../../vscode/mockModule' )
64
75const importModulesAfterMockingVsCode = ( ) => {
86 const { removeDir } = require ( '../../fileSystem' )
@@ -12,32 +10,6 @@ const importModulesAfterMockingVsCode = () => {
1210 return { removeDir, runMocha, setupVenv }
1311}
1412
15- class MockEventEmitter {
16- public fire ( ) {
17- return stub ( )
18- }
19-
20- public event ( ) {
21- return stub ( )
22- }
23- }
24-
25- mock ( 'vscode' , {
26- EventEmitter : MockEventEmitter ,
27- Uri : {
28- file : URI . file
29- }
30- } )
31-
32- mock ( '@hediet/std/disposable' , {
33- Disposable : {
34- fn : ( ) => ( {
35- track : < T > ( disposable : T ) : T => disposable ,
36- untrack : ( ) => undefined
37- } )
38- }
39- } )
40-
4113const { setupVenv, removeDir, runMocha } = importModulesAfterMockingVsCode ( )
4214
4315async function main ( ) {
Original file line number Diff line number Diff line change 1+ import { URI } from 'vscode-uri'
2+ import { stub } from 'sinon'
3+ import mock from 'mock-require'
4+
5+ class MockEventEmitter {
6+ public fire ( ) {
7+ return stub ( )
8+ }
9+
10+ public event ( ) {
11+ return stub ( )
12+ }
13+ }
14+
15+ mock ( 'vscode' , {
16+ EventEmitter : MockEventEmitter ,
17+ Uri : {
18+ file : URI . file
19+ }
20+ } )
21+
22+ mock ( '@hediet/std/disposable' , {
23+ Disposable : {
24+ fn : ( ) => ( {
25+ track : < T > ( disposable : T ) : T => disposable ,
26+ untrack : ( ) => undefined
27+ } )
28+ }
29+ } )
Original file line number Diff line number Diff line change 11import { join , resolve } from 'path'
2- import { setupVenv } from 'dvc/src/python'
2+ require ( 'dvc/src/vscode/mockModule' )
3+
4+ const importModuleAfterMockingVsCode = ( ) => {
5+ const { setupVenv } = require ( 'dvc/src/python' )
6+
7+ return setupVenv
8+ }
9+
10+ const setupVenv = importModuleAfterMockingVsCode ( )
311
412const cwd = resolve ( __dirname , '..' , 'demo' )
513
You can’t perform that action at this time.
0 commit comments