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

Commite0a4381

Browse files
committed
windows fix
1 parenta49135b commite0a4381

File tree

10 files changed

+39
-47
lines changed

10 files changed

+39
-47
lines changed

‎lib/reducers/alert/alert.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,29 @@ function alertReducer(alert, action) {
2424
varresult=action.payload.result;
2525
if(result.pass&&result.change>0){
2626
statusBarAlert.style.color='#73C990';
27-
current={
27+
return{
2828
message:result.msg,
2929
open:true,
3030
action:'pass',
3131
duration:result.duration||1500
3232
};
33-
returncurrent;
3433
}
3534
elseif(result.pass===false&&result.change<1){
3635
statusBarAlert.style.color='#FF4081';
37-
current={
36+
return{
3837
message:result.msg,
3938
open:true,
4039
action:'fail',
4140
duration:result.duration||2500
4241
};
43-
returncurrent;
4442
}
4543
statusBarAlert.style.color='#9DA5B4';
46-
current={
44+
return{
4745
message:result.msg,
4846
open:true,
4947
action:'note',
5048
duration:result.duration||2500
5149
};
52-
returncurrent;
5350
caseType.PAGE_COMPLETE:
5451
return{
5552
message:"Page "+(action.payload.position.page+1)+" Complete",

‎lib/reducers/run-tests/run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function runTaskTests(setup) {
66
if(tests&&tests.length){
77
varconfig=window.coderoad;
88
config.taskPosition=_base_1.store.getState().taskPosition;
9-
window.coderoad.runner(tests,config,test_result_1.handleResult,test_result_1.handleLog);
9+
window.coderoad.runner(tests,config,test_result_1.handleResult);
1010
}
1111
returntrue;
1212
}

‎lib/reducers/run-tests/test-result.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,3 @@ function handleResult(result) {
1717
}
1818
exports.handleResult=handleResult;
1919
;
20-
functionhandleLog(message){
21-
console.log(message);
22-
_base_1.store.dispatch(Action.logMessage(message));
23-
}
24-
exports.handleLog=handleLog;

‎lib/reducers/task-tests/concat-tests.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@ function concatTests(targetFile, files) {
44
if(fs.existsSync(targetFile)){
55
fs.unlink(targetFile);
66
}
7-
files.forEach(function(test){
8-
if(typeoftest==='string'){
9-
readAppend(targetFile,test);
10-
}
11-
});
7+
files.forEach(function(test){returnreadAppend(targetFile,test);});
128
returntargetFile;
139
}
1410
exports.concatTests=concatTests;
1511
functionreadAppend(targetFile,file){
1612
try{
1713
vardata=fs.readFileSync(file,'utf8');
1814
fs.appendFileSync(targetFile,data,'utf8');
15+
return;
1916
}
2017
catch(e){
2118
console.log('Error reading test file',e);

‎lib/services/exists.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
varfs=require('fs');
33
functionfileExists(pathToFile){
44
try{
5-
fs.accessSync(pathToFile,fs.R_OK|fs.W_OK);
5+
fs.accessSync(pathToFile,fs.F_OK);
66
}
77
catch(e){
88
if(e){

‎lib/services/package.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ var PackageService = (function () {
4444
varconfig=this.config.config;
4545
return!tasks ?[] :tasks.map(function(task){
4646
if(task.tests){
47-
task.tests=task.tests.map(function(tests){
48-
if(_.isString(tests)){
49-
returnconfigTestString(config,_this.packageName,tests);
47+
task.tests=task.tests.map(function(test){
48+
if(_.isString(test)&&task.tests.indexOf(test)===-1){
49+
returnconfigTestString(config,_this.packageName,test);
5050
}
5151
else{
52-
console.error('Invalid task test',tests);
52+
console.error('Invalid task test',test);
5353
}
5454
});
5555
}

‎lib/services/setGlobals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function loadRunnerDep(config) {
3232
}
3333
varslash=navigator.appVersion.indexOf('Win')!==-1 ?'\\' :'/';
3434
runnerMain=path.join.apply(null,runnerMain.split(slash));
35-
runnerRoot=runnerRoot.substring(0,runnerRoot.lastIndexOf('/'));
35+
runnerRoot=runnerRoot.substring(0,runnerRoot.lastIndexOf(slash));
3636
varpathToMain=path.join(runnerRoot,runnerMain);
3737
if(!!require(pathToMain).default){
3838
window.coderoad.runner=require(pathToMain).default;

‎lib/services/setup-checks.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ function verifySetupComplete() {
77
hasDirectory()
88
.then(hasPackageJson)
99
.then(hasTutorialDep)
10-
.then(hasTestRunner)
1110
.then(function(){
1211
_base_1.store.dispatch(Action.setupWarning(null));
1312
_base_1.store.dispatch(Action.loadTutorials());
@@ -66,20 +65,6 @@ function hasTutorialDep() {
6665
resolve();
6766
});
6867
}
69-
functionhasTestRunner(){
70-
returnnewPromise(function(resolve,reject){
71-
varhasTestRunner=true;
72-
if(!hasTestRunner){
73-
reject({
74-
key:'noTestRunner',
75-
title:'Error with Tutorial',
76-
click:null,
77-
text:'no test runner found'
78-
});
79-
}
80-
resolve();
81-
});
82-
}
8368
function_hasKeys(obj){
8469
returnObject.keys(obj).length>0;
8570
}

‎lib/services/tutorials.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
varpath=require('path');
33
varfs=require('fs');
44
varexists_1=require('../services/exists');
5+
vartutorialError='This is an error with the tutorial itself';
56
functionpackageJsonExists(){
67
varpathToPackageJson=path.join(window.coderoad.dir,'package.json');
78
returnexists_1.fileExists(pathToPackageJson);
@@ -17,14 +18,31 @@ function loadRootPackageJson() {
1718
exports.loadRootPackageJson=loadRootPackageJson;
1819
function_isTutorial(name){
1920
varpathToTutorialPackageJson=path.join(window.coderoad.dir,'node_modules',name,'package.json');
20-
if(exists_1.fileExists(pathToTutorialPackageJson)){
21-
varpackageJson=JSON.parse(fs.readFileSync(pathToTutorialPackageJson,'utf8'));
22-
if(packageJson.main&&packageJson.main.match(/coderoad.json$/)){
23-
varpathToCoderoadJson=path.join(window.coderoad.dir,'node_modules',name,packageJson.main);
24-
returnexists_1.fileExists(pathToCoderoadJson);
25-
}
26-
}
27-
returnfalse;
21+
if(!exists_1.fileExists(pathToTutorialPackageJson)){
22+
console.log("Error with "+name+": no package.json file found. "+tutorialError);
23+
returnfalse;
24+
}
25+
varpackageJson=JSON.parse(fs.readFileSync(pathToTutorialPackageJson,'utf8'));
26+
if(!packageJson.main&&packageJson.main.match(/coderoad.json$/)){
27+
console.log("Error with "+name+": main does not load a coderoad.json file. "+tutorialError);
28+
returnfalse;
29+
}
30+
varpathToCoderoadJson=path.join(window.coderoad.dir,'node_modules',name,packageJson.main);
31+
if(!exists_1.fileExists(pathToCoderoadJson)){
32+
console.log("Error with "+name+": no coderoad.json file. "+tutorialError);
33+
returnfalse;
34+
}
35+
;
36+
if(!packageJson.config||!packageJson.config.testRunner){
37+
console.log("Error with "+name+": no test runner specified. "+tutorialError);
38+
returnfalse;
39+
}
40+
varpathToTestRunner=path.join(window.coderoad.dir,'node_modules',packageJson.config.testRunner);
41+
if(!exists_1.fileExists(pathToTestRunner)){
42+
console.log("Error with "+name+": "+packageJson.config.testRunner+" test runner not installed");
43+
returnfalse;
44+
}
45+
returntrue;
2846
}
2947
functionsearchForTutorials(deps){
3048
if(!!deps&&Object.keys(deps).length>0){

‎src/services/setGlobals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function loadRunnerDep(config: PackageJson) {
3737
letslash=navigator.appVersion.indexOf('Win')!==-1 ?'\\' :'/';
3838
runnerMain=path.join.apply(null,runnerMain.split(slash));
3939
// trim root path to folder
40-
runnerRoot=runnerRoot.substring(0,runnerRoot.lastIndexOf('/'));
40+
runnerRoot=runnerRoot.substring(0,runnerRoot.lastIndexOf(slash));
4141

4242
letpathToMain=path.join(runnerRoot,runnerMain);
4343

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp