@signpostmarv/ts-assert 0.1.0 → 0.1.1--develop
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/README.md +7 -65
- package/package.json +2 -3
- package/.github/FUNDING.yml +0 -2
- package/.github/workflows/ci.yml +0 -25
- package/generated/assertions.d.ts +0 -520
- package/generated/assertions.js +0 -1037
- package/generated/assertions.js.map +0 -1
- package/lib/main.d.ts +0 -269
- package/lib/main.js +0 -18
- package/lib/main.js.map +0 -1
- package/lib/main.ts +0 -39
package/README.md
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
[](https://coveralls.io/github/SignpostMarv/ts-assert?branch=main)
|
|
2
|
-
[](https://github.com/SignpostMarv/ts-assert/actions/workflows/ci.yml?query=branch%3Amain)
|
|
3
|
-
|
|
4
1
|
# @signpostmarv/ts-assert
|
|
5
2
|
|
|
6
3
|
Code-generated assertions for TypeScript type guarding functions.
|
|
@@ -9,73 +6,18 @@ Code-generated assertions for TypeScript type guarding functions.
|
|
|
9
6
|
|
|
10
7
|
```ts
|
|
11
8
|
import {describe, it} from 'node:test';
|
|
12
|
-
import assert from 'node:assert/strict';
|
|
13
9
|
import ts_assert from '@signpostmarv/ts-assert';
|
|
14
10
|
import ts from 'typescript';
|
|
15
11
|
|
|
16
|
-
void describe('
|
|
17
|
-
void it('
|
|
18
|
-
assert.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
void describe('isEmptyBindingPattern', () => {
|
|
25
|
-
void it('throws', () => {
|
|
26
|
-
assert.throws(() =>
|
|
27
|
-
ts_assert.isEmptyBindingPattern(ts.factory.createIdentifier('foo'))
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
void describe('isBooleanLiteral', () => {
|
|
33
|
-
void it('throws', () => {
|
|
34
|
-
assert.throws(() =>
|
|
35
|
-
ts_assert.isBooleanLiteral(
|
|
36
|
-
ts.factory.createStringLiteral('foo'),
|
|
37
|
-
true
|
|
38
|
-
)
|
|
39
|
-
);
|
|
40
|
-
assert.throws(() =>
|
|
41
|
-
ts_assert.isBooleanLiteral(ts.factory.createFalse(), true)
|
|
42
|
-
);
|
|
43
|
-
assert.throws(() =>
|
|
44
|
-
ts_assert.isBooleanLiteral(ts.factory.createTrue(), false)
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
void it('does not throw', () => {
|
|
48
|
-
assert.doesNotThrow(() =>
|
|
49
|
-
ts_assert.isBooleanLiteral(ts.factory.createTrue(), true)
|
|
50
|
-
);
|
|
51
|
-
assert.doesNotThrow(() =>
|
|
52
|
-
ts_assert.isBooleanLiteral(ts.factory.createFalse(), false)
|
|
53
|
-
);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
void describe('isTokenWithExpectedKind', () => {
|
|
58
|
-
void it('throws', () => {
|
|
59
|
-
assert.throws(() =>
|
|
60
|
-
ts_assert.isTokenWithExpectedKind(
|
|
61
|
-
ts.factory.createStringLiteral('foo'),
|
|
62
|
-
ts.SyntaxKind.StringKeyword
|
|
63
|
-
)
|
|
64
|
-
);
|
|
65
|
-
assert.throws(() =>
|
|
66
|
-
ts_assert.isTokenWithExpectedKind(
|
|
67
|
-
ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
|
|
68
|
-
ts.SyntaxKind.NumberKeyword
|
|
69
|
-
)
|
|
12
|
+
void describe('example', () => {
|
|
13
|
+
void it('replaces this', () => {
|
|
14
|
+
assert.equal(
|
|
15
|
+
ts.isEmptyBindingPattern(ts.factory.createIdentifier('foo')),
|
|
16
|
+
true
|
|
70
17
|
);
|
|
71
18
|
});
|
|
72
|
-
void it('
|
|
73
|
-
|
|
74
|
-
ts_assert.isTokenWithExpectedKind(
|
|
75
|
-
ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
|
|
76
|
-
ts.SyntaxKind.StringKeyword
|
|
77
|
-
)
|
|
78
|
-
);
|
|
19
|
+
void it('with this', () => {
|
|
20
|
+
ts_assert.isEmptyBindingPattern(ts.factory.createIdentifier('foo'));
|
|
79
21
|
});
|
|
80
22
|
});
|
|
81
23
|
```
|
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@signpostmarv/ts-assert",
|
|
4
4
|
"description": "TypeScript Assertions",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
5
|
"repository": {
|
|
7
6
|
"type": "git",
|
|
8
7
|
"url": "git+https://github.com/SignpostMarv/ts-assert.git"
|
|
@@ -11,7 +10,7 @@
|
|
|
11
10
|
"test": "ts-node ./tests.ts"
|
|
12
11
|
},
|
|
13
12
|
"exports": {
|
|
14
|
-
".": "./
|
|
13
|
+
".": "./generated/assertions.ts"
|
|
15
14
|
},
|
|
16
15
|
"devDependencies": {
|
|
17
16
|
"@types/eslint": "^8.56.7",
|
|
@@ -27,5 +26,5 @@
|
|
|
27
26
|
"dependencies": {
|
|
28
27
|
"typescript": "^5.4.5"
|
|
29
28
|
},
|
|
30
|
-
"version": "0.1.
|
|
29
|
+
"version": "0.1.1--develop"
|
|
31
30
|
}
|
package/.github/FUNDING.yml
DELETED
package/.github/workflows/ci.yml
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches: [main]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
basic-checks:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v4
|
|
12
|
-
- uses: actions/setup-node@v4
|
|
13
|
-
with:
|
|
14
|
-
node-version: 21.x
|
|
15
|
-
cache: 'npm'
|
|
16
|
-
- run: npm ci
|
|
17
|
-
- run: make lint
|
|
18
|
-
- name: Generate coverage
|
|
19
|
-
run: ./node_modules/.bin/c8 --config=./.c8rc.coveralls.json npm test
|
|
20
|
-
env:
|
|
21
|
-
NODE_OPTIONS: '--enable-source-maps --no-warnings=ExperimentalWarning --loader ts-node/esm'
|
|
22
|
-
- name: Coveralls GitHub Action
|
|
23
|
-
uses: coverallsapp/github-action@v2.2.3
|
|
24
|
-
with:
|
|
25
|
-
file: './coverage/lcov.info'
|