Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add support for custom assertions #70

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ jobs:
with:
fetch-depth: '0'
- name: Check code for leaks
uses: zricethezav/gitleaks-action@master
uses: zricethezav/gitleaks-action@v1.6.0

lint:
name: lint + typecheck
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
Expand All @@ -49,7 +49,7 @@ jobs:
name: test/${{ matrix.node }}
strategy:
matrix:
node: [ '12', '14', '16' ]
node: [ '14', '16', '18' ]
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
Expand All @@ -61,7 +61,7 @@ jobs:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install dependencies
run: npm ci
run: npm ci --no-optional
- name: Run tests
run: npm run test

Expand All @@ -72,9 +72,9 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip release') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Check code for leaks
uses: zricethezav/gitleaks-action@master
uses: zricethezav/gitleaks-action@v1.6.0
- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
Expand Down Expand Up @@ -48,11 +48,11 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip release') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
registry=https://registry.npmjs.org/
save-exact=true
fund=false
20 changes: 19 additions & 1 deletion @types/espurify.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ declare module 'espurify' {
* @returns Purified ESTree AST Node.
*/
function espurify(node: import('estree').Node): import('estree').Node

/**
* Clone ESTree AST Node without extra properties.
*
* Leaves out properties defined in The [ESTree Spec](https://github.com/estree/estree)
* (formerly known as [Mozilla SpiderMonkey Parser API](https://speakerdeck.com/michaelficarra/spidermonkey-parser-api-a-standard-for-structured-js-representations)) only.
* Also note that extra information (such as loc, range and raw) is eliminated too.
* @param node ESTree AST Node.
* @returns Purified ESTree AST Node.
*/
espurify.purifyAst = espurify

/**
* Returns customized function for cloning ESTree AST, configured by custom `options`.
*
Expand All @@ -31,9 +43,15 @@ declare module 'espurify' {
* @param whitelist Configuration of properties allowed for each `NodeType`.
* @returns Instance of `espurify`
*/
espurify.cloneWithWhitelist = (
espurify.cloneWithAllowlist = (
// eslint-disable-next-line @typescript-eslint/no-unused-vars
whitelist: Record<import('estree').Expression['type'], Array<string>>
) => espurify

/**
* @deprecated since version 3.0.0. Use `espurify.cloneWithAllowlist` instead.
*/
espurify.cloneWithWhitelist = espurify.cloneWithAllowlist

export default espurify
}
Loading