Skip to content

Commit

Permalink
try to add options
Browse files Browse the repository at this point in the history
  • Loading branch information
lcxfs1991 committed May 7, 2018
1 parent 64d2e75 commit 88af706
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
Empty file modified .steamer/task/git-commit.js
100755 → 100644
Empty file.
Empty file modified .steamer/task/git-pull.js
100755 → 100644
Empty file.
Empty file modified .steamer/task/git-push.js
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class TaskPlugin extends SteamerPlugin {
let pkgJson = {};

if (this.fs.existsSync(pkgJsonPath)) {
pkgJson = require(path.join(taskPath, 'package.json'));
pkgJson = require(pkgJsonPath);
}

let dependencies = pkgJson.dependencies || {};
Expand Down
8 changes: 7 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ describe('add', function() {

let existCount = 0;
let existsSyncStub = sinon.stub(task.fs, 'existsSync').callsFake((taskPath) => {
// console.log(taskPath, taskPath.includes('steamer-plugin-task.js'));
if (!existCount && taskPath.includes('node_modules/steamer-task-alloyteam')) {
existCount++;
return false;
}
if (taskPath.includes('package.json')) {
return false;
}
return true;
});
let spawnSyncStub = sinon.stub(task.spawn, 'sync').callsFake((npm, cmds, options) => {
Expand All @@ -64,6 +66,9 @@ describe('add', function() {
}
copyCount++;
});
let readdirSyncStub = sinon.stub(task.fs, 'readdirSync').callsFake((dirPath) => {
return ['steamer-plugin-jb.js', 'steamer-plugin-task.js', 'task'];
});
let infoStub = sinon.stub(task, 'info');
let successStub = sinon.stub(task, 'success');

Expand All @@ -81,6 +86,7 @@ describe('add', function() {
coppySyncStub.restore();
infoStub.restore();
successStub.restore();
readdirSyncStub.restore();
});
});

Expand Down

0 comments on commit 88af706

Please sign in to comment.