Skip to content

Commit

Permalink
fix(core): filter out entering logs for bastard
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Mar 9, 2021
1 parent 6a17153 commit 1cd8ce1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
13 changes: 11 additions & 2 deletions packages/core/lib/actions/log/md.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion packages/core/src/actions/log/md.coffee.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ nikita(async function(){
state = {}
await @call $: log_fs, config, serializer:
'nikita:action:start': ({action}) ->
act = action.parent
bastard = undefined
while act
bastard = act.metadata.bastard
break if bastard isnt undefined
act = act.parent
content = []
if config.enter and action.metadata.module and action.metadata.log isnt false
if config.enter and action.metadata.module and action.metadata.log isnt false and bastard isnt true
content.push "\nEntering #{action.metadata.module} (#{(action.metadata.position.map (index) -> index + 1).join '.'})\n"
return content.join '' unless action.metadata.header
walk = (parent) ->
Expand Down
15 changes: 15 additions & 0 deletions packages/core/test/actions/log/md.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,18 @@ describe 'actions.log.md', ->
.should.be.resolvedWith
data: "\nEntering @nikitajs/core/src/actions/call (1.3)\n"

they 'filtered out for bastards action', ({ssh}) ->
nikita
$ssh: ssh
$tmpdir: true
, ({metadata: {tmpdir}}) ->
await @log.md basedir: tmpdir
await @call
$unless_exists: "#{tmpdir}/toto"
$if: -> @call -> false
, (->)
@fs.base.readFile
target: "#{tmpdir}/localhost.log"
encoding: 'ascii'
.should.be.resolvedWith
data: "\nEntering @nikitajs/core/src/actions/call (1.2)\n"

0 comments on commit 1cd8ce1

Please sign in to comment.