Skip to content

Commit

Permalink
Merge branch 'main' into support-big-int-in-approximently
Browse files Browse the repository at this point in the history
  • Loading branch information
koddsson authored Oct 6, 2024
2 parents 3587410 + 01ac941 commit 5abacf4
Show file tree
Hide file tree
Showing 54 changed files with 6,287 additions and 5,068 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/browsers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Browsers CI

on:
push:
branches: [ main, 4.x.x, 5.x.x ]
branches: [ main, 4.x.x ]
pull_request:
branches: [ main, 4.x.x, 5.x.x ]
branches: [ main, 4.x.x ]

jobs:
build:
Expand All @@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: ${{ matrix.browser-name }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
- run: npm ci
- run: npx playwright install --with-deps
- run: npm run build --if-present
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Node.js CI

on:
push:
branches: [ main, 4.x.x, 5.x.x ]
branches: [ main, 4.x.x ]
pull_request:
branches: [ main, 4.x.x, 5.x.x ]
branches: [ main, 4.x.x ]

jobs:
build:
Expand All @@ -17,17 +17,17 @@ jobs:
strategy:
matrix:
node-version:
- 16 # to be removed 2023-09-11
- 18 # to be removed 2025-04-30
- 19 # to be removed 2023-06-01
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
- 18 # to be removed 2025-04-30
- 20 # to be removed 2026-04-30
- latest
# See supported Node.js release schedule at https://github.com/nodejs/release#release-schedule

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm run test-node
41 changes: 18 additions & 23 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package
name: Publish to npm

on:
release:
Expand All @@ -11,37 +11,32 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
- run: npm ci
- run: npx playwright install --with-deps
- run: npm run build --if-present
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
node-version: 22.x
registry-url: "https://registry.npmjs.org"
cache: "npm"
- run: npm ci
- run: npm publish
- run: npm run build --if-present
- run: npm version ${TAG_NAME} --git-tag-version=false
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

publish-gpr:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm publish
TAG_NAME: ${{ github.ref_name }}
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.npm_secret }}
38 changes: 10 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,54 +71,36 @@ You can also use it within the browser; install via npm and use the `chai.js` fi
Import the library in your code, and then pick one of the styles you'd like to use - either `assert`, `expect` or `should`:

```js
var chai = require('chai');
var assert = chai.assert; // Using Assert style
var expect = chai.expect; // Using Expect style
var should = chai.should(); // Using Should style
```

### Pre-Native Modules Usage (_registers the chai testing style globally_)

```js
require('chai/register-assert'); // Using Assert style
require('chai/register-expect'); // Using Expect style
require('chai/register-should'); // Using Should style
```

### Pre-Native Modules Usage (_as local variables_)

```js
const { assert } = require('chai'); // Using Assert style
const { expect } = require('chai'); // Using Expect style
const { should } = require('chai'); // Using Should style
should(); // Modifies `Object.prototype`

const { expect, use } = require('chai'); // Creates local variables `expect` and `use`; useful for plugin use
import { assert } from 'chai'; // Using Assert style
import { expect } from 'chai'; // Using Expect style
import { should } from 'chai'; // Using Should style
```

### Native Modules Usage (_registers the chai testing style globally_)
### Register the chai testing style globally

```js
import 'chai/register-assert'; // Using Assert style
import 'chai/register-expect'; // Using Expect style
import 'chai/register-should'; // Using Should style
```

### Native Modules Usage (_local import only_)
### Import assertion styles as local variables

```js
import { assert } from 'chai'; // Using Assert style
import { expect } from 'chai'; // Using Expect style
import { should } from 'chai'; // Using Should style
should(); // Modifies `Object.prototype`

import { expect, use } from 'chai'; // Creates local variables `expect` and `use`; useful for plugin use
```

### Usage with Mocha

```bash
mocha spec.js -r chai/register-assert # Using Assert style
mocha spec.js -r chai/register-expect # Using Expect style
mocha spec.js -r chai/register-should # Using Should style
mocha spec.js --require chai/register-assert.js # Using Assert style
mocha spec.js --require chai/register-expect.js # Using Expect style
mocha spec.js --require chai/register-should.js # Using Should style
```

[Read more about these styles in our docs](http://chaijs.com/guide/styles/).
Expand Down
26 changes: 0 additions & 26 deletions bower.json

This file was deleted.

12 changes: 12 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import jsdoc from "eslint-plugin-jsdoc";

export default [
jsdoc.configs["flat/recommended"],
{
rules: {
"jsdoc/require-param-description": "off",
"jsdoc/require-returns-description": "off",
"jsdoc/tag-lines": ["error", "any", { startLines: 1 }],
},
},
];
35 changes: 0 additions & 35 deletions karma.conf.cjs

This file was deleted.

41 changes: 0 additions & 41 deletions karma.sauce.js

This file was deleted.

40 changes: 9 additions & 31 deletions lib/chai.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,18 @@ import {assert} from './chai/interface/assert.js';

const used = [];

/*!
* Assertion Error
*/

// Assertion Error
export {AssertionError};

/**
* # .use(function)
*
* Provides a way to extend the internals of Chai.
*
* @param {Function}
* @param {Function} fn
* @returns {this} for chaining
* @api public
* @public
*/

export function use(fn) {
const exports = {
AssertionError,
Expand All @@ -50,38 +46,20 @@ export function use(fn) {
return exports;
};

/*!
* Utility Functions
*/

// Utility Functions
export {util};

/*!
* Configuration
*/

// Configuration
export {config};

/*!
* Primary `Assertion` prototype
*/

// Primary `Assertion` prototype
export * from './chai/assertion.js';

/*!
* Expect interface
*/

// Expect interface
export * from './chai/interface/expect.js';

/*!
* Should interface
*/

// Should interface
export * from './chai/interface/should.js';

/*!
* Assert interface
*/

// Assert interface
export * from './chai/interface/assert.js';
Loading

0 comments on commit 5abacf4

Please sign in to comment.