vitest 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -3,3 +3,28 @@ export * from './suite';
3
3
  export * from './config';
4
4
  export * from './integrations/chai';
5
5
  export * from './integrations/sinon';
6
+ declare global {
7
+ namespace Chai {
8
+ interface Assertion {
9
+ toMatchSnapshot(message?: string): Assertion;
10
+ matchSnapshot(message?: string): Assertion;
11
+ toEqual(expected: any): void;
12
+ toStrictEqual(expected: any): void;
13
+ toBe(expected: any): void;
14
+ toContain(item: any): void;
15
+ toBeTruthy(): void;
16
+ toBeFalsy(): void;
17
+ toBeNaN(): void;
18
+ toBeUndefined(): void;
19
+ toBeNull(): void;
20
+ toBeDefined(): void;
21
+ toBeInstanceOf(c: any): void;
22
+ toBeCalledTimes(n: number): void;
23
+ toBeCalledOnce(): void;
24
+ toBeCalled(): void;
25
+ }
26
+ interface ExpectStatic {
27
+ addSnapshotSerializer: import('pretty-format').Plugin;
28
+ }
29
+ }
30
+ }
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-namespace */
1
2
  export * from './types';
2
3
  export * from './suite';
3
4
  export * from './config';
@@ -1,21 +1,2 @@
1
1
  import { ChaiPlugin } from './types';
2
2
  export declare function JestChaiExpect(): ChaiPlugin;
3
- declare global {
4
- namespace Chai {
5
- interface Assertion {
6
- toEqual(expected: any): void;
7
- toStrictEqual(expected: any): void;
8
- toBe(expected: any): void;
9
- toContain(item: any): void;
10
- toBeTruthy(): void;
11
- toBeFalsy(): void;
12
- toBeNaN(): void;
13
- toBeUndefined(): void;
14
- toBeNull(): void;
15
- toBeDefined(): void;
16
- }
17
- interface ExpectStatic {
18
- addSnapshotSerializer: import('pretty-format').Plugin;
19
- }
20
- }
21
- }
@@ -10,7 +10,7 @@ export function JestChaiExpect() {
10
10
  return this.equal(expected);
11
11
  });
12
12
  utils.addMethod(proto, 'toBe', function (expected) {
13
- return this.be(expected);
13
+ return this.equal(expected);
14
14
  });
15
15
  utils.addMethod(proto, 'toContain', function (item) {
16
16
  return this.contain(item);
@@ -35,5 +35,18 @@ export function JestChaiExpect() {
35
35
  utils.addMethod(proto, 'toBeDefined', function () {
36
36
  return this.not.be.undefined;
37
37
  });
38
+ utils.addMethod(proto, 'toBeInstanceOf', function (obj) {
39
+ return this.instanceOf(obj);
40
+ });
41
+ // mock
42
+ utils.addMethod(proto, 'toBeCalledTimes', function (number) {
43
+ return this.callCount(number);
44
+ });
45
+ utils.addMethod(proto, 'toBeCalledOnce', function () {
46
+ return this.callCount(1);
47
+ });
48
+ utils.addMethod(proto, 'toBeCalled', function () {
49
+ return this.called;
50
+ });
38
51
  };
39
52
  }
@@ -6,14 +6,3 @@ export interface SnapshotOptions {
6
6
  }
7
7
  export declare function getSnapshotManager(): SnapshotManager;
8
8
  export declare function SnapshotPlugin(options: SnapshotOptions): Promise<ChaiPlugin>;
9
- declare global {
10
- namespace Chai {
11
- interface Assertion {
12
- toMatchSnapshot(message?: string): Assertion;
13
- matchSnapshot(message?: string): Assertion;
14
- }
15
- interface ExpectStatic {
16
- addSnapshotSerializer: import('pretty-format').Plugin;
17
- }
18
- }
19
- }
@@ -1,3 +1,5 @@
1
1
  import sinon from 'sinon';
2
2
  export { sinon };
3
3
  export const { mock, spy, stub } = sinon;
4
+ // @ts-expect-error
5
+ sinon.fn = sinon.spy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/antfu/vitest#readme",
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './dist/index'