Skip to content

Commit c9e573c

Browse files
Refactor: simplify core (#243)
* refactor core types * refactor substitute core * refactor recorder and recordsSet * fix tests due to refactor * fix types for typescript < 4.6 * Compatibility with strict mode (#244) * stricter types on recorded arguments * make types more verbose and explicit * fix types verbosity on tests * remove strictNullChecks flag * remove strict mode warning from readme * 2.0.0-beta.2 * Maintenance upgrades, guarantee support for node.js 18 & drop node.js 10 (#245) * better tsconfig setup * upgrade dependencies to latest * fix ava types * upgrade github actions * support up to node.js 18 * drop node.js 10 from test matrix * use ava config file
1 parent 6e3011a commit c9e573c

33 files changed

+921
-1920
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
steps:
2424
- name: Checkout repository
25-
uses: actions/checkout@v2
25+
uses: actions/checkout@v3
2626
with:
2727
# We must fetch at least the immediate parents so that if this is
2828
# a pull request then we can checkout the head.
@@ -35,9 +35,9 @@ jobs:
3535

3636
# Initializes the CodeQL tools for scanning.
3737
- name: Initialize CodeQL
38-
uses: github/codeql-action/init@v1
38+
uses: github/codeql-action/init@v2
3939
with:
4040
languages: ${{ matrix.language }}
4141

4242
- name: Perform CodeQL Analysis
43-
uses: github/codeql-action/analyze@v1
43+
uses: github/codeql-action/analyze@v2

.github/workflows/nodejs.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
name: Node CI
2-
32
on: [push]
43

54
jobs:
65
build:
7-
86
runs-on: ubuntu-latest
9-
107
strategy:
118
matrix:
12-
node-version: ['10.x', '12.x', '14.x']
9+
node-version: [12, 14, 16, 18]
1310

1411
steps:
15-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
1613
- name: Use Node.js ${{ matrix.node-version }}
17-
uses: actions/setup-node@v2-beta
14+
uses: actions/setup-node@v3
1815
with:
1916
node-version: ${{ matrix.node-version }}
20-
- name: install dependencies, build and test
21-
run: |
22-
npm ci
23-
npm run build --if-present
24-
npm test
17+
cache: 'npm'
18+
- name: Install dependencies
19+
run: npm ci
20+
- name: Transpile typescript
21+
run: npm run build --if-present
22+
- name: Run tests
23+
run: npm test
2524
env:
2625
CI: true

.github/workflows/npm-publish.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@ on:
55
types: [created]
66

77
jobs:
8-
build:
8+
build-test:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/setup-node@v2
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
1313
with:
1414
node-version: 14
15+
cache: 'npm'
1516
- run: npm ci --ignore-scripts
1617
- run: npm test
1718

1819
publish-npm:
19-
needs: build
20+
needs: build-test
2021
runs-on: ubuntu-latest
2122
steps:
22-
- uses: actions/checkout@v2
23-
- uses: actions/setup-node@v2
23+
- uses: actions/checkout@v3
24+
- uses: actions/setup-node@v3
2425
with:
2526
node-version: 14
2627
registry-url: https://registry.npmjs.org/
28+
cache: 'npm'
2729
- run: npm ci --ignore-scripts
2830
- run: npm run build
2931
- run: echo "tag=latest" >> $GITHUB_ENV
@@ -35,17 +37,18 @@ jobs:
3537
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
3638

3739
publish-github:
38-
needs: build
40+
needs: build-test
3941
runs-on: ubuntu-latest
4042
permissions:
4143
contents: read
4244
packages: write
4345
steps:
44-
- uses: actions/checkout@v2
45-
- uses: actions/setup-node@v2
46+
- uses: actions/checkout@v3
47+
- uses: actions/setup-node@v3
4648
with:
4749
node-version: 14
4850
registry-url: https://npm.pkg.github.com/
51+
cache: 'npm'
4952
- run: npm ci --ignore-scripts
5053
- run: npm run build
5154
- run: echo "tag=latest" >> $GITHUB_ENV

README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -226,20 +226,6 @@ Substitute.disableFor(fake).received(1337);
226226
fake.received().received(1337);
227227
```
228228

229-
## Strict mode
230-
If you have `strict` set to `true` in your `tsconfig.json`, you may need to toggle off strict null checks. The framework does not currently support this.
231-
232-
However, it is only needed for your test projects anyway.
233-
234-
```json
235-
{
236-
"compilerOptions": {
237-
"strict": true,
238-
"strictNullChecks": false
239-
}
240-
}
241-
```
242-
243229
## Contributors
244230

245231
### Code Contributors

ava.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
module.exports = {
3+
files: ['spec/**/*.ts'],
4+
typescript: {
5+
compile: false,
6+
rewritePaths: {
7+
'/': 'dist/'
8+
}
9+
},
10+
cache: false,
11+
failFast: true,
12+
failWithoutAssertions: true
13+
}

0 commit comments

Comments
 (0)