Comments (11)
@lorenzofox3 Tried it out and I am getting typescript build errors:
✖ 3 problems (0 errors, 3 warnings)
node_modules/zora/dist/declarations/interfaces.d.ts:78:46 - error TS2304: Cannot find name 'AsyncIterable'.
78 export interface TestHarness extends Assert, AsyncIterable<Message<any>>, Counter {
~~~~~~~~~~~~~
node_modules/zora/dist/declarations/interfaces.d.ts:98:14 - error TS2304: Cannot find name 'AsyncIterable'.
98 (stream: AsyncIterable<Message<any>>): Promise<void>;
~~~~~~~~~~~~~
node_modules/zora/dist/declarations/interfaces.d.ts:106:31 - error TS2304: Cannot find name 'AsyncIterable'.
106 export interface Test extends AsyncIterable<Message<any>>, TestResult, Counter {
~~~~~~~~~~~~~
from zora.
@corbinu I think AsyncIterable are still under esnext
for typescript. In your tsconfi file you need to add it as lib
from zora.
@lorenzofox3 Thanks that helps I had 2018 in there. Do I have to use rollup now on a node project if I want the tests in multiple files?
I really liked the old system where you could export a plan. Any chance of bringing back something where you wrap the tests in a file in a plan and export them up to an index file?
from zora.
@lorenzofox3 Thanks that helps I had 2018 in there. Do I have to use rollup now on a node project if I want the tests in multiple files?
no, just require
your test files in some entry point such ./test/index.js
, node will concat the files for you.
I really liked the old system where you could export a plan. Any chance of bringing back something where you wrap the tests in a file in a plan and export them up to an index file?
You can still do it (cf previous comment). If you want some more "logic grouping" you can export a sub test:
// ./test/foo.js
module.exports = t => {
t.test('foo test', t => {
t.ok(true)
})
//etc
}
// ./test/index.js
const {test} = require('zora');
test('./foo.js', require('./foo.js'))
// etc
You can of course use fs
or some globby module to automatically load all your test files in the index. Congratulation you have built your first test runner on top of zora :)
from zora.
@lorenzofox3 Sorry to keep having so many questions. That works however I can't seem to import the type definitions
from zora.
TestFunction
is not exported, it is used internally
from zora.
Ok how am I supposed to type these tests then?
from zora.
Ok how am I supposed to type these tests then?
what these tests
refer to ? I am not sure to understand your question.
The type system shall know what test
function expect even though its argument types are not exported:
If you wish to build on top of zora and manipulate SpecFunction
on your code base, indeed it might be easier if zora was exposing this type and at some point it might make sense to expose it as it is a public argument but it should not be blocking:
You can create in your code base your own interface with the same signature and actually it would be probably be safer. Your code shall be responsible to call the zora functions with the appropriate types and typescript will enforce it. If you blindly copy types around you might be in trouble as any changes in zora types will force you to change your api too. Whereas if you use your own types, the only part you would have to change would be the private part of your code which provide valid arguments to zora api.
I try to be conservative in what it is exposed to avoid eventual breaking changes
Maybe you could provide a small repo setup so I can understand your problem.
from zora.
@lorenzofox3 The problem is since I have my tests in separate files I need to import just the type. I have never seen TypeScript project withhold the types to avoid breakage before. Usually I see that as the way to upgrade a TypeScript dep is to depend on the types to show me the breakage. If this is the not a priority I understand.
from zora.
@corbinu I published a new version with exported types !
from zora.
Perfect working great!
from zora.
Related Issues (20)
- module-loader es is not treating my test files as es modules HOT 3
- fast-deep-equal HOT 3
- Improve comparison/diff HOT 2
- pta and typescript HOT 3
- Difference to Tape / AVA? HOT 1
- Add examples for Svelte, Vue and React HOT 1
- Structured comparison HOT 6
- Switching between character/line diff? HOT 1
- Assert type problems: can't extend assertion types in TypeScript
- Improve diff reporter HOT 6
- Bad type-declaration for `throws` HOT 1
- Pipe error handling (write EPIPE) HOT 2
- Inconsistent behaviour of tap reporters HOT 2
- Empty test.ts file in the node-ts example HOT 1
- build npm package HOT 3
- Zora + pta doesn't work with top level dynamic imports HOT 5
- Question: flow control across multiple files HOT 9
- Discussion: enable mix of cjs and es test code. HOT 5
- Example of cleaner ts-node setup with pta + TypeScript
- Zora pta doesn't report anything if there are any pending tests that don't wait for any events HOT 6
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 zora.