tape: Can't get Tape to work, installs but can't figure out how to use it.

With node.js shell in the project’s root directory: npm install tape --save-dev

In js file added: var test = require('tape');

I get this error in the browser’s console: Uncaught ReferenceError: require is not defined

Trying it from the node.js shell, I enter tape tests/**/*.js as stated in the readme

I get this error: 'tape' is not recognized as an internal or external command, operable program or batch file.

Is there a more basic set of instructions that can take a user from zero to using Tape? Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18

Most upvoted comments

Ah… Node is the butt of all jokes with modern frameworks, node is so 2015. But whatever, it’s all good, to each his own.

lol, node isn’t legacy stuff (PHP is, however, including Laravel), vue has .vue files so I’m sure they have specialized tooling. Rolling your own is always fine, though; good luck!

Several years ago it was quite common to have all your JS in JS only files. But, in the last few years modern frameworks like Vue and Laravel put JS back in with markup or PHP. Being out of it for a few years I can understand why you believe what is actually current practice is outdated. But, things have a tendency to come back.

I any case, it sounds like Tape is not designed for modern frameworks, but for legacy stuff like node. No biggie, thanks for trying to help, I’ll just roll my own.

Still no joy. I thought going with a simple unit test tool would be simple. I guess it’s more designed for advanced users, which is a shame considering unit testing would be more useful to non-advanced users. A good reason not to unit test, it’s too difficult to figure out HOW to unit test.

Got it, will try on Monday.