Skip to content

Commit 0df6415

Browse files
committed
refactor(expecter): Rename from reuseCompiler.
1 parent 3833b39 commit 0df6415

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ npm install ts-snippet --save-dev
3838

3939
## Usage
4040

41-
This simplest way to use `ts-snippet` is to create a snippet expectation function using `reuseCompiler`:
41+
This simplest way to use `ts-snippet` is to create a snippet expectation function using `expecter`:
4242

4343
```ts
44-
import { reuseCompiler } from "ts-snippet";
44+
import { expecter } from "ts-snippet";
4545

4646
describe("observables", () => {
4747

48-
const expectSnippet = reuseCompiler();
48+
const expectSnippet = expecter();
4949

5050
it("should infer the source's type", () => {
5151
expectSnippet(`
@@ -56,14 +56,14 @@ describe("observables", () => {
5656
});
5757
```
5858

59-
`reuseCompiler` can be passed a factory so that common imports can be specified in just one place. For example:
59+
`expecter` can be passed a factory so that common imports can be specified in just one place. For example:
6060

6161
```ts
62-
import { reuseCompiler } from "ts-snippet";
62+
import { expecter } from "ts-snippet";
6363

6464
describe("observables", () => {
6565

66-
const expectSnippet = reuseCompiler(code => `
66+
const expectSnippet = expecter(code => `
6767
import * as Rx from "rxjs";
6868
${code}
6969
`);
@@ -143,7 +143,7 @@ For an example of how `ts-snippet` can be used, have a look at [these tests](htt
143143
## API
144144

145145
```ts
146-
function reuseCompiler(
146+
function expecter(
147147
factory: (code: string) => string = code => code,
148148
compilerOptions?: object
149149
): (code: string) => Expect;

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ It can be used with [AVA](https://github.com/avajs/ava), [Jasmine](https://githu
55
Using Jasmine or Mocha, the tests look something like this:
66

77
```ts
8-
import { reuseCompiler } from "ts-snippet";
8+
import { expecter } from "ts-snippet";
99

1010
describe("observables", () => {
1111

12-
const expectSnippet = reuseCompiler();
12+
const expectSnippet = expecter();
1313

1414
it("should infer the source's type", () => {
1515
expectSnippet(`

source/ava/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { snippet as _snippet, Snippet } from "../snippet";
1111
export { Compiler };
1212
export { Expect };
1313

14-
export function reuseCompiler(
14+
export function expecter(
1515
factory: (code: string) => string = code => code,
1616
compilerOptions?: object
1717
): (context: TestContext, code: string) => Expect {

source/reuse-spec.ts renamed to source/expecter-spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* can be found in the LICENSE file at https://github.com/cartant/ts-snippet
44
*/
55

6-
import { reuseCompiler } from "./reuse";
6+
import { expecter } from "./expecter";
77

8-
describe("reuseCompiler", () => {
8+
describe("expecter", () => {
99

1010
describe("default", () => {
1111

12-
const expectSnippet = reuseCompiler();
12+
const expectSnippet = expecter();
1313

1414
it("should support snippet expectations", () => {
1515

@@ -22,7 +22,7 @@ describe("reuseCompiler", () => {
2222

2323
describe("with factory", () => {
2424

25-
const expectSnippet = reuseCompiler(code => `import { expect } from "chai"; ${code}`);
25+
const expectSnippet = expecter(code => `import { expect } from "chai"; ${code}`);
2626

2727
it("should support snippet expectations", () => {
2828

source/reuse.ts renamed to source/expecter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Compiler } from "./compiler";
77
import { Expect } from "./expect";
88
import { snippet } from "./snippet";
99

10-
export function reuseCompiler(
10+
export function expecter(
1111
factory: (code: string) => string = code => code,
1212
compilerOptions?: object
1313
): (code: string) => Expect {

source/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55

66
export { Compiler } from "./compiler";
77
export { Expect } from "./expect";
8-
export { reuseCompiler } from "./reuse";
8+
export { expecter } from "./expecter";
99
export { snippet, Snippet } from "./snippet";

source/tape/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { snippet as _snippet, Snippet } from "../snippet";
1111
export { Compiler };
1212
export { Expect };
1313

14-
export function reuseCompiler(
14+
export function expecter(
1515
factory: (code: string) => string = code => code,
1616
compilerOptions?: object
1717
): (context: tape.Test, code: string) => Expect {

0 commit comments

Comments
 (0)