jeudi 10 août 2017

How to use Ava with Angular/CLI build typescript project

As a part of a project I am building I currently have an angular-cli typescript project I have created. We are currently using the karma testing framework, but are extremely interested in switching to AVA if possible.

I've currently done a npm install --save-dev ava And I've looked at the typescript setup in the ava documentation http://ift.tt/2usrk2a

I've also followed the setup on the main page itself and added an "ava" section to my package.json

"ava": {
  "files": [
    "**/*.spec.ts"
  ],
  "source": [
    "**/*.ts"
  ],
  "match": [],
  "concurrency": 5,
  "failFast": true,
  "failWithoutAssertions": false,
  "tap": true,
  "powerAssert": false,
  "require": [
    "babel-register"
  ],
  "babel": "inherit"
}

I've hoped that somehow by default this would pick up our currently written spec.ts files that have been tailored and written for karma, but it would seem that this isn't so as I'm only given

# Couldn't find any files to test
not ok 1 - Couldn't find any files to test

1..0
# tests 0
# pass 0
# fail 1

I've also tried obliterating the default test.ts file that is currently put in place by Karma and changing it to

import test from 'ava';
test('BLA', t => {
  t.pass();
});

In the hopes that I could at least bootstrap something to work with that I could maybe use to add/implement the rest of our test files with later. So far I've had no luck with this either.

Can someone who has taken this path before tell me what needs to be done to get the Ava test runner up and working; and furthermore, what may need to be done to adapt our currently existing karma/jasmine based test framework to Ava?

Thank you very much in advance!

Aucun commentaire:

Enregistrer un commentaire