Learn to test anything with TAP.
- Install Node.js
- Run
sudo npm install test-anything -g
- Run
test-anything
- Select an exercise and go ahead :)
:mortar_board: Learn to test your code
Home Page: http://nodeschool.io/
Learn to test anything with TAP.
sudo npm install test-anything -g
test-anything
In Tape it together there's no mention of fancify being a module whose path is provided in process.argv[2]. I had to look at the solution to see what was wrong since there's no "test-anything run" that would allow me to test the code.
The following solves the exercise 3:
var t = require('tap')
var fancify = require(process.argv[2])
t.is(fancify('Hello'), `~*~Hello~*~`)
t.is(fancify('Hello', true), `~*~HELLO~*~`)
t.is(fancify('Hello', false, '!'), `~!~Hello~!~`)
That feels simpler (e.g. no nesting) than the solution provided:
var test = require('tape')
var fancify = require(process.argv[2])
test('fancify', function (t) {
t.equal(fancify('Wat'), '~*~Wat~*~', 'Wraps a string in ~*~')
t.equal(fancify('Wat', true), '~*~WAT~*~', 'Optionally makes it allcaps')
t.equal(fancify('Wat', false, '%'), '~%~Wat~%~', 'Optionally allows to set the character')
t.end()
})
https://github.com/workshopper/test-anything/blob/master/exercises/tape-it-together/solution.md
Also, no need to write t.end()
, which feels noisy.
So I wonder about possible reasoning behind the more verbose solution to the same problem?
No test-anything run function defined in the challenges i think we should try to keep the node school api consistent by having a run function available even if it only passes the call execution to verify for now
Running each exercise fails due to deprecated support for async functions without callback.
(node:79382) DeprecationWarning: Calling an asynchronous function without callback is deprecated.
Hi.
(when trying i18n support for test-anything.:smile: )
Unfortunately I select the exercise then get Error.:sob:
/Users/tgfjt/.nodebrew/iojs/v2.3.4/lib/node_modules/test-anything/node_modules/cli-md/node_modules/marked/lib/marked.js:1226
throw e;
^
TypeError: this.renderer.text is not a function
Please report this to https://github.com/chjj/marked.
at InlineLexer.output (/Users/tgfjt/.nodebrew/iojs/v2.3.4/lib/node_modules/test-anything/node_modules/cli-md/node_modules/marked/lib/marked.js:685:28)
at Parser.tok (/Users/tgfjt/.nodebrew/iojs/v2.3.4/lib/node_modules/test-anything/node_modules/cli-md/node_modules/marked/lib/marked.js:985:21)
at Parser.parse (/Users/tgfjt/.nodebrew/iojs/v2.3.4/lib/node_modules/test-anything/node_modules/cli-md/node_modules/marked/lib/marked.js:935:17)
at Function.Parser.parse (/Users/tgfjt/.nodebrew/iojs/v2.3.4/lib/node_modules/test-anything/node_modules/cli-md/node_modules/marked/lib/marked.js:922:17)
at marked (/Users/tgfjt/.nodebrew/iojs/v2.3.4/lib/node_modules/test-anything/node_modules/cli-md/node_modules/marked/lib/marked.js:1218:19)
at exports.parse (/Users/tgfjt/.nodebrew/iojs/v2.3.4/lib/node_modules/test-anything/exercises/utils/index.js:7:10)
at Object.<anonymous> (/Users/tgfjt/.nodebrew/iojs/v2.3.4/lib/node_modules/test-anything/exercises/log-it-out/index.js:9:19)
at Module._compile (module.js:430:26)
at Object.Module._extensions..js (module.js:448:10)
at Module.load (module.js:355:32)
New version of marked is not good for marked-terminal.
I see i get a failing test on all the exercises... Is my syntax for running them wrong?
$ test-anything verify app.js
Running any parameter with verify seems to pass all but 1 test, on any exercise...
node: v10.6.0
npm: 6.1.0
installed with nvm: 0.33.11
Output of npm v test-anything:
npm v test-anything
[email protected] | MIT | deps: 6 | versions: 13
Learn to test anything with TAP
https://github.com/finnp/test-anything
keywords: nodeschool, workshopper, learn, cli, tap
bin: test-anything
dist
.tarball https://registry.npmjs.org/test-anything/-/test-anything-1.1.7.tgz
.shasum: 623da2407f78e55ea65852b9d18c5ed9602596f0
dependencies:
adventure-verify: ^2.2.0 adventure: ^2.11.0 cli-md: ^1.0.0 concat-stream: ^1.4.8 tape: ^4.0.0 workshopper-exercise: ^2.3.0
maintainers:
- finnpauls <[email protected]>
dist-tags:
latest: 1.1.7
published a year ago by finnpauls <[email protected]>
When trying to open test-anything, everything seemingly runs fine, but as soon as I select one of the exercises I get an error.
fs.js:133
throw new ERR_INVALID_CALLBACK();
^
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at maybeCallback (fs.js:133:9)
at Object.writeFile (fs.js:1132:14)
at Shop.save (/Users/martin/.nvm/versions/node/v10.6.0/lib/node_modules/test-anything/node_modules/adventure/index.js:288:8)
at Shop.select (/Users/martin/.nvm/versions/node/v10.6.0/lib/node_modules/test-anything/node_modules/adventure/index.js:246:10)
at EventEmitter.<anonymous> (/Users/martin/.nvm/versions/node/v10.6.0/lib/node_modules/test-anything/node_modules/adventure/index.js:278:14)
at EventEmitter.emit (events.js:182:13)
at Menu.<anonymous> (/Users/martin/.nvm/versions/node/v10.6.0/lib/node_modules/test-anything/node_modules/adventure/lib/menu.js:49:22)
at Menu.emit (events.js:182:13)
at Menu.ondata [as _ondata] (/Users/martin/.nvm/versions/node/v10.6.0/lib/node_modules/test-anything/node_modules/terminal-menu/index.js:215:18)
at DestroyableTransform._transform (/Users/martin/.nvm/versions/node/v10.6.0/lib/node_modules/test-anything/node_modules/terminal-menu/index.js:50:18)
Hey @martinheidegger,
what's the deal with workshopper-adventure
. Does it make sense to adopt it? What are the benefits? Also is it planned to merge workshopper-adventure
into workshopper
at some point?
Best,
Finn
The instructions say the parameters will be passed on process.argv[2] and process.argv[3] but the actual solution say process.arg[1] and process.arg[2] I've tired both and node pass ..
I don't think 1 and 2 are possible since the first two elements are the cmd and the path.. But in any case neither solution passes..
Also the first challenge doesn't have a run function maybe it should be refactored to call verify?
ERROR: This problem doesn't have a .run function.
The provided example t.throws(petDog('dachshund'))
can lead the student to wrongly conclude that analogous solution for feedCat
is t.throws(feedCat('chocolate'))
- which fails because throws
wants a function to call, not the value/error from an already called function.
Suggest amending example to:
t.throws(function () {
petDog('dachshund');
})
Or alternatively, using petDog.bind
, like feedCat.bind
in the solution.
Delete this issue, the issue comes to npm,
Sorry
I tried tape it up and couldn't get it to work. Eventually went and found the solution and it didn't work either
I cant get the exercise passed. I took a look at the solution, paste in the solution, verification still failed. Am i missing something?
TAP version 13
# (anonymous)
ok 1 wrong function not accepted
ok 2 wrong function not accepted
ok 3 wrong function not accepted
not ok 4 correct function accepted
---
operator: ok
expected: true
actual: false
at: ChildProcess.<anonymous> (/usr/local/lib/node_modules/test-anything/exercises/utils/index.js:32:7)
...
1..4
# tests 4
# pass 3
# fail 1
I put in the code as the per the challenge "log it out":
var emotify = require(process.argv[2]);
console.log(emotify(process.argv[3]);
same code as the solution
but I get:
➜ test-anything git:(master) test-anything verify log-it-out.js
TAP version 13
# (anonymous)
not ok 1 adds smiley correctly
---
operator: equal
expected: '0.5904866035562009test :)\n'
actual: ''
at: ConcatStream.<anonymous> (/usr/local/lib/node_modules/test-anything/node_modules/concat-stream/index.js:36:43)
...
1..1
# tests 1
# pass 0
# fail 1
#########################################
### YOUR SOLUTION IS NOT CORRECT! ###
#########################################
What am I doing wrong?
Thanks!
Please ignore this the issue was self indlicted
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.