Skip to content

Commit

Permalink
chore: pob update and move to node test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Dec 31, 2023
1 parent fc7396d commit f19f066
Show file tree
Hide file tree
Showing 263 changed files with 312 additions and 2,920 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jobs:
- name: Install Dependencies
run: yarn install --immutable --immutable-cache

- name: Generate Coverage
run: yarn test --coverage --coverageReporters=lcov --coverageDirectory=docs/coverage/

- name: Create nojekyll
run: touch docs/.nojekyll

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push-renovate-pob_root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- "renovate/pob-root"
- "renovate/pob-root-**"
- "renovate/major-pob-root"

jobs:
run-install-and-commit-modified-files:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push-renovate-prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- "renovate/prettier-**"
- "renovate/major-prettier"

jobs:
run-prettier:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: startsWith(matrix.node-version, '20.')

- name: Generate Test Coverage
run: yarn run test:coverage
run: yarn run test:coverage:json
if: startsWith(matrix.node-version, '20.')
env:
CI: true
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ do
# Skip if branch deletion
if [ "$local_sha" != "$z40" ]; then
if [ "$local_ref" = "$branch_ref" ]; then
yarn run checks && yarn run lint && yarn test --watchAll=false --changedSince=origin/main
yarn run checks && yarn run lint && yarn test
fi
fi
done
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/bser-npm-2.1.1-cc902055ce-24d8dfb7b6.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/co-npm-4.6.0-03f2d1feb6-c0e85ea0ca.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/depd-npm-2.0.0-b6c51a4b43-58bd06ec20.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/exit-npm-0.1.2-ef3761a67d-71d2ad9b36.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/fsevents-patch-19706e7e35-10c0.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/glob-npm-8.1.0-65f64af8b1-cb0b5cab17.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/nopt-npm-6.0.0-5ea8050815-837b52c330.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/ssri-npm-9.0.1-33ce27f4f8-c5d153ce03.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/tmpl-npm-1.0.5-d399ba37e2-f935537799.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion .yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"documentation": false,
"testing": {
"ci": true,
"codecov": true
"codecov": true,
"runner": "node"
}
}
}
Expand Down
10 changes: 0 additions & 10 deletions jest.config.json

This file was deleted.

38 changes: 26 additions & 12 deletions lib/index.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import assert from 'node:assert/strict';
import { test } from 'node:test';
import { deepFreeze } from './index.js';

test('unexpected non object: null', () => {
expect(() => {
deepFreeze(null);
}).toThrow('Cannot convert undefined or null to object');
assert.throws(
() => {
deepFreeze(null);
},
{ message: 'Cannot convert undefined or null to object' },
);
});

test('freeze map', () => {
Expand All @@ -13,18 +18,24 @@ test('freeze map', () => {
[2, 2],
]),
});
expect(() => {
obj.map.clear();
}).toThrow('map is read-only');
assert.throws(
() => {
obj.map.clear();
},
{ message: 'map is read-only' },
);
});

test('freeze set', () => {
const obj = deepFreeze({
set: new Set([1, 2]),
});
expect(() => {
obj.set.add(3);
}).toThrow('set is read-only');
assert.throws(
() => {
obj.set.add(3);
},
{ message: 'set is read-only' },
);
});

test('freeze function', () => {
Expand All @@ -34,7 +45,10 @@ test('freeze function', () => {
fn: mockFn,
});

expect(() => {
obj.fn.something = '';
}).toThrow('Cannot add property something, object is not extensible');
assert.throws(
() => {
obj.fn.something = '';
},
{ message: 'Cannot add property something, object is not extensible' },
);
});
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
"url": "https://github.com/christophehurpeau/deep-freeze-es6/issues"
},
"type": "module",
"packageManager": "[email protected]",
"engines": {
"node": ">=18.12.0"
},
"packageManager": "[email protected]",
"sideEffects": false,
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"exports": {
Expand All @@ -29,7 +30,6 @@
},
"./package.json": "./package.json"
},
"sideEffects": false,
"files": [
"lib"
],
Expand All @@ -42,26 +42,26 @@
"lint:prettier": "pob-root-prettier --check .",
"lint:prettier:fix": "pob-root-prettier --write .",
"postinstallDev": "pob-root-postinstall",
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
"test": "TS_NODE_PROJECT=tsconfig.test.json node --test lib/**/*.test.js",
"test-typings": "tsc -p typings/tsconfig.json",
"test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage --coverageReporters=json --coverageReporters=text",
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
"test:coverage": "TS_NODE_PROJECT=tsconfig.test.json npx c8 --src ./lib node --test lib/**/*.test.js",
"test:coverage:json": "TS_NODE_PROJECT=tsconfig.test.json npx c8 --reporter=json --src ./lib node --test lib/**/*.test.js",
"test:coverage:lcov": "TS_NODE_PROJECT=tsconfig.test.json npx c8 --reporter=lcov --src ./lib node --test lib/**/*.test.js",
"test:watch": "TS_NODE_PROJECT=tsconfig.test.json node --test lib/**/*.test.js"
},
"prettier": "@pob/root/prettier-config",
"commitlint": {
"extends": [
"@pob/commitlint-config"
]
},
"pob": {},
"prettier": "@pob/root/prettier-config",
"devDependencies": {
"@pob/commitlint-config": "6.3.1",
"@pob/eslint-config": "53.0.0",
"@pob/root": "8.12.0",
"@types/jest": "29.5.11",
"@pob/root": "9.1.0",
"check-package-dependencies": "7.0.0",
"eslint": "8.56.0",
"jest": "29.7.0",
"typescript": "5.3.3"
}
}
Loading

0 comments on commit f19f066

Please sign in to comment.