Comments (11)
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.
thanks @juliangruber.
but I can't modify hello.js
, I can't convert hello.js
in a nodejs module.
from tape-run.
ah, I understand. This should be what you're looking for then: https://github.com/thlorenz/browserify-shim
from tape-run.
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.
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.
what about this, with the files as you first posted them:
cat hello.js $(browserify test/*.js) | tape-run
from tape-run.
thanks @juliangruber this way I can run the test
cat hello.js <(browserify test/*.js) | tape-run
from tape-run.
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.
ok, this is a browserify issue then though. please open an issue there :)
from tape-run.
(or with coverify)
from tape-run.
from tape-run.
Related Issues (20)
- Inconsistent environments for `tape-run` and `tape-run -p` HOT 1
- window.location.search goes wild HOT 5
- Doesn't say much upon errors HOT 7
- support for other bundler webpack and rollup HOT 2
- webpack-tape-run HOT 1
- `</script>` tags inside the JS input causing errors. HOT 1
- How to resize the browser window HOT 3
- How to reset browser window state between tests? HOT 2
- Weird static files behaviour with and without --port HOT 7
- Errors on Travis HOT 2
- Pipe to "tap-mocha-reporter" doesn't work
- Doesn't work on Ubuntu 18.04 HOT 5
- Outdated Deps? HOT 3
- internal/streams/legacy.js:59 unhandled stream error on pipe HOT 1
- --node and --basedir appear to not be working HOT 3
- Does not work in WSL HOT 3
- Use a more recent browser-run version to pass the no-sandbox option to electron-stream HOT 2
- option `--browser=chrome` not working HOT 4
- tape-run is triggering some dependabot alerts HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tape-run.