File tree Expand file tree Collapse file tree 4 files changed +22
-7
lines changed Expand file tree Collapse file tree 4 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ module.exports = {
60
60
'/src/cli.ts' ,
61
61
'/src/command-line-arguments.ts' ,
62
62
'/src/interactive-ui.ts' ,
63
+ '/src/dirname.ts' ,
63
64
] ,
64
65
65
66
// Indicates which provider should be used to instrument code for coverage
@@ -218,7 +219,7 @@ module.exports = {
218
219
219
220
// A map from regular expressions to paths to transformers
220
221
transform : {
221
- " \\.[jt]sx?$" : " babel-jest"
222
+ ' \\.[jt]sx?$' : ' babel-jest' ,
222
223
} ,
223
224
224
225
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
Original file line number Diff line number Diff line change
1
+ import { fileURLToPath } from 'url' ;
2
+ import { dirname } from 'path' ;
3
+
4
+ const __filename = fileURLToPath ( import . meta. url ) ;
5
+ const __dirname = dirname ( __filename ) ;
6
+
7
+ /**
8
+ * Get the current directory path.
9
+ *
10
+ * @returns The current directory path.
11
+ */
12
+ export function getCurrentDirectoryPath ( ) {
13
+ return __dirname ;
14
+ }
Original file line number Diff line number Diff line change 1
1
import type { WriteStream } from 'fs' ;
2
- import { fileURLToPath } from 'url' ;
3
- import { dirname , join } from 'path' ;
2
+ import { join } from 'path' ;
4
3
import express from 'express' ;
5
4
import {
6
5
restoreChangelogsForSkippedPackages ,
@@ -25,11 +24,9 @@ import {
25
24
updateYarnLockfile ,
26
25
} from './yarn-commands.js' ;
27
26
import { readFile } from './fs.js' ;
27
+ import { getCurrentDirectoryPath } from './dirname.js' ;
28
28
29
- const __filename = fileURLToPath ( import . meta. url ) ;
30
- const __dirname = dirname ( __filename ) ;
31
-
32
- const UI_BUILD_DIR = join ( __dirname , 'ui' ) ;
29
+ const UI_BUILD_DIR = join ( getCurrentDirectoryPath ( ) , 'ui' ) ;
33
30
34
31
type InteractiveUIOptions = {
35
32
project : Project ;
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ import * as interactiveUi from './interactive-ui.js';
8
8
jest . mock ( './initial-parameters' ) ;
9
9
jest . mock ( './monorepo-workflow-operations' ) ;
10
10
jest . mock ( './interactive-ui' ) ;
11
+ jest . mock ( './dirname' , ( ) => ( {
12
+ getCurrentDirectoryPath : jest . fn ( ) . mockReturnValue ( '/path/to/somewhere' ) ,
13
+ } ) ) ;
11
14
12
15
describe ( 'main' , ( ) => {
13
16
it ( 'executes the monorepo workflow if the project is a monorepo' , async ( ) => {
You can’t perform that action at this time.
0 commit comments