ava-ts
Advanced tools
Comparing version 0.24.0 to 0.24.1
@@ -45,3 +45,3 @@ 'use strict'; | ||
let pattern = path.join(file, '**', '*.ts'); | ||
let pattern = path.join(file, '**', '*.{ts,tsx}'); | ||
@@ -61,3 +61,3 @@ if (process.platform === 'win32') { | ||
.then(flatten) | ||
.filter(file => file && path.extname(file) === '.ts') | ||
.filter(file => file && (path.extname(file) === '.ts' || path.extname(file) === '.tsx')) | ||
.filter(file => { | ||
@@ -87,6 +87,9 @@ if (path.basename(file)[0] === '_' && globOptions.includeUnderscoredFiles !== true) { | ||
'test.ts', | ||
'test.tsx', | ||
'test-*.ts', | ||
'test-*.tsx', | ||
'test', | ||
'**/__tests__', | ||
'**/*.test.ts' | ||
'**/*.test.ts', | ||
'**/*.test.tsx' | ||
]; | ||
@@ -177,3 +180,3 @@ | ||
if (!hasPositivePattern) { | ||
mixedPatterns = ['package.json', '**/*.ts'].concat(mixedPatterns); | ||
mixedPatterns = ['package.json', '**/*.{ts,tsx}'].concat(mixedPatterns); | ||
} | ||
@@ -212,3 +215,3 @@ | ||
// Like in `api.ts`, tests must be `.ts` files and not start with `_` | ||
if (path.extname(filePath) !== '.ts' || path.basename(filePath)[0] === '_') { | ||
if ((path.extname(filePath) !== '.ts' && path.extname(filePath) !== '.tsx') || path.basename(filePath)[0] === '_') { | ||
return false; | ||
@@ -248,3 +251,3 @@ } | ||
// Always use `/` to makes multimatch consistent across platforms | ||
.map(subpath => `${subpath}/**/*.ts`); | ||
.map(subpath => `${subpath}/**/*.{ts,tsx}`); | ||
@@ -280,3 +283,3 @@ // See if the entire path matches any of the subpaths patterns, taking the | ||
if (paths.length === 0) { | ||
paths = ['package.json', '**/*.ts', '**/*.snap']; | ||
paths = ['package.json', '**/*.ts', '**/*.tsx', '**/*.snap']; | ||
} | ||
@@ -283,0 +286,0 @@ |
@@ -56,3 +56,3 @@ 'use strict'; | ||
Default patterns when no arguments: | ||
test.ts test-*.ts test/**/*.ts **/__tests__/**/*.ts **/*.test.ts | ||
test.ts test.tsx test-*.ts test-*.tsx test/**/*.ts test/**/*.tsx **/__tests__/**/*.ts **/__tests__/**/*.tsx **/*.test.ts **/*.test.tsx | ||
`, { | ||
@@ -59,0 +59,0 @@ string: [ |
{ | ||
"name": "ava-ts", | ||
"version": "0.24.0", | ||
"version": "0.24.1", | ||
"description": "Fork of the AVA test runner with native typescript support 🚀", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -75,3 +75,3 @@ # AVA-TS | ||
Default patterns when no arguments: | ||
test.ts test-*.ts test/**/*.ts **/__tests__/**/*.ts **/*.test.ts | ||
test.ts test.tsx test-*.ts test-*.tsx test/**/*.ts test/**/*.tsx **/__tests__/**/*.ts **/__tests__/**/*.tsx **/*.test.ts **/*.test.tsx | ||
``` | ||
@@ -94,5 +94,19 @@ | ||
## Frequently Asked Questions | ||
<details> | ||
<summary>How to use AVA-TS when the <i>module</i> compiler option is set to ES6 modules?</summary> | ||
Especially when working with bundlers like webpack you will encounter this issue. Fortunately, there is a simple fix to make TypeScript emit node-style modules when running AVA-TS: | ||
```sh | ||
TS_NODE_COMPILER_OPTIONS='{"module":"commonjs"}' ava-ts | ||
``` | ||
If you feel this use case needs to be improved, complain in [#5](https://github.com/andywer/ava-ts/issues/5) 😉 | ||
</details> | ||
## License | ||
MIT. The fork as well as the original. AVA is a project of always awesome [Sindre Sorhus](https://github.com/sindresorhus). |
205925
5906
111