Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0307ad1

Browse files
committed
fix repeatedly configured tutorial paths bug
1 parent2afc497 commit0307ad1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

‎src/modules/tutorial/reducer.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const _tutorial: CR.Tutorial = {
1111
config:null,
1212
};
1313

14+
constconfigured=[];
15+
1416
exportdefaultfunctiontutorialReducer(
1517
t=_tutorial,action:Action
1618
):CR.Tutorial{
@@ -27,8 +29,11 @@ export default function tutorialReducer(
2729
constcoderoadJsonPath=join(packagePath,packageJson.main);
2830
let{info, pages}=require(coderoadJsonPath);
2931

30-
// configure test paths to absolute paths
31-
pages=configPaths(dir,name,config,pages||[]);
32+
// configure test paths to absolute paths. Only once.
33+
if(configured.indexOf(name)===-1){
34+
pages=configPaths(dir,name,config,pages||[]);
35+
}
36+
configured.push(name);
3237

3338
// return tutorial (info, pages) & tutorial package.json
3439
return{

‎src/modules/tutorial/utils/config-paths.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ function configTestString(
66
):string{
77

88
if(isWindows){
9+
// adjust paths for windows slashes
910
testPath=testPath.split('/').join('\\');
1011
}
1112

13+
// adjust absolute file path
1214
if(config.dir){
1315
testPath=join(config.dir,testPath);
1416
}else{
1517
testPath=join(dir,'node_modules',name,testPath);
1618
}
1719

1820
if(config.testSuffix){
21+
// prevent repeat appending test suffix
1922
testPath+=config.testSuffix;
2023
}
24+
2125
returntestPath;
2226
}
2327

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp