Giter VIP home page Giter VIP logo

Comments (11)

juliangruber avatar juliangruber commented on August 26, 2024

you can use node's require system for this :)

// hello.js
var hello = function () {
  return 'hello';
};
module.exports = hello
// test/test.js
var test = require('tape');
var hello = require('../hello');

test('simple test', function (t) {
  t.ok(true);
  t.end();
});

test('first test', function (t) {
  t.equal(hello(), 'hello');
  t.end();
});

Feel free to open more issues with more questions :)

from tape-run.

juanpabloaj avatar juanpabloaj commented on August 26, 2024

thanks @juliangruber.

but I can't modify hello.js, I can't convert hello.js in a nodejs module.

from tape-run.

juliangruber avatar juliangruber commented on August 26, 2024

ah, I understand. This should be what you're looking for then: https://github.com/thlorenz/browserify-shim

from tape-run.

juanpabloaj avatar juanpabloaj commented on August 26, 2024

Thanks @juliangruber I tried with browserify-shim, but with this I can't use coverify ( https://github.com/substack/coverify/issues/25 ) and I need a way to measure the coverage of the tests

from tape-run.

juanpabloaj avatar juanpabloaj commented on August 26, 2024

the other issue with browserify-shim is browserify-shim is only capable of handling one export per module (thlorenz/browserify-shim#228)

from tape-run.

juliangruber avatar juliangruber commented on August 26, 2024

what about this, with the files as you first posted them:

cat hello.js $(browserify test/*.js) | tape-run

from tape-run.

juanpabloaj avatar juanpabloaj commented on August 26, 2024

thanks @juliangruber this way I can run the test

 cat hello.js <(browserify test/*.js) | tape-run

from tape-run.

juanpabloaj avatar juanpabloaj commented on August 26, 2024

The only issue with this way is coverify only see the code generated by browserify

If I have a new javascript file with a new function called bye

var hello = function () {
  return 'hello';
};

var bye = function () {
  return 'bye bye';
};

And I use the previous test file, coverify don't see than bye is never called

cat hello.js <(browserify -t coverify test/test.js) | tape-run | coverify
TAP version 13
# simple test
ok 1 should be truthy
# hello test
ok 2 should be equal

1..2
# tests 2
# pass  2

# ok

# coverage: 18/18 (100.00 %)

from tape-run.

juliangruber avatar juliangruber commented on August 26, 2024

ok, this is a browserify issue then though. please open an issue there :)

from tape-run.

juliangruber avatar juliangruber commented on August 26, 2024

(or with coverify)

from tape-run.

juanpabloaj avatar juanpabloaj commented on August 26, 2024

from tape-run.

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.