Git Product home page Git Product logo

Comments (7)

evanlucas avatar evanlucas commented on August 28, 2024 5

Yes, this exercise purposefully compares stdout of both your script and one executing the expected way. Closing as this is by design. (If you have a better way of doing this, I am all ears :])

from learnyoumongo.

SergioEnrique avatar SergioEnrique commented on August 28, 2024 3

Same issue:
OSX 10.11.1, Node v0.12.7, Mongo v3.2.4, Learnyoumongo v3.0.1

from learnyoumongo.

crispinha avatar crispinha commented on August 28, 2024

Exercise 6 works, which makes me think that this is a bug, but E5 does use console.log for checking answers, so this might be by design. I'll have a look in the code and report back.
Part 2:
This line might be what's doing it, I'll check on an offline copy.
EDIT: Not by itself. I don't understand Workshopper to do anything more than guess at what does what, so I don't think I can do any more here.
Part 3:
I'm trying out some alternatives to console log:

  • console.warn() - no luck
  • console.error() - nope
  • console.dir() - nothing

Part 4:
It's not a platform-specific thing, it fails on Ubuntu 14.04.4 with Node v4.4.0, Mongo v2.4.9, and learnyoumongo v3.0.1

Part 5 (24/3/2016 NZDT):
I've tried commenting out all instances of "stdout" in insert/exercise.js. No luck. A quick check of the diff between this exercise and the one before shows nothing that would be blocking console.log.

from learnyoumongo.

domparry avatar domparry commented on August 28, 2024

Same issue here on OSX 10.11.1

from learnyoumongo.

domparry avatar domparry commented on August 28, 2024

I seem to have found something. The line:

exercise = comparestdout(exercise)

is missing from Exercise 5. It's just after the line:

exercise = execute(exercise)

in exercise 4. Once I add it, I get messages to the console....

from learnyoumongo.

domparry avatar domparry commented on August 28, 2024

Update: So the above does allow me to see my console.log outputs, but it breaks the verify processor. Seems this exercise implements it's own processor as follows, which breaks Stdout somehow. I still can't figure out where yet:

exercise.addProcessor(function(mode, cb) {
var orig
this.submissionStdout.pipe(sub)
var args = this.solutionArgs
sub.on('data', function(chunk) {
chunk = chunk.toString()
if (chunk)
try {
orig = JSON.parse(chunk)
delete orig._id
}
catch (err) {
exercise.emit('fail', 'Unable to parse JSON. ' +
'Did you stringify the output?')
cb(err)
}
})

if (mode === 'verify') {
sub.on('end', function() {
if (orig) {
findDoc(args, function(err, doc) {
if (err) return cb(err)
orig = sortObj(orig)
doc = sortObj(doc)
try {
compare(orig, doc)
cb(null, true)
}
catch (e) {
console.log(e)
exercise.emit('fail', e.message)
cb(null, false)
}
//sub.end()
})
} else {
cb(null, false)
}
})
}
this.submissionStdout = through2()
if (mode === 'verify')
this.solutionStdout = through2()

if (mode === 'run') {
sub.pipe(process.stdout)
process.nextTick(function() {
cb(null, true)
})
}
})

from learnyoumongo.

manters2000 avatar manters2000 commented on August 28, 2024

Having the same issue here, can't also get to work this problem here in my end.

from learnyoumongo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.