andywer / ava-ts Goto Github PK
View Code? Open in Web Editor NEW๐ Fork of the AVA test runner with native typescript support
License: MIT License
๐ Fork of the AVA test runner with native typescript support
License: MIT License
When I use the ava config below, require file cannot be transpiled.
import {configure} from "enzyme";
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
(function (exports, require, module, __filename, __dirname) { import {configure} from "enzyme";
^^^^^^
SyntaxError: Unexpected token import
Copy the relevant section from package.json
:
{
"ava": {
"require": [
"./test/setup-test-env.ts"
]
}
}
Although *.ts
files seem to run perfectly well, I'm having trouble getting *.tsx
files to be recognised.
With ava-ts **/*.test.{ts,tsx}
it claims it cannot find any *.tsx
files, but finds an abundance of *.ts
files and runs them successfully. I've tried renaming my .tsx
files to .ts
, and although ava-ts
then finds them, it fails to compile โ potentially because they now have an incorrect extension, or it may be an additional issue to resolve.
Do you have any examples of how to add support for .tsx
?
Hello,
I am looking to use this in a few projects that keep dependencies up to date with greenkeeper. As such, I would like to use the latest version of ts-node
. ava-ts
has a peer dependency on ts-node@^3.0.0
. Is an update to target the latest version possible? I have tried installing the latest version and everything seems to work, but I may be missing things since I am unfamiliar with how everything ties together.
Thanks
Gerrit
Thanks so much for creating ava-ts - it's been really helpful in my projects. I've noticed, however, that wherever ava would normally output line numbers where a test failed, I get completely unrelated code:
2 tests failed
rooms.ts โบ validates room sizes
/mnt/c/Users/Jack/git/sl-tethers/src/rooms.ts:79
78: };
79: rules: {
80: rounds: number;
Rejected promise returned by test. Reason:
Error (BadRequest) {
status: 400,
message: 'You need to pick a room size.',
}
As you can see from the example, I'm throwing an error within a function, but the highlighted output actually points to a unrelated interface declaration.
Is this a known problem? Do sourcemaps work with ava-ts?
Ava has a great feature of clean stack traces that ava-ts seems to be missing out on
Ava
Config โบ register
/Users/derenge/WebstormProjects/fado/src/actions/Config.test.ts:4
3: test('register', (t) => {
4: t.is(1, 2)
5: })
Difference:
- 1
+ 2
Ava-ts
Config.ts โบ register
/Users/derenge/WebstormProjects/fado/node_modules/ava-ts/lib/assert.js:102
Difference:
- 1
+ 2
ExecutionContext.is (node_modules/ava-ts/lib/assert.js:102:17)
Test.ava_1.test [as fn] (src/actions/Config.test.ts:4:7)
Test.callFn (node_modules/ava-ts/lib/test.js:306:18)
Test.run (node_modules/ava-ts/lib/test.js:319:23)
runNext (node_modules/ava-ts/lib/sequence.js:58:44)
Sequence.run (node_modules/ava-ts/lib/sequence.js:90:10)
Concurrent.run (node_modules/ava-ts/lib/concurrent.js:41:37)
runNext (node_modules/ava-ts/lib/sequence.js:58:44)
Sequence.run (node_modules/ava-ts/lib/sequence.js:90:10)
runNext (node_modules/ava-ts/lib/sequence.js:58:44)
Sequence.run (node_modules/ava-ts/lib/sequence.js:90:10)
Bluebird.try (node_modules/ava-ts/lib/runner.js:224:48)
Runner.run (node_modules/ava-ts/lib/runner.js:224:22)
process.on.options (node_modules/ava-ts/lib/main.js:84:10)
process.emit (node_modules/source-map-support/source-map-support.js:452:21)
process.on.message (node_modules/ava-ts/lib/process-adapter.js:14:10)
process.emit (node_modules/source-map-support/source-map-support.js:452:21)
Is this a setup issue with source maps on my end?
It would allow to reduce deps size for those who don't use that feature.
The latest version of AVA is currently 1.1.0, and ava-ts only supports 0.* (which currently resolves to AVA 0.25.0)
I deleted the template because I have a simple question: how do I output coverage with ava-ts?
I've made a simple test like your example and I've this error:
(function (exports, require, module, __filename, __dirname) { import test from 'ava';
^^^^^^
SyntaxError: Unexpected token import
the test:
import test from 'ava';
test('one plus two equals three', t => {
t.is(1 + 2, 3);
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.