Comments (14)
No this is "normal" behaviour. For performance reasons tests are run in parallel (but reported in sequence). If you wish to respect the sequence you can pass the option {sequence:true}
when you create your plan:
plan({sequence:true})
.test('test1',async t=>{})
.test('will not start before test 1 is done', t => {})
from zora.
Huh... but isn't that what I'm doing in example.js above?
export default zora({sequence: true})
from zora.
In case it wasn't clear - I'd like to get multiple plans running sequentially concurrently.
zora()
.test(plan1) // has {sequence: true}
.test(plan2) // also has {sequence: true}
.run()
... for example!
from zora.
Actually, it seems like I'm overthinking it. I'll go ahead with a different approach :)
from zora.
@oles
A new pre major release is available. Can you try a little bit and tell me what you think. Thanks
from zora.
Awesome!
Great timing as well - working on my tests tonight
I'll try it out and will report back later today or early next week :)
from zora.
Alright! First - I'm wondering... How to convert this to v2?
index.js
import zora from 'zora'
import example from './example.js'
zora()
.test(example)
.run()
example.js
import zora from 'zora'
export default zora()
.test('example!', assert => {
assert.ok(true)
})
This is what I'm at currently:
index.js
import test from 'zora'
import example from './example.js'
example()
example.js
import test from 'zora'
export default () => {
test('example!', assert => {
assert.ok(true)
})
}
from zora.
It works, but seems a bit unintuitive - that extra indentation
from zora.
Technically you don't need anymore an entry point. So the index.js is a bit useless.
If you still want to use one. (to be used with a module bundler for instance)
you can simply in your entry point import the files even though they don't export anything. It works at least with rollup (and natively with nodejs).
test/test1.js
import test from 'zora';
test('foo',t=>{
//
});
test/index.js
import whathever from 'test/test1.js';
You could as well simply concat the files
index.js
// only the import of the libraries
import test from 'zora';
test.js
// no import at all
test('foo', t => {
t.ok(true);
});
then
cat intex.js ./test.js > debug.js
However this one introduces implicit globals (loaded in index.js).
you could as well export all your tests (a bit troublesome)
test.js
import test from 'zora';
export const t1 = test('foo',t=>{});
export const t2 = test('foo',t=>{});
//index.js
import * as t1 from './test.js'
otherwise you can do as you did. It indeed add an indentation but you had it before anyway by exporting the plan and then by importing it to be able to call run
from zora.
If you still want to use one. (to be used with a module bundler for instance)
you can simply in your entry point import the files even though they don't export anything. It works at least with rollup (and natively with nodejs).
Aha! I think this suits me even better - I'll try it soon!
Thanks a lot for the answer :)
from zora.
Confirmed - seems to work well
from zora.
Made my setup and structure for the tests even better and simpler. Wonderful job, @lorenzofox3!
Really glad to not have to be limited by the quirks of all the other alternatives.
from zora.
Glad you liked it !
Note:
If you or your tool is annoyed by the empty export you can also semantically group your tests in a test suite.
funcX.js
import test from 'zora';
export default test('testing functionality x',t=>{
t.test('test 1', t=> {
//
});
t.test('test 2', t=>{
//
});
});
then in index.js
import funcX from './funcX.js';
- It will be transparent for most of the tap reporters.
- It is aligned with ES module spec. (rollup is not exactly aligned as it inlines import, which has the nice effect of concatenating files...even they have no export and therefore should not considered as module).
- You can run your test files individually or by importing them (or by spawning process, etc) without any extra work)
from zora.
Ahh, great to know. Currently rolling with just a simple import './tests/set.js'
- works for now!
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.