Comments (1)
Take a look at the mocha
branch (not yet merged).
It should handle the basic describe
/ it
conversion. Happy to take PR's focused on Jasmine (don't worry about any CLI integration just yet).
Beware if you are doing something like this:
describe('foo', function () {
var x;
var y;
beforeEach(function () {
x = someFixture();
y = otherFixture();
});
it('testA', ...);
it('testB', ...);
});
You are going to need to change how you do things to take advantage of AVA's async nature. testA
and testB
will run concurrently, so accessing the shared variable is likely to cause problems. You don't have this problem in mocha
, because both tests are never active together.
You could just default to test.serial
, but then you miss out on async execution.
You could transition all of them to using context:
test.beforeEach(t => {
t.context = {
x: someFixture(),
y: someOtherFixture()
};
});
test('testA', t => {
let {x, y} = t.context;
// use x and y as you did before
});
test('testB', t => {
let {x, y} = t.context;
// use x and y as you did before
});
Or you could just use setup functions as recommended in the AVA recipes:
const setup = () => {
x: someFixture(),
y: someOtherFixture()
};
test('testA', t => {
let {x, y} = setup();
// use x and y as you did before
});
test('testB', t => {
let {x, y} = setup();
// use x and y as you did before
});
Neither of these help you if someFixture()
or someOtherFixture()
rely on global state. In that case, you probably are stuck with test.serial
(or transitioning away from using global state in your app - which is better if doable).
All the above is what makes these codemods difficult, and why we haven't made a ton of progress yet.
from ava-codemods.
Related Issues (17)
- Automatic file detection HOT 3
- Allow `package.json` to be dirty HOT 2
- Should not change code style HOT 5
- Add ability to specify `from` and `to` AVA version as CLI flag HOT 3
- ES6ify the code. HOT 6
- Codemods for AVA cwd change HOT 5
- Automatic detection of existing test framework. HOT 6
- Current master branch won't work if released HOT 3
- Conversion for Mocha HOT 1
- Improvements to Tape→AVA conversion HOT 6
- Conversion from Jest HOT 2
- tape-to-ava - SyntaxError: Unexpected token export HOT 2
- What to do about this project? HOT 1
- Conversion for node-tap
- Conversions for tape HOT 11
- Docs HOT 4
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 ava-codemods.