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

Update dependencies and use new mochify #53

Merged
merged 15 commits into from
Mar 20, 2024
24 changes: 10 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,30 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['16.x', '18.x']
node-version: ['16.x', '18.x', '20.x']

steps:
- name: Checkout
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 }}
- name: Cache modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
cache: 'npm'
- name: Install
run: npm ci
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
- name: Lint
if: matrix.node-version == '16.x'
if: matrix.node-version == '20.x'
run: npm run lint
- name: Prettier
if: matrix.node-version == '16.x'
if: matrix.node-version == '20.x'
run: npm run prettier:check
- name: Test Node
run: npm run test:node
- name: Test Browser
if: matrix.node-version == '16.x'
run: npm run test:browser -- --chrome $(which google-chrome-stable) --allow-chrome-as-root
if: matrix.node-version == '20.x'
run: |
export PUPPETEER_EXECUTABLE_PATH=$(which google-chrome-stable)
npm run test:browser
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

node_modules/.bin/lint-staged --relative
28 changes: 14 additions & 14 deletions lib/schema_object.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const { inspect } = require('util');
const { EventEmitter } = require('events');
const { assert, refute, match, sinon } = require('@sinonjs/referee-sinon');
const { assert, refute, sinon } = require('@sinonjs/referee-sinon');
const {
schema,
object,
Expand Down Expand Up @@ -1420,7 +1420,7 @@ describe('schema object', () => {

assert.calledOnceWith(onSet, {
type: 'object',
object: match.same(obj),
object: sinon.match.same(obj),
key: 'some',
value: { nested: 'test' },
base: undefined,
Expand All @@ -1436,7 +1436,7 @@ describe('schema object', () => {

assert.calledOnceWith(onSet, {
type: 'object',
object: match.same(obj),
object: sinon.match.same(obj),
key: 'nested',
value: 'test',
base: 'some',
Expand All @@ -1462,7 +1462,7 @@ describe('schema object', () => {

assert.calledOnceWith(onSet, {
type: 'object',
object: match.same(obj),
object: sinon.match.same(obj),
key: 'nested',
value: 'test',
base: 'some',
Expand All @@ -1478,7 +1478,7 @@ describe('schema object', () => {

assert.calledOnceWith(onDelete, {
type: 'object',
object: match.same(obj),
object: sinon.match.same(obj),
key: 'nested',
base: 'some',
path: 'some.nested'
Expand All @@ -1499,7 +1499,7 @@ describe('schema object', () => {

assert.calledOnceWith(onSet, {
type: 'array',
array: match.same(original),
array: sinon.match.same(original),
index: 0,
value: 42,
base: 'array',
Expand All @@ -1518,7 +1518,7 @@ describe('schema object', () => {

assert.calledOnceWith(onSet, {
type: 'object',
object: match.same(original),
object: sinon.match.same(original),
key: 'num',
value: 42,
base: 'array_object[0]',
Expand All @@ -1534,7 +1534,7 @@ describe('schema object', () => {

assert.calledOnceWith(onDelete, {
type: 'array',
array: match.same(original),
array: sinon.match.same(original),
index: 2,
base: 'array',
path: 'array[2]'
Expand All @@ -1552,7 +1552,7 @@ describe('schema object', () => {

assert.calledOnceWith(onDelete, {
type: 'object',
object: match.same(original),
object: sinon.match.same(original),
key: 'num',
base: 'array_object[0]',
path: 'array_object[0].num'
Expand All @@ -1569,7 +1569,7 @@ describe('schema object', () => {

assert.equals(proxy.array, [2, 3, 7, 42]);
assert.calledOnceWith(onPush, {
array: match.same(original),
array: sinon.match.same(original),
base: 'array',
values: [42]
});
Expand Down Expand Up @@ -1604,7 +1604,7 @@ describe('schema object', () => {

assert.equals(proxy.array, [2, 3]);
assert.calledOnceWith(onPop, {
array: match.same(original),
array: sinon.match.same(original),
base: 'array'
});
refute.called(onSet);
Expand All @@ -1621,7 +1621,7 @@ describe('schema object', () => {

assert.equals(proxy.array, [3, 7]);
assert.calledOnceWith(onShift, {
array: match.same(original),
array: sinon.match.same(original),
base: 'array'
});
refute.called(onSet);
Expand All @@ -1637,7 +1637,7 @@ describe('schema object', () => {

assert.equals(proxy.array, [42, 2, 3, 7]);
assert.calledOnceWith(onUnshift, {
array: match.same(original),
array: sinon.match.same(original),
base: 'array',
values: [42]
});
Expand Down Expand Up @@ -1671,7 +1671,7 @@ describe('schema object', () => {

assert.equals(proxy.array, [42, 365, 7]);
assert.calledOnceWith(onSplice, {
array: match.same(original),
array: sinon.match.same(original),
base: 'array',
start: 0,
delete_count: 2,
Expand Down
2 changes: 1 addition & 1 deletion lib/verifyer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

const { EventEmitter } = require('events');
const { failType } = require('./util');

exports.verifyer = verifyer;

/**
* @typedef {import('events').EventEmitter} EventEmitter
* @typedef {null | boolean | number | string} SchemaLiteral
* @typedef {undefined | SchemaLiteral | SchemaArrayValue | SchemaObjectValue} SchemaValue
* @typedef {SchemaValue[]} SchemaArrayValue
Expand Down
Loading