Skip to content
This repository has been archived by the owner on Mar 28, 2021. It is now read-only.

Commit

Permalink
Update to support ava 0.20+
Browse files Browse the repository at this point in the history
  • Loading branch information
unional committed Jul 23, 2017
1 parent 2eeaeed commit 6a869d7
Show file tree
Hide file tree
Showing 9 changed files with 4,287 additions and 2,307 deletions.
6,440 changes: 4,210 additions & 2,230 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -66,15 +66,15 @@
},
"peerDependencies": {
"aurelia-logging": ">=1.2.0",
"ava": ">=0.19.1"
"ava": ">=0.20"
},
"devDependencies": {
"@types/mkdirp": "^0.5.0",
"@types/node": "^8.0.4",
"@types/node": "^8.0.15",
"assert-order": "^2.3.1",
"aurelia-logging": "^1.3.1",
"aurelia-logging-color": "^0.5.5",
"aurelia-polyfills": "^1.2.1",
"aurelia-polyfills": "^1.2.2",
"ava": "^0.21.0",
"bluebird": "^3.5.0",
"browser-env": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/curryMatch.ts
@@ -1,12 +1,12 @@
import { getLogger } from 'aurelia-logging'
import { ContextualTestContext } from 'ava'
import { Context, TestContext } from 'ava'
import { compare } from 'dir-compare'
import { readFileSync, existsSync } from 'fs'
import { join, relative } from 'path'

const logger = getLogger('fixture')

export function curryMatch(baselinePath: string, resultPath: string, t: ContextualTestContext) {
export function curryMatch(baselinePath: string, resultPath: string, t: TestContext & Context<any>) {
// here is ava cwd, which is the project root
// Use this to do relative() with filename get good relative path.
const cwd = process.cwd()
Expand Down
11 changes: 6 additions & 5 deletions src/fixture.ts
@@ -1,7 +1,8 @@
import { readdirSync } from 'fs'
import { resolve, join } from 'path'
import test, {
ContextualTestContext
TestContext,
Context
} from 'ava'

import {
Expand Down Expand Up @@ -32,7 +33,7 @@ export function fixture(ava: typeof test, casesPath: string, baselinesPath?: str
return ((
title: string,
caseName: string,
run: (t: ContextualTestContext, d: ContextualDiffContext) => any
run: (t: TestContext & Context<any>, d: ContextualDiffContext) => any
) => {
const hasTitle = !!run
if (!run) {
Expand All @@ -49,7 +50,7 @@ export function fixture(ava: typeof test, casesPath: string, baselinesPath?: str
d.baselinePath = resolve(baselinesPath, caseName)
d.resultPath = resolve(resultsPath, caseName)
}
return testfn(`${hasTitle ? title + ' ' : ''}${caseName}`, (t: ContextualTestContext) => {
return testfn(`${hasTitle ? title + ' ' : ''}${caseName}`, (t: TestContext & Context<any>) => {
if (baselinesPath) {
d.match = curryMatch(d.baselinePath, d.resultPath, t)
}
Expand Down Expand Up @@ -107,7 +108,7 @@ export function fixture(ava: typeof test, casesPath: string, baselinesPath?: str
d.resultPath = resolve(resultsPath, caseName)
}

return testfn(caseName, (t: ContextualTestContext) => {
return testfn(caseName, (t: TestContext & Context<any>) => {
if (baselinesPath) {
d.match = curryMatch(d.baselinePath, d.resultPath, t)
}
Expand Down Expand Up @@ -159,7 +160,7 @@ export function fixture(ava: typeof test, casesPath: string, baselinesPath?: str

fn.only.failing = fn.failing.only
fn.only.each = eachCurry(ava.only)
fn.only.each.failing = eachCurry(ava.only.failing)
fn.only.each.failing = eachCurry(ava.only.failing as any)

fn.skip.failing = fn.failing.skip
fn.skip.each = eachCurry(ava.skip)
Expand Down
123 changes: 62 additions & 61 deletions src/interfaces.ts

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions tsconfig.base.json
Expand Up @@ -17,8 +17,7 @@
"noUnusedParameters": true,
"removeComments": false,
"sourceMap": true,
"strictNullChecks": true,
"target": "es5"
"strictNullChecks": true
},
"files": [
"src/index.ts"
Expand Down
1 change: 0 additions & 1 deletion tsconfig.es2015.json
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"module": "es2015",
"outDir": "dist/es2015",
"sourceRoot": "/ava-fixture",
"target": "es2015"
}
}
4 changes: 2 additions & 2 deletions tsconfig.es5.json
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "dist/es5",
"sourceRoot": "/ava-fixture"
"target": "es5",
"outDir": "dist/es5"
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.base.json",
"extends": "./tsconfig.es5.json",
"compilerOptions": {
"outDir": "dist-spec"
},
Expand Down

0 comments on commit 6a869d7

Please sign in to comment.