Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ava/typescript

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ava/typescript

TypeScript provider for AVA

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

@ava/typescript

Adds rudimentary TypeScript support to AVA.

This is designed to work for projects that precompile TypeScript. It allows AVA to load the compiled JavaScript, while configuring AVA to treat the TypeScript files as test files.

In other words, say you have a test file at src/test.ts. You've configured TypeScript to output to build/. Using @ava/typescript you can run the test using npx ava src/test.ts.

Enabling TypeScript support

Add this package to your project:

npm install --save-dev @ava/typescript

Then, enable TypeScript support either in package.json or ava.config.*:

package.json:

{
	"ava": {
		"typescript": {
			"rewritePaths": {
				"src/": "build/"
			}
		}
	}
}

Both keys and values of the rewritePaths object must end with a /. Paths are relative to your project directory.

Output files are expected to have the .js extension.

Add additional extensions

You can configure AVA to recognize additional file extensions. To add (partial†) JSX support:

package.json:

{
	"ava": {
		"typescript": {
			"extensions": [
				"ts",
				"tsx"
			],
			"rewritePaths": {
				"src/": "build/"
			}
		}
	}
}

See also AVA's extensions option.

† Note that the preserve mode for JSX is not (yet) supported.

Keywords

FAQs

Package last updated on 26 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc