Compare commits
14 Commits
Author | SHA1 | Date |
---|---|---|
|
1ca78906a9 | |
|
9d68a62da4 | |
|
6c19ce79c3 | |
|
fc8b31fe36 | |
|
c82e029e90 | |
|
b501c07de1 | |
|
aeb2eae343 | |
|
747e1f6205 | |
|
c9c391ffd0 | |
|
d5ffbd6ba8 | |
|
1c0b3afac5 | |
|
afd180d7cf | |
|
aa063f9eae | |
|
105964614f |
|
@ -9,24 +9,6 @@
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2022
|
"ecmaVersion": 2022
|
||||||
},
|
},
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"**/*.test.js"
|
|
||||||
],
|
|
||||||
"env": {
|
|
||||||
"jest": true
|
|
||||||
},
|
|
||||||
"plugins": ["jest"],
|
|
||||||
"rules": {
|
|
||||||
"jest/no-disabled-tests": "warn",
|
|
||||||
"jest/no-focused-tests": "error",
|
|
||||||
"jest/no-identical-title": "error",
|
|
||||||
"jest/prefer-to-have-length": "warn",
|
|
||||||
"jest/valid-expect": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
"es6": true
|
"es6": true
|
||||||
|
@ -80,14 +62,8 @@
|
||||||
"linebreak-style": [0],
|
"linebreak-style": [0],
|
||||||
"node/no-missing-require": [0],
|
"node/no-missing-require": [0],
|
||||||
"no-console": [0],
|
"no-console": [0],
|
||||||
"node/no-unsupported-features/es-builtins": [
|
"node/no-unsupported-features/es-builtins": 0,
|
||||||
"error",
|
"node/no-unsupported-features/node-builtins": 0,
|
||||||
{ "version": ">=18.12.1" }
|
|
||||||
],
|
|
||||||
"node/no-unsupported-features/node-builtins": [
|
|
||||||
"error",
|
|
||||||
{ "version": ">=18.12.1" }
|
|
||||||
],
|
|
||||||
"func-names": [
|
"func-names": [
|
||||||
"error",
|
"error",
|
||||||
"never",
|
"never",
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
test/binding.gyp linguist-vendored
|
test-addon/binding.gyp linguist-vendored
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
name: Cpplint
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
eslint:
|
||||||
|
name: Cpplint
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Fetch Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Install Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18.16.0
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Modules
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Install Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
|
- name: Install Cpplint
|
||||||
|
run: pip install cpplint
|
||||||
|
|
||||||
|
- name: Run Cpplint
|
||||||
|
run: |
|
||||||
|
node -e "require('.').cpcpplint()"
|
||||||
|
cpplint --recursive ./test-addon
|
||||||
|
cpplint --recursive ./include
|
|
@ -0,0 +1,36 @@
|
||||||
|
name: ESLint
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
eslint:
|
||||||
|
name: ESLint
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Fetch Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Install Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18.16.0
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Modules
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Run ESLint
|
||||||
|
run: npm run eslint
|
|
@ -21,7 +21,7 @@ jobs:
|
||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18.12.1
|
node-version: 18.16.0
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
|
||||||
- name: Get Package Version
|
- name: Get Package Version
|
||||||
|
@ -41,7 +41,6 @@ jobs:
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
draft: true
|
|
||||||
tag_name: ${{ steps.package-version.outputs.version }}
|
tag_name: ${{ steps.package-version.outputs.version }}
|
||||||
name: Release ${{ steps.package-version.outputs.version }}
|
name: Release ${{ steps.package-version.outputs.version }}
|
||||||
body: Published at ${{ github.sha }}
|
body: Published at ${{ github.sha }}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: Validate
|
name: Test
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
@ -12,29 +12,6 @@ on:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
eslint:
|
|
||||||
name: ESLint
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- name: Fetch Repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Install Node.js
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 18.12.1
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install Modules
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run ESLint
|
|
||||||
run: npm run eslint
|
|
||||||
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
name: Unit Tests
|
name: Unit Tests
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -53,7 +30,7 @@ jobs:
|
||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18.12.1
|
node-version: 18.16.0
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
|
||||||
- name: Install Modules
|
- name: Install Modules
|
|
@ -5,6 +5,5 @@
|
||||||
.project
|
.project
|
||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules/
|
node_modules/
|
||||||
test/build/
|
test-addon/build/
|
||||||
doc/jest/
|
|
||||||
*.log
|
*.log
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${workspaceFolder}/**",
|
"${workspaceFolder}/**",
|
||||||
"${LocalAppData}/node-gyp/Cache/16.17.0/include/node",
|
"${LocalAppData}/node-gyp/Cache/16.17.0/include/node",
|
||||||
"${LocalAppData}/node-gyp/Cache/18.12.1/include/node"
|
"${LocalAppData}/node-gyp/Cache/18.16.0/include/node"
|
||||||
],
|
],
|
||||||
"windowsSdkVersion": "10.0.19041.0",
|
"windowsSdkVersion": "10.0.19041.0",
|
||||||
"cStandard": "c17",
|
"cStandard": "c17",
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2022 Luis Blanco
|
Copyright (c) 2023 Luis Blanco
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
10
README.md
10
README.md
|
@ -3,10 +3,12 @@
|
||||||
This is a part of [Node3D](https://github.com/node-3d) project.
|
This is a part of [Node3D](https://github.com/node-3d) project.
|
||||||
|
|
||||||
[](https://badge.fury.io/js/addon-tools-raub)
|
[](https://badge.fury.io/js/addon-tools-raub)
|
||||||
[](https://www.codefactor.io/repository/github/node-3d/addon-tools-raub)
|
[](https://github.com/node-3d/addon-tools-raub/actions/workflows/eslint.yml)
|
||||||
|
[](https://github.com/node-3d/addon-tools-raub/actions/workflows/test.yml)
|
||||||
|
[](https://github.com/node-3d/addon-tools-raub/actions/workflows/cpplint.yml)
|
||||||
|
|
||||||
```
|
```
|
||||||
npm i addon-tools-raub
|
npm i -s addon-tools-raub
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,9 +67,9 @@ See the [TypeScript definitions](/index.d.ts) with comments.
|
||||||
the **napi.h** include path won't be a part of the returned string.
|
the **napi.h** include path won't be a part of the returned string.
|
||||||
|
|
||||||
|
|
||||||
### Example of `cpbin` usage in **package.json :: scripts**:
|
### Example of `cpbin` in **package.json :: scripts**:
|
||||||
|
|
||||||
```
|
```
|
||||||
"build-all": "cd src && node-gyp rebuild -j max --silent && node -e \"require('addon-tools-raub').cpbin('segfault')\" && cd ..",
|
"build": "cd src && node-gyp rebuild -j max --silent && node -e \"require('addon-tools-raub').cpbin('segfault')\" && cd ..",
|
||||||
"build-only": "cd src && node-gyp build -j max --silent && node -e \"require('addon-tools-raub').cpbin('segfault')\" && cd ..",
|
"build-only": "cd src && node-gyp build -j max --silent && node -e \"require('addon-tools-raub').cpbin('segfault')\" && cd ..",
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"rootDir": "../",
|
|
||||||
"moduleFileExtensions": [
|
|
||||||
"js",
|
|
||||||
"node"
|
|
||||||
],
|
|
||||||
"testMatch": [
|
|
||||||
"<rootDir>/**/*.test.js"
|
|
||||||
],
|
|
||||||
"coverageDirectory": "doc/jest",
|
|
||||||
"coverageReporters": [
|
|
||||||
"lcov"
|
|
||||||
],
|
|
||||||
"collectCoverageFrom": [
|
|
||||||
"**/*.js",
|
|
||||||
"!**/*.test.js",
|
|
||||||
"!index.js",
|
|
||||||
"!utils.js"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,5 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const tools = require('.');
|
const tools = require('.');
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,30 +12,30 @@ describe('AT / include', () => {
|
||||||
stringMethods.forEach((name) => {
|
stringMethods.forEach((name) => {
|
||||||
describe(`#${name}()`, () => {
|
describe(`#${name}()`, () => {
|
||||||
it('is a function', () => {
|
it('is a function', () => {
|
||||||
expect(typeof tools[name]).toBe('function');
|
assert.strictEqual(typeof tools[name], 'function');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns an object', () => {
|
it('returns an object', () => {
|
||||||
expect(typeof tools[name]()).toBe('string');
|
assert.strictEqual(typeof tools[name](), 'string');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#getPaths()', () => {
|
describe('#getPaths()', () => {
|
||||||
it('is a function', () => {
|
it('is a function', () => {
|
||||||
expect(typeof tools.getPaths).toBe('function');
|
assert.strictEqual(typeof tools.getPaths, 'function');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns an object', () => {
|
it('returns an object', () => {
|
||||||
expect(typeof tools.getPaths(__dirname)).toBe('object');
|
assert.strictEqual(typeof tools.getPaths(__dirname), 'object');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has "include" string', () => {
|
it('has "include" string', () => {
|
||||||
expect(typeof tools.getPaths(__dirname).include).toBe('string');
|
assert.strictEqual(typeof tools.getPaths(__dirname).include, 'string');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has "bin" string', () => {
|
it('has "bin" string', () => {
|
||||||
expect(typeof tools.getPaths(__dirname).include).toBe('string');
|
assert.strictEqual(typeof tools.getPaths(__dirname).include, 'string');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,22 +1,26 @@
|
||||||
import type { Stats } from 'node:fs';
|
|
||||||
import type { Writable } from 'node:stream';
|
|
||||||
|
|
||||||
|
|
||||||
declare module "addon-tools-raub" {
|
declare module "addon-tools-raub" {
|
||||||
|
type Stats = import('node:fs').Stats;
|
||||||
|
type Writable = import('node:stream').Writable;
|
||||||
|
type Readable = import('node:stream').Readable;
|
||||||
|
type WritableOptions = import('node:stream').WritableOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the internal paths for an addon
|
* Get the internal paths for an addon
|
||||||
* Returns a set of platform dependent paths depending on the input dir
|
*
|
||||||
*/
|
* Returns a set of platform dependent paths depending on the input dir
|
||||||
|
*/
|
||||||
export const getPaths: (dir: string) => Readonly<{
|
export const getPaths: (dir: string) => Readonly<{
|
||||||
/**
|
/**
|
||||||
* Path to binaries
|
* Path to binaries
|
||||||
* Platform binary directory absolute path for this `dir`
|
*
|
||||||
*/
|
* Platform binary directory absolute path for this `dir`
|
||||||
|
*/
|
||||||
bin: string;
|
bin: string;
|
||||||
/**
|
/**
|
||||||
* Path to include
|
* Path to include
|
||||||
* Include directory for this `dir`
|
*
|
||||||
*/
|
* Include directory for this `dir`
|
||||||
|
*/
|
||||||
include: string;
|
include: string;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
@ -24,214 +28,334 @@ declare module "addon-tools-raub" {
|
||||||
type TPlatformDir = `bin-${TPlatformName}`;
|
type TPlatformDir = `bin-${TPlatformName}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the platform-specific binary directory name
|
* Get the platform-specific binary directory name
|
||||||
*/
|
*/
|
||||||
export const getBin: () => TPlatformDir;
|
export const getBin: () => TPlatformDir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the platform identifier
|
* Get the platform identifier
|
||||||
*/
|
*/
|
||||||
export const getPlatform: () => TPlatformName;
|
export const getPlatform: () => TPlatformName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the include directories for **binding.gyp**
|
* Get the include directories for **binding.gyp**
|
||||||
* Both 'addon-tools-raub' and 'node-addon-api' include paths.
|
*
|
||||||
* In binding.gyp: `'<!@(node -p "require(\'addon-tools-raub\').getInclude()")'`
|
* Both 'addon-tools-raub' and 'node-addon-api' include paths.
|
||||||
*/
|
* In binding.gyp: `'<!@(node -p "require(\'addon-tools-raub\').getInclude()")'`
|
||||||
|
*/
|
||||||
export const getInclude: () => string;
|
export const getInclude: () => string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install binaries
|
* Install binaries
|
||||||
* Downloads and unpacks the platform specific binary for the calling package.
|
*
|
||||||
* To use it, create a new script for your package, which may as well be named
|
* Downloads and unpacks the platform specific binary for the calling package.
|
||||||
* **install.js**, with the following content:
|
* To use it, create a new script for your package, which may as well be named
|
||||||
*
|
* **install.js**, with the following content:
|
||||||
* ```
|
*
|
||||||
* 'use strict';
|
* ```
|
||||||
* const { install } = require('addon-tools-raub');
|
* 'use strict';
|
||||||
* const prefix = 'https://github.com/USER/ADDON-NAME/releases/download';
|
* const { install } = require('addon-tools-raub');
|
||||||
* const tag = '1.0.0';
|
* const prefix = 'https://github.com/USER/ADDON-NAME/releases/download';
|
||||||
* install(`${prefix}/${tag}`);
|
* const tag = '1.0.0';
|
||||||
* ```
|
* install(`${prefix}/${tag}`);
|
||||||
*
|
* ```
|
||||||
* * `prefix` - the constant base part of the download url.
|
*
|
||||||
* * `tag` - the version-dependent part of the url.
|
* * `prefix` - the constant base part of the download url.
|
||||||
*
|
* * `tag` - the version-dependent part of the url.
|
||||||
* ```
|
*
|
||||||
* "scripts": {
|
* ```
|
||||||
* "postinstall": "node install"
|
* "scripts": {
|
||||||
* },
|
* "postinstall": "node install"
|
||||||
* ```
|
* },
|
||||||
*/
|
* ```
|
||||||
export const install: (folder: string) => void;
|
*/
|
||||||
|
export const install: (folder: string) => Promise<boolean>;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy binary
|
* Copy binary
|
||||||
* Copies the addon binary from `src/build/Release` to the platform-specific folder.
|
*
|
||||||
*
|
* Copies the addon binary from `src/build/Release` to the platform-specific folder.
|
||||||
* ```
|
*
|
||||||
* "scripts": {
|
* ```
|
||||||
* * "build": "node-gyp rebuild && node -e \"require('addon-tools-raub').cpbin('ADDON')\""
|
* "scripts": {
|
||||||
* },
|
* * "build": "node-gyp rebuild && node -e \"require('addon-tools-raub').cpbin('ADDON')\""
|
||||||
* ```
|
* },
|
||||||
*
|
* ```
|
||||||
* Here ADDON should be replaced with the name of your addon, without `.node` extension.
|
*
|
||||||
*/
|
* Here ADDON should be replaced with the name of your addon, without `.node` extension.
|
||||||
|
*/
|
||||||
export const cpbin: (name: string) => Promise<void>;
|
export const cpbin: (name: string) => Promise<void>;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packs binaries into GZIP
|
* Packs binaries into GZIP
|
||||||
* Example of `actionPack` usage in **Github Actions**:
|
*
|
||||||
*
|
* Example of `actionPack` usage in **Github Actions**:
|
||||||
* ```
|
*
|
||||||
* - name: Pack Files
|
* ```
|
||||||
* id: pack-files
|
* - name: Pack Files
|
||||||
* run: node -e "require('addon-tools-raub').actionPack()" >> $GITHUB_OUTPUT
|
* id: pack-files
|
||||||
* - name: Store Binaries
|
* run: node -e "require('addon-tools-raub').actionPack()" >> $GITHUB_OUTPUT
|
||||||
* uses: softprops/action-gh-release@v1
|
* - name: Store Binaries
|
||||||
* with:
|
* uses: softprops/action-gh-release@v1
|
||||||
* files: ${{ steps.pack-files.outputs.pack }}
|
* with:
|
||||||
* ```
|
* files: ${{ steps.pack-files.outputs.pack }}
|
||||||
*/
|
* ```
|
||||||
|
*/
|
||||||
export const actionPack: () => Promise<void>;
|
export const actionPack: () => Promise<void>;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download to memory
|
* Download to memory
|
||||||
* Accepts an **URL**, and returns an in-memory file Buffer,
|
*
|
||||||
* when the file is loaded. Use for small files, as the whole
|
* Accepts an **URL**, and returns an in-memory file Buffer,
|
||||||
* file will be loaded into memory at once.
|
* when the file is loaded. Use for small files, as the whole
|
||||||
*
|
* file will be loaded into memory at once.
|
||||||
* ```
|
*
|
||||||
* download(srcUrl).then(data => useData(data), err => emit('error', err));
|
* ```
|
||||||
* ```
|
* download(srcUrl).then(data => useData(data), err => emit('error', err));
|
||||||
* or
|
* ```
|
||||||
* ```
|
* or
|
||||||
* const data = await download(srcUrl);
|
* ```
|
||||||
* useData(data);
|
* const data = await download(srcUrl);
|
||||||
* ```
|
* useData(data);
|
||||||
*/
|
* ```
|
||||||
|
*/
|
||||||
export const download: (url: string) => Promise<Buffer>;
|
export const download: (url: string) => Promise<Buffer>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Read a file
|
* (async) Read a file
|
||||||
* Reads a whole file to string, NOT A Buffer
|
*
|
||||||
*/
|
* Reads a whole file to string, NOT A Buffer
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
type ComposeFnParam = (source: any) => void;
|
||||||
/**
|
/**
|
||||||
* WritableBuffer
|
* WritableBuffer
|
||||||
* A [Writable](https://nodejs.org/api/stream.html#stream_writable_streams)
|
*
|
||||||
* stream buffer, that is stored in-memory and can be fully
|
* A [Writable](https://nodejs.org/api/stream.html#stream_writable_streams)
|
||||||
* obtained when writing was finished. It is equivalent to stream-writing
|
* stream buffer, that is stored in-memory and can be fully
|
||||||
* a temporary file and then reading it into a `Buffer`.
|
* obtained when writing was finished. It is equivalent to stream-writing
|
||||||
*/
|
* a temporary file and then reading it into a `Buffer`.
|
||||||
export class WritableBuffer extends Writable {
|
*/
|
||||||
|
export class WritableBuffer implements Writable {
|
||||||
constructor();
|
constructor();
|
||||||
/**
|
/**
|
||||||
* Get the downloaded data
|
* Get the downloaded data
|
||||||
* Use `stream.get()` to obtain the data when writing was finished
|
* Use `stream.get()` to obtain the data when writing was finished
|
||||||
*/
|
*/
|
||||||
get(): Buffer;
|
get(): Buffer;
|
||||||
|
|
||||||
|
// ----------- implements Writable
|
||||||
|
|
||||||
|
readonly writable: boolean;
|
||||||
|
readonly writableEnded: boolean;
|
||||||
|
readonly writableFinished: boolean;
|
||||||
|
readonly writableHighWaterMark: number;
|
||||||
|
readonly writableLength: number;
|
||||||
|
readonly writableObjectMode: boolean;
|
||||||
|
readonly writableCorked: number;
|
||||||
|
destroyed: boolean;
|
||||||
|
readonly closed: boolean;
|
||||||
|
readonly errored: Error | null;
|
||||||
|
readonly writableNeedDrain: boolean;
|
||||||
|
constructor(opts?: WritableOptions);
|
||||||
|
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
|
||||||
|
_writev?(
|
||||||
|
chunks: Array<{
|
||||||
|
chunk: any;
|
||||||
|
encoding: BufferEncoding;
|
||||||
|
}>,
|
||||||
|
callback: (error?: Error | null) => void,
|
||||||
|
): void;
|
||||||
|
_construct?(callback: (error?: Error | null) => void): void;
|
||||||
|
_destroy(error: Error | null, callback: (error?: Error | null) => void): void;
|
||||||
|
_final(callback: (error?: Error | null) => void): void;
|
||||||
|
write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean;
|
||||||
|
write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean;
|
||||||
|
setDefaultEncoding(encoding: BufferEncoding): this;
|
||||||
|
end(cb?: () => void): this;
|
||||||
|
end(chunk: any, cb?: () => void): this;
|
||||||
|
end(chunk: any, encoding: BufferEncoding, cb?: () => void): this;
|
||||||
|
cork(): void;
|
||||||
|
uncork(): void;
|
||||||
|
destroy(error?: Error): this;
|
||||||
|
addListener(event: "close", listener: () => void): this;
|
||||||
|
addListener(event: "drain", listener: () => void): this;
|
||||||
|
addListener(event: "error", listener: (err: Error) => void): this;
|
||||||
|
addListener(event: "finish", listener: () => void): this;
|
||||||
|
addListener(event: "pipe", listener: (src: Readable) => void): this;
|
||||||
|
addListener(event: "unpipe", listener: (src: Readable) => void): this;
|
||||||
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
emit(event: "close"): boolean;
|
||||||
|
emit(event: "drain"): boolean;
|
||||||
|
emit(event: "error", err: Error): boolean;
|
||||||
|
emit(event: "finish"): boolean;
|
||||||
|
emit(event: "pipe", src: Readable): boolean;
|
||||||
|
emit(event: "unpipe", src: Readable): boolean;
|
||||||
|
emit(event: string | symbol, ...args: any[]): boolean;
|
||||||
|
on(event: "close", listener: () => void): this;
|
||||||
|
on(event: "drain", listener: () => void): this;
|
||||||
|
on(event: "error", listener: (err: Error) => void): this;
|
||||||
|
on(event: "finish", listener: () => void): this;
|
||||||
|
on(event: "pipe", listener: (src: Readable) => void): this;
|
||||||
|
on(event: "unpipe", listener: (src: Readable) => void): this;
|
||||||
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
once(event: "close", listener: () => void): this;
|
||||||
|
once(event: "drain", listener: () => void): this;
|
||||||
|
once(event: "error", listener: (err: Error) => void): this;
|
||||||
|
once(event: "finish", listener: () => void): this;
|
||||||
|
once(event: "pipe", listener: (src: Readable) => void): this;
|
||||||
|
once(event: "unpipe", listener: (src: Readable) => void): this;
|
||||||
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
prependListener(event: "close", listener: () => void): this;
|
||||||
|
prependListener(event: "drain", listener: () => void): this;
|
||||||
|
prependListener(event: "error", listener: (err: Error) => void): this;
|
||||||
|
prependListener(event: "finish", listener: () => void): this;
|
||||||
|
prependListener(event: "pipe", listener: (src: Readable) => void): this;
|
||||||
|
prependListener(event: "unpipe", listener: (src: Readable) => void): this;
|
||||||
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
prependOnceListener(event: "close", listener: () => void): this;
|
||||||
|
prependOnceListener(event: "drain", listener: () => void): this;
|
||||||
|
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
||||||
|
prependOnceListener(event: "finish", listener: () => void): this;
|
||||||
|
prependOnceListener(event: "pipe", listener: (src: Readable) => void): this;
|
||||||
|
prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this;
|
||||||
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
removeListener(event: "close", listener: () => void): this;
|
||||||
|
removeListener(event: "drain", listener: () => void): this;
|
||||||
|
removeListener(event: "error", listener: (err: Error) => void): this;
|
||||||
|
removeListener(event: "finish", listener: () => void): this;
|
||||||
|
removeListener(event: "pipe", listener: (src: Readable) => void): this;
|
||||||
|
removeListener(event: "unpipe", listener: (src: Readable) => void): this;
|
||||||
|
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
pipe<T extends NodeJS.WritableStream>(
|
||||||
|
destination: T,
|
||||||
|
options?: {
|
||||||
|
end?: boolean | undefined;
|
||||||
|
},
|
||||||
|
): T;
|
||||||
|
compose<T extends NodeJS.ReadableStream>(
|
||||||
|
stream: T | ComposeFnParam | Iterable<T> | AsyncIterable<T>,
|
||||||
|
options?: { signal: AbortSignal },
|
||||||
|
): T;
|
||||||
|
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
removeAllListeners(event?: string | symbol): this;
|
||||||
|
setMaxListeners(n: number): this;
|
||||||
|
getMaxListeners(): number;
|
||||||
|
listeners(eventName: string | symbol): Function[];
|
||||||
|
rawListeners(eventName: string | symbol): Function[];
|
||||||
|
emit(eventName: string | symbol, ...args: any[]): boolean;
|
||||||
|
listenerCount(eventName: string | symbol, listener?: Function): number;
|
||||||
|
eventNames(): Array<string | symbol>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const read: (name: string) => Promise<string>;
|
export const read: (name: string) => Promise<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Write a file
|
* (async) Write a file
|
||||||
*/
|
*/
|
||||||
export const write: (name: string, text: string) => Promise<void>;
|
export const write: (name: string, text: string) => Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Copy a file
|
* (async) Copy a file
|
||||||
*/
|
*/
|
||||||
export const copy: (src: string, dest: string) => Promise<void>;
|
export const copy: (src: string, dest: string) => Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Check if a file/folder exists
|
* (async) Check if a file/folder exists
|
||||||
*/
|
*/
|
||||||
export const exists: (name: string) => Promise<boolean>;
|
export const exists: (name: string) => Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Create an empty folder
|
* (async) Create an empty folder
|
||||||
*/
|
*/
|
||||||
export const mkdir: (name: string) => Promise<void>;
|
export const mkdir: (name: string) => Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Get status on a file
|
* (async) Get status on a file
|
||||||
*/
|
*/
|
||||||
export const stat: (name: string) => Promise<Stats>;
|
export const stat: (name: string) => Promise<Stats>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Check if the path is a folder
|
* (async) Check if the path is a folder
|
||||||
*/
|
*/
|
||||||
export const isDir: (name: string) => Promise<boolean>;
|
export const isDir: (name: string) => Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Check if the path is a file
|
* (async) Check if the path is a file
|
||||||
*/
|
*/
|
||||||
export const isFile: (name: string) => Promise<boolean>;
|
export const isFile: (name: string) => Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cut the path one folder up
|
* Cut the path one folder up
|
||||||
*/
|
*/
|
||||||
export const dirUp: (dir: string) => string;
|
export const dirUp: (dir: string) => string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Create a directory
|
* (async) Create a directory
|
||||||
* Like `mkdir -p`, makes sure a directory exists
|
*
|
||||||
*/
|
* Like `mkdir -p`, makes sure a directory exists
|
||||||
|
*/
|
||||||
export const ensuredir: (dir: string) => Promise<void>;
|
export const ensuredir: (dir: string) => Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Copy a file
|
* (async) Copy a file
|
||||||
* Copy a file, `dest` folder is created if needed
|
*
|
||||||
*/
|
* Copy a file, `dest` folder is created if needed
|
||||||
|
*/
|
||||||
export const copysafe: (src: string, dest: string) => Promise<void>;
|
export const copysafe: (src: string, dest: string) => Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Read a directory
|
* (async) Read a directory
|
||||||
* Get file/folder names of the 1st level
|
*
|
||||||
*/
|
* Get file/folder names of the 1st level
|
||||||
|
*/
|
||||||
export const readdir: (src: string, dest: string) => Promise<ReadonlyArray<string>>;
|
export const readdir: (src: string, dest: string) => Promise<ReadonlyArray<string>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) List subdirectories
|
* (async) List subdirectories
|
||||||
* Get folder paths (concatenated with input) of the 1st level
|
*
|
||||||
*/
|
* Get folder paths (concatenated with input) of the 1st level
|
||||||
|
*/
|
||||||
export const subdirs: (name: string) => Promise<ReadonlyArray<string>>;
|
export const subdirs: (name: string) => Promise<ReadonlyArray<string>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) List nested files
|
* (async) List nested files
|
||||||
* Get file paths (concatenated with input) of the 1st level
|
*
|
||||||
*/
|
* Get file paths (concatenated with input) of the 1st level
|
||||||
|
*/
|
||||||
export const subfiles: (name: string) => Promise<ReadonlyArray<string>>;
|
export const subfiles: (name: string) => Promise<ReadonlyArray<string>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Get all nested files recursively
|
* (async) Get all nested files recursively
|
||||||
* Folder paths are omitted by default.
|
*
|
||||||
* Order is: shallow-to-deep, each subdirectory lists dirs-then-files.
|
* Folder paths are omitted by default.
|
||||||
*/
|
* Order is: shallow-to-deep, each subdirectory lists dirs-then-files.
|
||||||
|
*/
|
||||||
export const traverse: (name: string, showDirs?: boolean) => Promise<ReadonlyArray<string>>;
|
export const traverse: (name: string, showDirs?: boolean) => Promise<ReadonlyArray<string>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Copy a directory
|
* (async) Copy a directory
|
||||||
* Copy a folder with all the contained files
|
*
|
||||||
*/
|
* Copy a folder with all the contained files
|
||||||
|
*/
|
||||||
export const copyall: (src: string, dest: string) => Promise<void>;
|
export const copyall: (src: string, dest: string) => Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Remove a directory
|
* (async) Remove a directory
|
||||||
* Like `rm -rf`, removes everything recursively
|
*
|
||||||
*/
|
* Like `rm -rf`, removes everything recursively
|
||||||
|
*/
|
||||||
export const rmdir: (name: string) => Promise<void>;
|
export const rmdir: (name: string) => Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (async) Remove a file
|
* (async) Remove a file
|
||||||
* Must be a file, not a folder. Just `fs.unlink`.
|
*
|
||||||
*/
|
* Must be a file, not a folder. Just `fs.unlink`.
|
||||||
|
*/
|
||||||
export const rm: (name: string) => Promise<void>;
|
export const rm: (name: string) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"author": "Luis Blanco <luisblanco1337@gmail.com>",
|
"author": "Luis Blanco <luisblanco1337@gmail.com>",
|
||||||
"name": "addon-tools-raub",
|
"name": "addon-tools-raub",
|
||||||
"version": "7.0.0",
|
"version": "7.4.0",
|
||||||
"description": "Helpers for Node.js addons and dependency packages",
|
"description": "Helpers for Node.js addons and dependency packages",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
@ -29,14 +29,13 @@
|
||||||
"README.md"
|
"README.md"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.12.1",
|
"node": ">=18.16.0",
|
||||||
"npm": ">=8.19.2"
|
"npm": ">=9.5.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"eslint": "eslint .",
|
"eslint": "eslint .",
|
||||||
"test": "jest --coverage=false --watch --config=conf/jest.json",
|
"test": "node --test --watch .",
|
||||||
"test-ci": "jest --ci --runInBand --coverage=false --forceExit --detectOpenHandles --config=conf/jest.json",
|
"test-ci": "node --test",
|
||||||
"test-coverage": "rm -rf doc/jest && jest --coverage --silent --config=conf/jest.json",
|
|
||||||
"build-test": "cd test-addon && node-gyp rebuild -j max --silent && cd .."
|
"build-test": "cd test-addon && node-gyp rebuild -j max --silent && cd .."
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -44,17 +43,18 @@
|
||||||
"url": "https://github.com/node-3d/addon-tools-raub.git"
|
"url": "https://github.com/node-3d/addon-tools-raub.git"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"node-addon-api": "^5.0.0"
|
"node-addon-api": "^7.0.0"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
"node-addon-api": { "optional": true }
|
"node-addon-api": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint-plugin-jest": "^27.2.0",
|
"@types/node": "^20.8.3",
|
||||||
|
"eslint": "^8.51.0",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint": "^8.31.0",
|
"node-addon-api": "^7.0.0",
|
||||||
"jest": "^29.3.1",
|
"typescript": "^5.2.2"
|
||||||
"node-addon-api": "^5.0.0",
|
|
||||||
"typescript": "^4.9.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project>
|
|
||||||
<ProjectOutputs>
|
|
||||||
<ProjectOutput>
|
|
||||||
<FullPath>C:\_projects\addon-tools-raub\test-addon\build\Release\test.node</FullPath>
|
|
||||||
</ProjectOutput>
|
|
||||||
</ProjectOutputs>
|
|
||||||
<ContentFiles />
|
|
||||||
<SatelliteDlls />
|
|
||||||
<NonRecipeFileRefs />
|
|
||||||
</Project>
|
|
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.
|
@ -1,2 +0,0 @@
|
||||||
PlatformToolSet=v142:VCToolArchitecture=Native64Bit:VCToolsVersion=14.28.29910:TargetPlatformVersion=10.0.19041.0:
|
|
||||||
Release|x64|C:\_projects\addon-tools-raub\test-addon\build\|
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,19 +0,0 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 2015
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcxproj", "{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}.Release|x64.Build.0 = Release|x64
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
|
@ -1,397 +0,0 @@
|
||||||
# Do not edit. File was generated by node-gyp's "configure" step
|
|
||||||
{
|
|
||||||
"target_defaults": {
|
|
||||||
"cflags": [],
|
|
||||||
"default_configuration": "Release",
|
|
||||||
"defines": [],
|
|
||||||
"include_dirs": [],
|
|
||||||
"libraries": [],
|
|
||||||
"msbuild_toolset": "v142",
|
|
||||||
"msvs_windows_target_platform_version": "10.0.19041.0"
|
|
||||||
},
|
|
||||||
"variables": {
|
|
||||||
"asan": 0,
|
|
||||||
"coverage": "false",
|
|
||||||
"dcheck_always_on": 0,
|
|
||||||
"debug_nghttp2": "false",
|
|
||||||
"debug_node": "false",
|
|
||||||
"enable_lto": "false",
|
|
||||||
"enable_pgo_generate": "false",
|
|
||||||
"enable_pgo_use": "false",
|
|
||||||
"error_on_warn": "false",
|
|
||||||
"force_dynamic_crt": 0,
|
|
||||||
"host_arch": "x64",
|
|
||||||
"icu_data_in": "..\\..\\deps\\icu-tmp\\icudt71l.dat",
|
|
||||||
"icu_endianness": "l",
|
|
||||||
"icu_gyp_path": "tools/icu/icu-generic.gyp",
|
|
||||||
"icu_path": "deps/icu-small",
|
|
||||||
"icu_small": "false",
|
|
||||||
"icu_ver_major": "71",
|
|
||||||
"is_debug": 0,
|
|
||||||
"libdir": "lib",
|
|
||||||
"llvm_version": "0.0",
|
|
||||||
"napi_build_version": "8",
|
|
||||||
"nasm_version": "2.15",
|
|
||||||
"node_byteorder": "little",
|
|
||||||
"node_debug_lib": "false",
|
|
||||||
"node_enable_d8": "false",
|
|
||||||
"node_fipsinstall": "false",
|
|
||||||
"node_install_corepack": "true",
|
|
||||||
"node_install_npm": "true",
|
|
||||||
"node_library_files": [
|
|
||||||
"lib/_http_agent.js",
|
|
||||||
"lib/_http_client.js",
|
|
||||||
"lib/_http_common.js",
|
|
||||||
"lib/_http_incoming.js",
|
|
||||||
"lib/_http_outgoing.js",
|
|
||||||
"lib/_http_server.js",
|
|
||||||
"lib/_stream_duplex.js",
|
|
||||||
"lib/_stream_passthrough.js",
|
|
||||||
"lib/_stream_readable.js",
|
|
||||||
"lib/_stream_transform.js",
|
|
||||||
"lib/_stream_wrap.js",
|
|
||||||
"lib/_stream_writable.js",
|
|
||||||
"lib/_tls_common.js",
|
|
||||||
"lib/_tls_wrap.js",
|
|
||||||
"lib/assert.js",
|
|
||||||
"lib/assert/strict.js",
|
|
||||||
"lib/async_hooks.js",
|
|
||||||
"lib/buffer.js",
|
|
||||||
"lib/child_process.js",
|
|
||||||
"lib/cluster.js",
|
|
||||||
"lib/console.js",
|
|
||||||
"lib/constants.js",
|
|
||||||
"lib/crypto.js",
|
|
||||||
"lib/dgram.js",
|
|
||||||
"lib/diagnostics_channel.js",
|
|
||||||
"lib/dns.js",
|
|
||||||
"lib/dns/promises.js",
|
|
||||||
"lib/domain.js",
|
|
||||||
"lib/events.js",
|
|
||||||
"lib/fs.js",
|
|
||||||
"lib/fs/promises.js",
|
|
||||||
"lib/http.js",
|
|
||||||
"lib/http2.js",
|
|
||||||
"lib/https.js",
|
|
||||||
"lib/inspector.js",
|
|
||||||
"lib/internal/abort_controller.js",
|
|
||||||
"lib/internal/assert.js",
|
|
||||||
"lib/internal/assert/assertion_error.js",
|
|
||||||
"lib/internal/assert/calltracker.js",
|
|
||||||
"lib/internal/assert/snapshot.js",
|
|
||||||
"lib/internal/async_hooks.js",
|
|
||||||
"lib/internal/blob.js",
|
|
||||||
"lib/internal/blocklist.js",
|
|
||||||
"lib/internal/bootstrap/browser.js",
|
|
||||||
"lib/internal/bootstrap/loaders.js",
|
|
||||||
"lib/internal/bootstrap/node.js",
|
|
||||||
"lib/internal/bootstrap/switches/does_not_own_process_state.js",
|
|
||||||
"lib/internal/bootstrap/switches/does_own_process_state.js",
|
|
||||||
"lib/internal/bootstrap/switches/is_main_thread.js",
|
|
||||||
"lib/internal/bootstrap/switches/is_not_main_thread.js",
|
|
||||||
"lib/internal/buffer.js",
|
|
||||||
"lib/internal/child_process.js",
|
|
||||||
"lib/internal/child_process/serialization.js",
|
|
||||||
"lib/internal/cli_table.js",
|
|
||||||
"lib/internal/cluster/child.js",
|
|
||||||
"lib/internal/cluster/primary.js",
|
|
||||||
"lib/internal/cluster/round_robin_handle.js",
|
|
||||||
"lib/internal/cluster/shared_handle.js",
|
|
||||||
"lib/internal/cluster/utils.js",
|
|
||||||
"lib/internal/cluster/worker.js",
|
|
||||||
"lib/internal/console/constructor.js",
|
|
||||||
"lib/internal/console/global.js",
|
|
||||||
"lib/internal/constants.js",
|
|
||||||
"lib/internal/crypto/aes.js",
|
|
||||||
"lib/internal/crypto/certificate.js",
|
|
||||||
"lib/internal/crypto/cfrg.js",
|
|
||||||
"lib/internal/crypto/cipher.js",
|
|
||||||
"lib/internal/crypto/diffiehellman.js",
|
|
||||||
"lib/internal/crypto/ec.js",
|
|
||||||
"lib/internal/crypto/hash.js",
|
|
||||||
"lib/internal/crypto/hashnames.js",
|
|
||||||
"lib/internal/crypto/hkdf.js",
|
|
||||||
"lib/internal/crypto/keygen.js",
|
|
||||||
"lib/internal/crypto/keys.js",
|
|
||||||
"lib/internal/crypto/mac.js",
|
|
||||||
"lib/internal/crypto/pbkdf2.js",
|
|
||||||
"lib/internal/crypto/random.js",
|
|
||||||
"lib/internal/crypto/rsa.js",
|
|
||||||
"lib/internal/crypto/scrypt.js",
|
|
||||||
"lib/internal/crypto/sig.js",
|
|
||||||
"lib/internal/crypto/util.js",
|
|
||||||
"lib/internal/crypto/webcrypto.js",
|
|
||||||
"lib/internal/crypto/x509.js",
|
|
||||||
"lib/internal/debugger/inspect.js",
|
|
||||||
"lib/internal/debugger/inspect_client.js",
|
|
||||||
"lib/internal/debugger/inspect_repl.js",
|
|
||||||
"lib/internal/dgram.js",
|
|
||||||
"lib/internal/dns/callback_resolver.js",
|
|
||||||
"lib/internal/dns/promises.js",
|
|
||||||
"lib/internal/dns/utils.js",
|
|
||||||
"lib/internal/dtrace.js",
|
|
||||||
"lib/internal/encoding.js",
|
|
||||||
"lib/internal/error_serdes.js",
|
|
||||||
"lib/internal/errors.js",
|
|
||||||
"lib/internal/event_target.js",
|
|
||||||
"lib/internal/fixed_queue.js",
|
|
||||||
"lib/internal/freelist.js",
|
|
||||||
"lib/internal/freeze_intrinsics.js",
|
|
||||||
"lib/internal/fs/cp/cp-sync.js",
|
|
||||||
"lib/internal/fs/cp/cp.js",
|
|
||||||
"lib/internal/fs/dir.js",
|
|
||||||
"lib/internal/fs/promises.js",
|
|
||||||
"lib/internal/fs/read_file_context.js",
|
|
||||||
"lib/internal/fs/rimraf.js",
|
|
||||||
"lib/internal/fs/streams.js",
|
|
||||||
"lib/internal/fs/sync_write_stream.js",
|
|
||||||
"lib/internal/fs/utils.js",
|
|
||||||
"lib/internal/fs/watchers.js",
|
|
||||||
"lib/internal/heap_utils.js",
|
|
||||||
"lib/internal/histogram.js",
|
|
||||||
"lib/internal/http.js",
|
|
||||||
"lib/internal/http2/compat.js",
|
|
||||||
"lib/internal/http2/core.js",
|
|
||||||
"lib/internal/http2/util.js",
|
|
||||||
"lib/internal/idna.js",
|
|
||||||
"lib/internal/inspector_async_hook.js",
|
|
||||||
"lib/internal/js_stream_socket.js",
|
|
||||||
"lib/internal/legacy/processbinding.js",
|
|
||||||
"lib/internal/linkedlist.js",
|
|
||||||
"lib/internal/main/check_syntax.js",
|
|
||||||
"lib/internal/main/environment.js",
|
|
||||||
"lib/internal/main/eval_stdin.js",
|
|
||||||
"lib/internal/main/eval_string.js",
|
|
||||||
"lib/internal/main/inspect.js",
|
|
||||||
"lib/internal/main/mksnapshot.js",
|
|
||||||
"lib/internal/main/print_help.js",
|
|
||||||
"lib/internal/main/prof_process.js",
|
|
||||||
"lib/internal/main/repl.js",
|
|
||||||
"lib/internal/main/run_main_module.js",
|
|
||||||
"lib/internal/main/test_runner.js",
|
|
||||||
"lib/internal/main/watch_mode.js",
|
|
||||||
"lib/internal/main/worker_thread.js",
|
|
||||||
"lib/internal/modules/cjs/helpers.js",
|
|
||||||
"lib/internal/modules/cjs/loader.js",
|
|
||||||
"lib/internal/modules/esm/assert.js",
|
|
||||||
"lib/internal/modules/esm/create_dynamic_module.js",
|
|
||||||
"lib/internal/modules/esm/fetch_module.js",
|
|
||||||
"lib/internal/modules/esm/formats.js",
|
|
||||||
"lib/internal/modules/esm/get_format.js",
|
|
||||||
"lib/internal/modules/esm/handle_process_exit.js",
|
|
||||||
"lib/internal/modules/esm/initialize_import_meta.js",
|
|
||||||
"lib/internal/modules/esm/load.js",
|
|
||||||
"lib/internal/modules/esm/loader.js",
|
|
||||||
"lib/internal/modules/esm/module_job.js",
|
|
||||||
"lib/internal/modules/esm/module_map.js",
|
|
||||||
"lib/internal/modules/esm/package_config.js",
|
|
||||||
"lib/internal/modules/esm/resolve.js",
|
|
||||||
"lib/internal/modules/esm/translators.js",
|
|
||||||
"lib/internal/modules/package_json_reader.js",
|
|
||||||
"lib/internal/modules/run_main.js",
|
|
||||||
"lib/internal/net.js",
|
|
||||||
"lib/internal/options.js",
|
|
||||||
"lib/internal/per_context/domexception.js",
|
|
||||||
"lib/internal/per_context/messageport.js",
|
|
||||||
"lib/internal/per_context/primordials.js",
|
|
||||||
"lib/internal/perf/event_loop_delay.js",
|
|
||||||
"lib/internal/perf/event_loop_utilization.js",
|
|
||||||
"lib/internal/perf/nodetiming.js",
|
|
||||||
"lib/internal/perf/observe.js",
|
|
||||||
"lib/internal/perf/performance.js",
|
|
||||||
"lib/internal/perf/performance_entry.js",
|
|
||||||
"lib/internal/perf/resource_timing.js",
|
|
||||||
"lib/internal/perf/timerify.js",
|
|
||||||
"lib/internal/perf/usertiming.js",
|
|
||||||
"lib/internal/perf/utils.js",
|
|
||||||
"lib/internal/policy/manifest.js",
|
|
||||||
"lib/internal/policy/sri.js",
|
|
||||||
"lib/internal/priority_queue.js",
|
|
||||||
"lib/internal/process/esm_loader.js",
|
|
||||||
"lib/internal/process/execution.js",
|
|
||||||
"lib/internal/process/per_thread.js",
|
|
||||||
"lib/internal/process/policy.js",
|
|
||||||
"lib/internal/process/pre_execution.js",
|
|
||||||
"lib/internal/process/promises.js",
|
|
||||||
"lib/internal/process/report.js",
|
|
||||||
"lib/internal/process/signal.js",
|
|
||||||
"lib/internal/process/task_queues.js",
|
|
||||||
"lib/internal/process/warning.js",
|
|
||||||
"lib/internal/process/worker_thread_only.js",
|
|
||||||
"lib/internal/promise_hooks.js",
|
|
||||||
"lib/internal/querystring.js",
|
|
||||||
"lib/internal/readline/callbacks.js",
|
|
||||||
"lib/internal/readline/emitKeypressEvents.js",
|
|
||||||
"lib/internal/readline/interface.js",
|
|
||||||
"lib/internal/readline/promises.js",
|
|
||||||
"lib/internal/readline/utils.js",
|
|
||||||
"lib/internal/repl.js",
|
|
||||||
"lib/internal/repl/await.js",
|
|
||||||
"lib/internal/repl/history.js",
|
|
||||||
"lib/internal/repl/utils.js",
|
|
||||||
"lib/internal/socket_list.js",
|
|
||||||
"lib/internal/socketaddress.js",
|
|
||||||
"lib/internal/source_map/prepare_stack_trace.js",
|
|
||||||
"lib/internal/source_map/source_map.js",
|
|
||||||
"lib/internal/source_map/source_map_cache.js",
|
|
||||||
"lib/internal/stream_base_commons.js",
|
|
||||||
"lib/internal/streams/add-abort-signal.js",
|
|
||||||
"lib/internal/streams/buffer_list.js",
|
|
||||||
"lib/internal/streams/compose.js",
|
|
||||||
"lib/internal/streams/destroy.js",
|
|
||||||
"lib/internal/streams/duplex.js",
|
|
||||||
"lib/internal/streams/duplexify.js",
|
|
||||||
"lib/internal/streams/end-of-stream.js",
|
|
||||||
"lib/internal/streams/from.js",
|
|
||||||
"lib/internal/streams/lazy_transform.js",
|
|
||||||
"lib/internal/streams/legacy.js",
|
|
||||||
"lib/internal/streams/operators.js",
|
|
||||||
"lib/internal/streams/passthrough.js",
|
|
||||||
"lib/internal/streams/pipeline.js",
|
|
||||||
"lib/internal/streams/readable.js",
|
|
||||||
"lib/internal/streams/state.js",
|
|
||||||
"lib/internal/streams/transform.js",
|
|
||||||
"lib/internal/streams/utils.js",
|
|
||||||
"lib/internal/streams/writable.js",
|
|
||||||
"lib/internal/structured_clone.js",
|
|
||||||
"lib/internal/test/binding.js",
|
|
||||||
"lib/internal/test/transfer.js",
|
|
||||||
"lib/internal/test_runner/harness.js",
|
|
||||||
"lib/internal/test_runner/runner.js",
|
|
||||||
"lib/internal/test_runner/tap_stream.js",
|
|
||||||
"lib/internal/test_runner/test.js",
|
|
||||||
"lib/internal/test_runner/utils.js",
|
|
||||||
"lib/internal/timers.js",
|
|
||||||
"lib/internal/tls/secure-context.js",
|
|
||||||
"lib/internal/tls/secure-pair.js",
|
|
||||||
"lib/internal/trace_events_async_hooks.js",
|
|
||||||
"lib/internal/tty.js",
|
|
||||||
"lib/internal/url.js",
|
|
||||||
"lib/internal/util.js",
|
|
||||||
"lib/internal/util/colors.js",
|
|
||||||
"lib/internal/util/comparisons.js",
|
|
||||||
"lib/internal/util/debuglog.js",
|
|
||||||
"lib/internal/util/inspect.js",
|
|
||||||
"lib/internal/util/inspector.js",
|
|
||||||
"lib/internal/util/iterable_weak_map.js",
|
|
||||||
"lib/internal/util/parse_args/parse_args.js",
|
|
||||||
"lib/internal/util/parse_args/utils.js",
|
|
||||||
"lib/internal/util/types.js",
|
|
||||||
"lib/internal/v8/startup_snapshot.js",
|
|
||||||
"lib/internal/v8_prof_polyfill.js",
|
|
||||||
"lib/internal/v8_prof_processor.js",
|
|
||||||
"lib/internal/validators.js",
|
|
||||||
"lib/internal/vm/module.js",
|
|
||||||
"lib/internal/wasm_web_api.js",
|
|
||||||
"lib/internal/watch_mode/files_watcher.js",
|
|
||||||
"lib/internal/watchdog.js",
|
|
||||||
"lib/internal/webstreams/adapters.js",
|
|
||||||
"lib/internal/webstreams/compression.js",
|
|
||||||
"lib/internal/webstreams/encoding.js",
|
|
||||||
"lib/internal/webstreams/queuingstrategies.js",
|
|
||||||
"lib/internal/webstreams/readablestream.js",
|
|
||||||
"lib/internal/webstreams/transfer.js",
|
|
||||||
"lib/internal/webstreams/transformstream.js",
|
|
||||||
"lib/internal/webstreams/util.js",
|
|
||||||
"lib/internal/webstreams/writablestream.js",
|
|
||||||
"lib/internal/worker.js",
|
|
||||||
"lib/internal/worker/io.js",
|
|
||||||
"lib/internal/worker/js_transferable.js",
|
|
||||||
"lib/module.js",
|
|
||||||
"lib/net.js",
|
|
||||||
"lib/os.js",
|
|
||||||
"lib/path.js",
|
|
||||||
"lib/path/posix.js",
|
|
||||||
"lib/path/win32.js",
|
|
||||||
"lib/perf_hooks.js",
|
|
||||||
"lib/process.js",
|
|
||||||
"lib/punycode.js",
|
|
||||||
"lib/querystring.js",
|
|
||||||
"lib/readline.js",
|
|
||||||
"lib/readline/promises.js",
|
|
||||||
"lib/repl.js",
|
|
||||||
"lib/stream.js",
|
|
||||||
"lib/stream/consumers.js",
|
|
||||||
"lib/stream/promises.js",
|
|
||||||
"lib/stream/web.js",
|
|
||||||
"lib/string_decoder.js",
|
|
||||||
"lib/sys.js",
|
|
||||||
"lib/test.js",
|
|
||||||
"lib/timers.js",
|
|
||||||
"lib/timers/promises.js",
|
|
||||||
"lib/tls.js",
|
|
||||||
"lib/trace_events.js",
|
|
||||||
"lib/tty.js",
|
|
||||||
"lib/url.js",
|
|
||||||
"lib/util.js",
|
|
||||||
"lib/util/types.js",
|
|
||||||
"lib/v8.js",
|
|
||||||
"lib/vm.js",
|
|
||||||
"lib/wasi.js",
|
|
||||||
"lib/worker_threads.js",
|
|
||||||
"lib/zlib.js"
|
|
||||||
],
|
|
||||||
"node_module_version": 108,
|
|
||||||
"node_no_browser_globals": "false",
|
|
||||||
"node_prefix": "/usr/local",
|
|
||||||
"node_release_urlbase": "https://nodejs.org/download/release/",
|
|
||||||
"node_shared": "false",
|
|
||||||
"node_shared_brotli": "false",
|
|
||||||
"node_shared_cares": "false",
|
|
||||||
"node_shared_http_parser": "false",
|
|
||||||
"node_shared_libuv": "false",
|
|
||||||
"node_shared_nghttp2": "false",
|
|
||||||
"node_shared_nghttp3": "false",
|
|
||||||
"node_shared_ngtcp2": "false",
|
|
||||||
"node_shared_openssl": "false",
|
|
||||||
"node_shared_zlib": "false",
|
|
||||||
"node_tag": "",
|
|
||||||
"node_target_type": "executable",
|
|
||||||
"node_use_bundled_v8": "true",
|
|
||||||
"node_use_dtrace": "false",
|
|
||||||
"node_use_etw": "true",
|
|
||||||
"node_use_node_code_cache": "true",
|
|
||||||
"node_use_node_snapshot": "true",
|
|
||||||
"node_use_openssl": "true",
|
|
||||||
"node_use_v8_platform": "true",
|
|
||||||
"node_with_ltcg": "true",
|
|
||||||
"node_without_node_options": "false",
|
|
||||||
"openssl_is_fips": "false",
|
|
||||||
"openssl_quic": "true",
|
|
||||||
"ossfuzz": "false",
|
|
||||||
"shlib_suffix": "so.108",
|
|
||||||
"target_arch": "x64",
|
|
||||||
"v8_enable_31bit_smis_on_64bit_arch": 0,
|
|
||||||
"v8_enable_gdbjit": 0,
|
|
||||||
"v8_enable_hugepage": 0,
|
|
||||||
"v8_enable_i18n_support": 1,
|
|
||||||
"v8_enable_inspector": 1,
|
|
||||||
"v8_enable_javascript_promise_hooks": 1,
|
|
||||||
"v8_enable_lite_mode": 0,
|
|
||||||
"v8_enable_object_print": 1,
|
|
||||||
"v8_enable_pointer_compression": 0,
|
|
||||||
"v8_enable_shared_ro_heap": 1,
|
|
||||||
"v8_enable_short_builtin_calls": 1,
|
|
||||||
"v8_enable_webassembly": 1,
|
|
||||||
"v8_no_strict_aliasing": 1,
|
|
||||||
"v8_optimized_debug": 1,
|
|
||||||
"v8_promise_internal_field_count": 1,
|
|
||||||
"v8_random_seed": 0,
|
|
||||||
"v8_trace_maps": 0,
|
|
||||||
"v8_use_siphash": 1,
|
|
||||||
"want_separate_host_toolset": 0,
|
|
||||||
"nodedir": "C:\\Users\\Luis\\AppData\\Local\\node-gyp\\Cache\\18.12.1",
|
|
||||||
"standalone_static_library": 1,
|
|
||||||
"msbuild_path": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\MSBuild.exe",
|
|
||||||
"cache": "C:\\Users\\Luis\\AppData\\Local\\npm-cache",
|
|
||||||
"globalconfig": "C:\\Program Files\\nodejs\\etc\\npmrc",
|
|
||||||
"global_prefix": "C:\\Program Files\\nodejs",
|
|
||||||
"init_module": "C:\\Users\\Luis\\.npm-init.js",
|
|
||||||
"local_prefix": "C:\\_projects\\addon-tools-raub",
|
|
||||||
"metrics_registry": "https://registry.npmjs.org/",
|
|
||||||
"node_gyp": "C:\\Users\\Luis\\AppData\\Roaming\\nvm\\v18.12.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js",
|
|
||||||
"prefix": "C:\\Program Files\\nodejs",
|
|
||||||
"userconfig": "C:\\Users\\Luis\\.npmrc",
|
|
||||||
"user_agent": "npm/8.19.2 node/v18.12.1 win32 x64 workspaces/false"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{027E2789-D2D0-762D-B6D2-3AA4C73B3DD7}</ProjectGuid>
|
|
||||||
<Keyword>Win32Proj</Keyword>
|
|
||||||
<RootNamespace>test</RootNamespace>
|
|
||||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
|
||||||
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
|
|
||||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
|
||||||
<PropertyGroup Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Locals">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
|
|
||||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props"/>
|
|
||||||
<ImportGroup Label="ExtensionSettings"/>
|
|
||||||
<ImportGroup Label="PropertySheets">
|
|
||||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros"/>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\bin\;$(MSBuildProjectDirectory)\..\bin\</ExecutablePath>
|
|
||||||
<IgnoreImportLibrary>true</IgnoreImportLibrary>
|
|
||||||
<IntDir>$(Configuration)\obj\$(ProjectName)\</IntDir>
|
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
|
||||||
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
|
|
||||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.node</TargetExt>
|
|
||||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.node</TargetExt>
|
|
||||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.node</TargetExt>
|
|
||||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.node</TargetExt>
|
|
||||||
<TargetName>$(ProjectName)</TargetName>
|
|
||||||
<TargetPath>$(OutDir)\$(ProjectName).node</TargetPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<AdditionalIncludeDirectories>C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\include\node;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\src;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\config;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\openssl\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\uv\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\zlib;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\v8\include;..\..\node_modules\node-addon-api;C:\_projects\addon-tools-raub\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<AdditionalOptions>/Zc:__cplusplus -std:c++17 /O2 /Oy /GL /GF /Gm- /std:c++17 /EHa-s-c- /MT /GS /Gy /GR- /Gd %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
|
||||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
|
||||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
|
||||||
<DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
||||||
<ExceptionHandling>false</ExceptionHandling>
|
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
|
||||||
<OmitFramePointers>false</OmitFramePointers>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
||||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
|
||||||
<StringPooling>true</StringPooling>
|
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
||||||
<TreatWarningAsError>false</TreatWarningAsError>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
</ClCompile>
|
|
||||||
<Lib>
|
|
||||||
<AdditionalOptions>/LTCG:INCREMENTAL %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
</Lib>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;"C:\\Users\\Luis\\AppData\\Local\\node-gyp\\Cache\\18.12.1\\x64\\node.lib"</AdditionalDependencies>
|
|
||||||
<AdditionalOptions>/LTCG:INCREMENTAL /DEBUG:NONE /LTCG /OPT:NOREF /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<OutputFile>$(OutDir)$(ProjectName).node</OutputFile>
|
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
||||||
<TargetExt>.node</TargetExt>
|
|
||||||
<TargetMachine>MachineX64</TargetMachine>
|
|
||||||
</Link>
|
|
||||||
<ResourceCompile>
|
|
||||||
<AdditionalIncludeDirectories>C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\include\node;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\src;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\config;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\openssl\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\uv\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\zlib;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\v8\include;..\..\node_modules\node-addon-api;C:\_projects\addon-tools-raub\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ResourceCompile>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<AdditionalIncludeDirectories>C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\include\node;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\src;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\config;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\openssl\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\uv\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\zlib;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\v8\include;..\..\node_modules\node-addon-api;C:\_projects\addon-tools-raub\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<AdditionalOptions>/Zc:__cplusplus -std:c++17 /O2 /Oy /GL /GF /Gm- /std:c++17 /EHa-s-c- /MT /GS /Gy /GR- /Gd %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
|
||||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
|
||||||
<DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
||||||
<ExceptionHandling>false</ExceptionHandling>
|
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
|
||||||
<OmitFramePointers>true</OmitFramePointers>
|
|
||||||
<Optimization>Full</Optimization>
|
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
||||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
|
||||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
|
||||||
<StringPooling>true</StringPooling>
|
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
||||||
<TreatWarningAsError>false</TreatWarningAsError>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
</ClCompile>
|
|
||||||
<Lib>
|
|
||||||
<AdditionalOptions>/LTCG:INCREMENTAL %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
</Lib>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;"C:\\Users\\Luis\\AppData\\Local\\node-gyp\\Cache\\18.12.1\\x64\\node.lib"</AdditionalDependencies>
|
|
||||||
<AdditionalOptions>/LTCG:INCREMENTAL /DEBUG:NONE /LTCG /OPT:NOREF /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<OutputFile>$(OutDir)$(ProjectName).node</OutputFile>
|
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
||||||
<TargetExt>.node</TargetExt>
|
|
||||||
<TargetMachine>MachineX64</TargetMachine>
|
|
||||||
</Link>
|
|
||||||
<ResourceCompile>
|
|
||||||
<AdditionalIncludeDirectories>C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\include\node;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\src;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\config;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\openssl\openssl\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\uv\include;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\zlib;C:\Users\Luis\AppData\Local\node-gyp\Cache\18.12.1\deps\v8\include;..\..\node_modules\node-addon-api;C:\_projects\addon-tools-raub\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<PreprocessorDefinitions>NODE_GYP_MODULE_NAME=test;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;_GLIBCXX_USE_CXX11_ABI=1;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;_WIN32;BUILDING_NODE_EXTENSION;HOST_BINARY="node.exe";%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ResourceCompile>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\binding.gyp"/>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\test.cpp">
|
|
||||||
<ObjectFileName>$(IntDir)\test.obj</ObjectFileName>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="C:\Users\Luis\AppData\Roaming\nvm\v18.12.1\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc"/>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
|
||||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets"/>
|
|
||||||
<ImportGroup Label="ExtensionTargets"/>
|
|
||||||
</Project>
|
|
|
@ -1,58 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="..">
|
|
||||||
<UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:">
|
|
||||||
<UniqueIdentifier>{7B735499-E5DD-1C2B-6C26-70023832A1CF}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users">
|
|
||||||
<UniqueIdentifier>{E9F714C1-DA89-54E2-60CF-39FEB20BF756}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users\Luis">
|
|
||||||
<UniqueIdentifier>{5215B9C8-08C9-9B12-A4BC-6B55FF1672C0}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users\Luis\AppData">
|
|
||||||
<UniqueIdentifier>{F852EB63-437C-846A-220F-8D9ED6DAEC1D}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users\Luis\AppData\Roaming">
|
|
||||||
<UniqueIdentifier>{D51E5808-912B-5C70-4BB7-475D1DBFA067}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users\Luis\AppData\Roaming\nvm">
|
|
||||||
<UniqueIdentifier>{1B85D12A-9F9C-E0A8-F82E-74864675B527}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users\Luis\AppData\Roaming\nvm\v18.12.1">
|
|
||||||
<UniqueIdentifier>{68329104-0883-3C95-6BC9-C46F7BFC39D9}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users\Luis\AppData\Roaming\nvm\v18.12.1\node_modules">
|
|
||||||
<UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users\Luis\AppData\Roaming\nvm\v18.12.1\node_modules\npm">
|
|
||||||
<UniqueIdentifier>{741E0E76-39B2-B1AB-9FA1-F1A20B16F295}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users\Luis\AppData\Roaming\nvm\v18.12.1\node_modules\npm\node_modules">
|
|
||||||
<UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users\Luis\AppData\Roaming\nvm\v18.12.1\node_modules\npm\node_modules\node-gyp">
|
|
||||||
<UniqueIdentifier>{77348C0E-2034-7791-74D5-63C077DF5A3B}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="C:\Users\Luis\AppData\Roaming\nvm\v18.12.1\node_modules\npm\node_modules\node-gyp\src">
|
|
||||||
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="..">
|
|
||||||
<UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\test.cpp">
|
|
||||||
<Filter>..</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="C:\Users\Luis\AppData\Roaming\nvm\v18.12.1\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc">
|
|
||||||
<Filter>C:\Users\Luis\AppData\Roaming\nvm\v18.12.1\node_modules\npm\node_modules\node-gyp\src</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<None Include="..\binding.gyp">
|
|
||||||
<Filter>..</Filter>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
|
@ -1,42 +1,45 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const arrayArgMsg = 'Argument 0 must be of type `Array`';
|
const arrayArgLetMsg = { message: 'Argument 0 must be of type `Array` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / LET_ARRAY_ARG', () => {
|
describe('AT / HPP / LET_ARRAY_ARG', () => {
|
||||||
it('exports letArrayStrArg', () => {
|
it('exports letArrayStrArg', () => {
|
||||||
expect(typeof test.letArrayStrArg).toBe('function');
|
assert.strictEqual(typeof test.letArrayStrArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.letArrayStrArg('1')).toThrow(arrayArgMsg);
|
assert.throws(() => test.letArrayStrArg('1'), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.letArrayStrArg(1)).toThrow(arrayArgMsg);
|
assert.throws(() => test.letArrayStrArg(1), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.letArrayStrArg(true)).toThrow(arrayArgMsg);
|
assert.throws(() => test.letArrayStrArg(true), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.letArrayStrArg(test.retExt())).toThrow(arrayArgMsg);
|
assert.throws(() => test.letArrayStrArg(test.retExt()), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.letArrayStrArg({})).toThrow(arrayArgMsg);
|
assert.throws(() => test.letArrayStrArg({}), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(Array.isArray(test.letArrayStrArg())).toBe(true);
|
assert.ok(Array.isArray(test.letArrayStrArg()));
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(Array.isArray(test.letArrayStrArg(undefined))).toBe(true);
|
assert.ok(Array.isArray(test.letArrayStrArg(undefined)));
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(Array.isArray(test.letArrayStrArg(null))).toBe(true);
|
assert.ok(Array.isArray(test.letArrayStrArg(null)));
|
||||||
});
|
});
|
||||||
it('accepts an array', () => {
|
it('accepts an array', () => {
|
||||||
expect(Array.isArray(test.letArrayStrArg([]))).toBe(true);
|
assert.ok(Array.isArray(test.letArrayStrArg([])));
|
||||||
});
|
});
|
||||||
it('returns same array', () => {
|
it('returns same array', () => {
|
||||||
expect(test.letArrayStrArg(['a', 'b'])).toEqual(['a', 'b']);
|
assert.deepStrictEqual(test.letArrayStrArg(['a', 'b']),['a', 'b']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,105 +1,109 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const arrayArgMsg = 'Argument 0 must be of type `Array`';
|
const arrayArgMsg = { message: 'Argument 0 must be of type `Array`' };
|
||||||
|
const arrayArgLetMsg = { message: 'Argument 0 must be of type `Array` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / REQ_ARRAY_ARG', () => {
|
describe('AT / HPP / REQ_ARRAY_ARG', () => {
|
||||||
it('exports reqArrayArg', () => {
|
it('exports reqArrayArg', () => {
|
||||||
expect(typeof test.reqArrayArg).toBe('function');
|
assert.strictEqual(typeof test.reqArrayArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqArrayArg()).toThrow(arrayArgMsg);
|
assert.throws(() => test.reqArrayArg(), arrayArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqArrayArg(undefined)).toThrow(arrayArgMsg);
|
assert.throws(() => test.reqArrayArg(undefined), arrayArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqArrayArg(null)).toThrow(arrayArgMsg);
|
assert.throws(() => test.reqArrayArg(null), arrayArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqArrayArg('1')).toThrow(arrayArgMsg);
|
assert.throws(() => test.reqArrayArg('1'), arrayArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.reqArrayArg(1)).toThrow(arrayArgMsg);
|
assert.throws(() => test.reqArrayArg(1), arrayArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqArrayArg(true)).toThrow(arrayArgMsg);
|
assert.throws(() => test.reqArrayArg(true), arrayArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.reqArrayArg(test.retExt())).toThrow(arrayArgMsg);
|
assert.throws(() => test.reqArrayArg(test.retExt()), arrayArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqArrayArg({})).toThrow(arrayArgMsg);
|
assert.throws(() => test.reqArrayArg({}), arrayArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts an array', () => {
|
it('accepts an array', () => {
|
||||||
expect(Array.isArray(test.reqArrayArg([]))).toBe(true);
|
assert.ok(Array.isArray(test.reqArrayArg([])));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: LET_ARRAY_ARG', () => {
|
describe('addon-tools.hpp: LET_ARRAY_ARG', () => {
|
||||||
it('exports letArrayArg', () => {
|
it('exports letArrayArg', () => {
|
||||||
expect(typeof test.letArrayArg).toBe('function');
|
assert.strictEqual(typeof test.letArrayArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.letArrayArg('1')).toThrow(arrayArgMsg);
|
assert.throws(() => test.letArrayArg('1'), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.letArrayArg(1)).toThrow(arrayArgMsg);
|
assert.throws(() => test.letArrayArg(1), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.letArrayArg(true)).toThrow(arrayArgMsg);
|
assert.throws(() => test.letArrayArg(true), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.letArrayArg(test.retExt())).toThrow(arrayArgMsg);
|
assert.throws(() => test.letArrayArg(test.retExt()), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.letArrayArg({})).toThrow(arrayArgMsg);
|
assert.throws(() => test.letArrayArg({}), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(Array.isArray(test.letArrayArg())).toBe(true);
|
assert.ok(Array.isArray(test.letArrayArg()));
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(Array.isArray(test.letArrayArg(undefined))).toBe(true);
|
assert.ok(Array.isArray(test.letArrayArg(undefined)));
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(Array.isArray(test.letArrayArg(null))).toBe(true);
|
assert.ok(Array.isArray(test.letArrayArg(null)));
|
||||||
});
|
});
|
||||||
it('accepts an array', () => {
|
it('accepts an array', () => {
|
||||||
expect(Array.isArray(test.letArrayArg([]))).toBe(true);
|
assert.ok(Array.isArray(test.letArrayArg([])));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: USE_ARRAY_ARG', () => {
|
describe('addon-tools.hpp: USE_ARRAY_ARG', () => {
|
||||||
it('exports useArrayArg', () => {
|
it('exports useArrayArg', () => {
|
||||||
expect(typeof test.useArrayArg).toBe('function');
|
assert.strictEqual(typeof test.useArrayArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.useArrayArg('1')).toThrow(arrayArgMsg);
|
assert.throws(() => test.useArrayArg('1'), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.useArrayArg(1)).toThrow(arrayArgMsg);
|
assert.throws(() => test.useArrayArg(1), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.useArrayArg(true)).toThrow(arrayArgMsg);
|
assert.throws(() => test.useArrayArg(true), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.useArrayArg(test.retExt())).toThrow(arrayArgMsg);
|
assert.throws(() => test.useArrayArg(test.retExt()), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.useArrayArg({})).toThrow(arrayArgMsg);
|
assert.throws(() => test.useArrayArg({}), arrayArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(Array.isArray(test.useArrayArg())).toBe(true);
|
assert.ok(Array.isArray(test.useArrayArg()));
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(Array.isArray(test.useArrayArg(undefined))).toBe(true);
|
assert.ok(Array.isArray(test.useArrayArg(undefined)));
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(Array.isArray(test.useArrayArg(null))).toBe(true);
|
assert.ok(Array.isArray(test.useArrayArg(null)));
|
||||||
});
|
});
|
||||||
it('accepts an array', () => {
|
it('accepts an array', () => {
|
||||||
expect(Array.isArray(test.useArrayArg([]))).toBe(true);
|
assert.ok(Array.isArray(test.useArrayArg([])));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,96 +1,100 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const boolArgMsg = 'Argument 0 must be of type `Bool`';
|
const boolArgMsg = { message: 'Argument 0 must be of type `Bool`' };
|
||||||
|
const boolArgLetMsg = { message: 'Argument 0 must be of type `Bool` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / REQ_BOOL_ARG', () => {
|
describe('AT / HPP / REQ_BOOL_ARG', () => {
|
||||||
it('exports reqBoolArg', () => {
|
it('exports reqBoolArg', () => {
|
||||||
expect(typeof test.reqBoolArg).toBe('function');
|
assert.strictEqual(typeof test.reqBoolArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqBoolArg()).toThrow(boolArgMsg);
|
assert.throws(() => test.reqBoolArg(), boolArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqBoolArg(undefined)).toThrow(boolArgMsg);
|
assert.throws(() => test.reqBoolArg(undefined), boolArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqBoolArg(null)).toThrow(boolArgMsg);
|
assert.throws(() => test.reqBoolArg(null), boolArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqBoolArg('1')).toThrow(boolArgMsg);
|
assert.throws(() => test.reqBoolArg('1'), boolArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.reqBoolArg(1)).toThrow(boolArgMsg);
|
assert.throws(() => test.reqBoolArg(1), boolArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqBoolArg({})).toThrow(boolArgMsg);
|
assert.throws(() => test.reqBoolArg({}), boolArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqBoolArg([])).toThrow(boolArgMsg);
|
assert.throws(() => test.reqBoolArg([]), boolArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a boolean', () => {
|
it('accepts a boolean', () => {
|
||||||
expect(test.reqBoolArg(true)).toEqual(true);
|
assert.ok(test.reqBoolArg(true));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: LET_BOOL_ARG', () => {
|
describe('addon-tools.hpp: LET_BOOL_ARG', () => {
|
||||||
it('exports letBoolArg', () => {
|
it('exports letBoolArg', () => {
|
||||||
expect(typeof test.letBoolArg).toBe('function');
|
assert.strictEqual(typeof test.letBoolArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.letBoolArg('1')).toThrow(boolArgMsg);
|
assert.throws(() => test.letBoolArg('1'), boolArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.letBoolArg(1)).toThrow(boolArgMsg);
|
assert.throws(() => test.letBoolArg(1), boolArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.letBoolArg({})).toThrow(boolArgMsg);
|
assert.throws(() => test.letBoolArg({}), boolArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.letBoolArg([])).toThrow(boolArgMsg);
|
assert.throws(() => test.letBoolArg([]), boolArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.letBoolArg()).toEqual(false);
|
assert.strictEqual(test.letBoolArg(), false);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.letBoolArg(undefined)).toEqual(false);
|
assert.strictEqual(test.letBoolArg(undefined), false);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.letBoolArg(null)).toEqual(false);
|
assert.strictEqual(test.letBoolArg(null), false);
|
||||||
});
|
});
|
||||||
it('accepts a boolean', () => {
|
it('accepts a boolean', () => {
|
||||||
expect(test.letBoolArg(true)).toEqual(true);
|
assert.ok(test.letBoolArg(true));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: USE_BOOL_ARG', () => {
|
describe('addon-tools.hpp: USE_BOOL_ARG', () => {
|
||||||
it('exports useBoolArg', () => {
|
it('exports useBoolArg', () => {
|
||||||
expect(typeof test.useBoolArg).toBe('function');
|
assert.strictEqual(typeof test.useBoolArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.useBoolArg('1')).toThrow(boolArgMsg);
|
assert.throws(() => test.useBoolArg('1'), boolArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.useBoolArg(1)).toThrow(boolArgMsg);
|
assert.throws(() => test.useBoolArg(1), boolArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.useBoolArg({})).toThrow(boolArgMsg);
|
assert.throws(() => test.useBoolArg({}), boolArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.useBoolArg([])).toThrow(boolArgMsg);
|
assert.throws(() => test.useBoolArg([]), boolArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.useBoolArg()).toEqual(true);
|
assert.ok(test.useBoolArg());
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.useBoolArg(undefined)).toEqual(true);
|
assert.ok(test.useBoolArg(undefined));
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.useBoolArg(null)).toEqual(true);
|
assert.ok(test.useBoolArg(null));
|
||||||
});
|
});
|
||||||
it('accepts a boolean', () => {
|
it('accepts a boolean', () => {
|
||||||
expect(test.useBoolArg(true)).toEqual(true);
|
assert.ok(test.useBoolArg(true));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,96 +1,100 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const numArgMsg = 'Argument 0 must be of type `Number`';
|
const numArgMsg = { message: 'Argument 0 must be of type `Number`' };
|
||||||
|
const numArgLetMsg = { message: 'Argument 0 must be of type `Number` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / REQ_DOUBLE_ARG', () => {
|
describe('AT / HPP / REQ_DOUBLE_ARG', () => {
|
||||||
it('exports reqDoubleArg', () => {
|
it('exports reqDoubleArg', () => {
|
||||||
expect(typeof test.reqDoubleArg).toBe('function');
|
assert.strictEqual(typeof test.reqDoubleArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqDoubleArg()).toThrow(numArgMsg);
|
assert.throws(() => test.reqDoubleArg(), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqDoubleArg(undefined)).toThrow(numArgMsg);
|
assert.throws(() => test.reqDoubleArg(undefined), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqDoubleArg(null)).toThrow(numArgMsg);
|
assert.throws(() => test.reqDoubleArg(null), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqDoubleArg('1')).toThrow(numArgMsg);
|
assert.throws(() => test.reqDoubleArg('1'), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqDoubleArg(true)).toThrow(numArgMsg);
|
assert.throws(() => test.reqDoubleArg(true), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqDoubleArg({})).toThrow(numArgMsg);
|
assert.throws(() => test.reqDoubleArg({}), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqDoubleArg([])).toThrow(numArgMsg);
|
assert.throws(() => test.reqDoubleArg([]), numArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.reqDoubleArg(55)).toEqual(55);
|
assert.strictEqual(test.reqDoubleArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: LET_DOUBLE_ARG', () => {
|
describe('addon-tools.hpp: LET_DOUBLE_ARG', () => {
|
||||||
it('exports letDoubleArg', () => {
|
it('exports letDoubleArg', () => {
|
||||||
expect(typeof test.letDoubleArg).toBe('function');
|
assert.strictEqual(typeof test.letDoubleArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.letDoubleArg('1')).toThrow(numArgMsg);
|
assert.throws(() => test.letDoubleArg('1'), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.letDoubleArg(true)).toThrow(numArgMsg);
|
assert.throws(() => test.letDoubleArg(true), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.letDoubleArg({})).toThrow(numArgMsg);
|
assert.throws(() => test.letDoubleArg({}), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.letDoubleArg([])).toThrow(numArgMsg);
|
assert.throws(() => test.letDoubleArg([]), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.letDoubleArg()).toEqual(0);
|
assert.strictEqual(test.letDoubleArg(), 0);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.letDoubleArg(undefined)).toEqual(0);
|
assert.strictEqual(test.letDoubleArg(undefined), 0);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.letDoubleArg(null)).toEqual(0);
|
assert.strictEqual(test.letDoubleArg(null), 0);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.letDoubleArg(55)).toEqual(55);
|
assert.strictEqual(test.letDoubleArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: USE_DOUBLE_ARG', () => {
|
describe('addon-tools.hpp: USE_DOUBLE_ARG', () => {
|
||||||
it('exports useDoubleArg', () => {
|
it('exports useDoubleArg', () => {
|
||||||
expect(typeof test.useDoubleArg).toBe('function');
|
assert.strictEqual(typeof test.useDoubleArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.useDoubleArg('1')).toThrow(numArgMsg);
|
assert.throws(() => test.useDoubleArg('1'), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.useDoubleArg(true)).toThrow(numArgMsg);
|
assert.throws(() => test.useDoubleArg(true), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.useDoubleArg({})).toThrow(numArgMsg);
|
assert.throws(() => test.useDoubleArg({}), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.useDoubleArg([])).toThrow(numArgMsg);
|
assert.throws(() => test.useDoubleArg([]), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.useDoubleArg()).toEqual(10);
|
assert.strictEqual(test.useDoubleArg(), 10);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.useDoubleArg(undefined)).toEqual(10);
|
assert.strictEqual(test.useDoubleArg(undefined), 10);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.useDoubleArg(null)).toEqual(10);
|
assert.strictEqual(test.useDoubleArg(null), 10);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.useDoubleArg(55)).toEqual(55);
|
assert.strictEqual(test.useDoubleArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,105 +1,109 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const extArgMsg = 'Argument 0 must be of type `Pointer`';
|
const extArgMsg = { message: 'Argument 0 must be of type `Pointer`' };
|
||||||
|
const extArgLetMsg = { message: 'Argument 0 must be of type `Pointer` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / REQ_EXT_ARG', () => {
|
describe('AT / HPP / REQ_EXT_ARG', () => {
|
||||||
it('exports reqExtArg', () => {
|
it('exports reqExtArg', () => {
|
||||||
expect(typeof test.reqExtArg).toBe('function');
|
assert.strictEqual(typeof test.reqExtArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqExtArg()).toThrow(extArgMsg);
|
assert.throws(() => test.reqExtArg(), extArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqExtArg(undefined)).toThrow(extArgMsg);
|
assert.throws(() => test.reqExtArg(undefined), extArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqExtArg(null)).toThrow(extArgMsg);
|
assert.throws(() => test.reqExtArg(null), extArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqExtArg('1')).toThrow(extArgMsg);
|
assert.throws(() => test.reqExtArg('1'), extArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.reqExtArg(1)).toThrow(extArgMsg);
|
assert.throws(() => test.reqExtArg(1), extArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqExtArg(true)).toThrow(extArgMsg);
|
assert.throws(() => test.reqExtArg(true), extArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqExtArg({})).toThrow(extArgMsg);
|
assert.throws(() => test.reqExtArg({}), extArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqExtArg([])).toThrow(extArgMsg);
|
assert.throws(() => test.reqExtArg([]), extArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a pointer', () => {
|
it('accepts a pointer', () => {
|
||||||
expect(typeof test.reqExtArg(test.retExt())).toBe('object');
|
assert.strictEqual(typeof test.reqExtArg(test.retExt()), 'object');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: LET_EXT_ARG', () => {
|
describe('addon-tools.hpp: LET_EXT_ARG', () => {
|
||||||
it('exports letExtArg', () => {
|
it('exports letExtArg', () => {
|
||||||
expect(typeof test.letExtArg).toBe('function');
|
assert.strictEqual(typeof test.letExtArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.letExtArg('1')).toThrow(extArgMsg);
|
assert.throws(() => test.letExtArg('1'), extArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.letExtArg(1)).toThrow(extArgMsg);
|
assert.throws(() => test.letExtArg(1), extArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.letExtArg(true)).toThrow(extArgMsg);
|
assert.throws(() => test.letExtArg(true), extArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.letExtArg({})).toThrow(extArgMsg);
|
assert.throws(() => test.letExtArg({}), extArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.letExtArg([])).toThrow(extArgMsg);
|
assert.throws(() => test.letExtArg([]), extArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(typeof test.letExtArg()).toBe('object');
|
assert.strictEqual(typeof test.letExtArg(), 'object');
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(typeof test.letExtArg(undefined)).toBe('object');
|
assert.strictEqual(typeof test.letExtArg(undefined), 'object');
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(typeof test.letExtArg(null)).toBe('object');
|
assert.strictEqual(typeof test.letExtArg(null), 'object');
|
||||||
});
|
});
|
||||||
it('accepts a pointer', () => {
|
it('accepts a pointer', () => {
|
||||||
expect(typeof test.reqExtArg(test.retExt())).toBe('object');
|
assert.strictEqual(typeof test.reqExtArg(test.retExt()), 'object');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: USE_EXT_ARG', () => {
|
describe('addon-tools.hpp: USE_EXT_ARG', () => {
|
||||||
it('exports useExtArg', () => {
|
it('exports useExtArg', () => {
|
||||||
expect(typeof test.useExtArg).toBe('function');
|
assert.strictEqual(typeof test.useExtArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.useExtArg('1')).toThrow(extArgMsg);
|
assert.throws(() => test.useExtArg('1'), extArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.useExtArg(1)).toThrow(extArgMsg);
|
assert.throws(() => test.useExtArg(1), extArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.useExtArg(true)).toThrow(extArgMsg);
|
assert.throws(() => test.useExtArg(true), extArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.useExtArg({})).toThrow(extArgMsg);
|
assert.throws(() => test.useExtArg({}), extArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.useExtArg([])).toThrow(extArgMsg);
|
assert.throws(() => test.useExtArg([]), extArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(typeof test.useExtArg()).toBe('object');
|
assert.strictEqual(typeof test.useExtArg(), 'object');
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(typeof test.useExtArg(undefined)).toBe('object');
|
assert.strictEqual(typeof test.useExtArg(undefined), 'object');
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(typeof test.useExtArg(null)).toBe('object');
|
assert.strictEqual(typeof test.useExtArg(null), 'object');
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(typeof test.useExtArg(test.retExt())).toBe('object');
|
assert.strictEqual(typeof test.useExtArg(test.retExt()), 'object');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,96 +1,100 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const numArgMsg = 'Argument 0 must be of type `Number`';
|
const numArgMsg = { message: 'Argument 0 must be of type `Number`' };
|
||||||
|
const numArgLetMsg = { message: 'Argument 0 must be of type `Number` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / REQ_FLOAT_ARG', () => {
|
describe('AT / HPP / REQ_FLOAT_ARG', () => {
|
||||||
it('exports reqFloatArg', () => {
|
it('exports reqFloatArg', () => {
|
||||||
expect(typeof test.reqFloatArg).toBe('function');
|
assert.strictEqual(typeof test.reqFloatArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqFloatArg()).toThrow(numArgMsg);
|
assert.throws(() => test.reqFloatArg(), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqFloatArg(undefined)).toThrow(numArgMsg);
|
assert.throws(() => test.reqFloatArg(undefined), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqFloatArg(null)).toThrow(numArgMsg);
|
assert.throws(() => test.reqFloatArg(null), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqFloatArg('1')).toThrow(numArgMsg);
|
assert.throws(() => test.reqFloatArg('1'), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqFloatArg(true)).toThrow(numArgMsg);
|
assert.throws(() => test.reqFloatArg(true), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqFloatArg({})).toThrow(numArgMsg);
|
assert.throws(() => test.reqFloatArg({}), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqFloatArg([])).toThrow(numArgMsg);
|
assert.throws(() => test.reqFloatArg([]), numArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.reqFloatArg(55)).toEqual(55);
|
assert.strictEqual(test.reqFloatArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: LET_FLOAT_ARG', () => {
|
describe('addon-tools.hpp: LET_FLOAT_ARG', () => {
|
||||||
it('exports letFloatArg', () => {
|
it('exports letFloatArg', () => {
|
||||||
expect(typeof test.letFloatArg).toBe('function');
|
assert.strictEqual(typeof test.letFloatArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.letFloatArg('1')).toThrow(numArgMsg);
|
assert.throws(() => test.letFloatArg('1'), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.letFloatArg(true)).toThrow(numArgMsg);
|
assert.throws(() => test.letFloatArg(true), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.letFloatArg({})).toThrow(numArgMsg);
|
assert.throws(() => test.letFloatArg({}), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.letFloatArg([])).toThrow(numArgMsg);
|
assert.throws(() => test.letFloatArg([]), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.letFloatArg()).toEqual(0);
|
assert.strictEqual(test.letFloatArg(), 0);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.letFloatArg(undefined)).toEqual(0);
|
assert.strictEqual(test.letFloatArg(undefined), 0);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.letFloatArg(null)).toEqual(0);
|
assert.strictEqual(test.letFloatArg(null), 0);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.letFloatArg(55)).toEqual(55);
|
assert.strictEqual(test.letFloatArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: USE_FLOAT_ARG', () => {
|
describe('addon-tools.hpp: USE_FLOAT_ARG', () => {
|
||||||
it('exports useFloatArg', () => {
|
it('exports useFloatArg', () => {
|
||||||
expect(typeof test.useFloatArg).toBe('function');
|
assert.strictEqual(typeof test.useFloatArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.useFloatArg('1')).toThrow(numArgMsg);
|
assert.throws(() => test.useFloatArg('1'), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.useFloatArg(true)).toThrow(numArgMsg);
|
assert.throws(() => test.useFloatArg(true), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.useFloatArg({})).toThrow(numArgMsg);
|
assert.throws(() => test.useFloatArg({}), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.useFloatArg([])).toThrow(numArgMsg);
|
assert.throws(() => test.useFloatArg([]), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.useFloatArg()).toEqual(10);
|
assert.strictEqual(test.useFloatArg(), 10);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.useFloatArg(undefined)).toEqual(10);
|
assert.strictEqual(test.useFloatArg(undefined), 10);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.useFloatArg(null)).toEqual(10);
|
assert.strictEqual(test.useFloatArg(null), 10);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.useFloatArg(55)).toEqual(55);
|
assert.strictEqual(test.useFloatArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,96 +1,100 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const intArgMsg = 'Argument 0 must be of type `Int32`';
|
const intArgMsg = { message: 'Argument 0 must be of type `Int32`' };
|
||||||
|
const intArgLetMsg = { message: 'Argument 0 must be of type `Int32` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / REQ_INT_ARG, REQ_INT32_ARG', () => {
|
describe('AT / HPP / REQ_INT_ARG, REQ_INT32_ARG', () => {
|
||||||
it('exports reqIntArg', () => {
|
it('exports reqIntArg', () => {
|
||||||
expect(typeof test.reqIntArg).toBe('function');
|
assert.strictEqual(typeof test.reqIntArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqIntArg()).toThrow(intArgMsg);
|
assert.throws(() => test.reqIntArg(), intArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqIntArg(undefined)).toThrow(intArgMsg);
|
assert.throws(() => test.reqIntArg(undefined), intArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqIntArg(null)).toThrow(intArgMsg);
|
assert.throws(() => test.reqIntArg(null), intArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqIntArg('1')).toThrow(intArgMsg);
|
assert.throws(() => test.reqIntArg('1'), intArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqIntArg(true)).toThrow(intArgMsg);
|
assert.throws(() => test.reqIntArg(true), intArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqIntArg({})).toThrow(intArgMsg);
|
assert.throws(() => test.reqIntArg({}), intArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqIntArg([])).toThrow(intArgMsg);
|
assert.throws(() => test.reqIntArg([]), intArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.reqIntArg(55)).toEqual(55);
|
assert.strictEqual(test.reqIntArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: LET_INT_ARG / LET_INT32_ARG', () => {
|
describe('addon-tools.hpp: LET_INT_ARG / LET_INT32_ARG', () => {
|
||||||
it('exports letIntArg', () => {
|
it('exports letIntArg', () => {
|
||||||
expect(typeof test.letIntArg).toBe('function');
|
assert.strictEqual(typeof test.letIntArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.letIntArg('1')).toThrow(intArgMsg);
|
assert.throws(() => test.letIntArg('1'), intArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.letIntArg(true)).toThrow(intArgMsg);
|
assert.throws(() => test.letIntArg(true), intArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.letIntArg({})).toThrow(intArgMsg);
|
assert.throws(() => test.letIntArg({}), intArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.letIntArg([])).toThrow(intArgMsg);
|
assert.throws(() => test.letIntArg([]), intArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.letIntArg()).toEqual(0);
|
assert.strictEqual(test.letIntArg(), 0);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.letIntArg(undefined)).toEqual(0);
|
assert.strictEqual(test.letIntArg(undefined), 0);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.letIntArg(null)).toEqual(0);
|
assert.strictEqual(test.letIntArg(null), 0);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.letIntArg(55)).toEqual(55);
|
assert.strictEqual(test.letIntArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: USE_INT_ARG / USE_INT32_ARG', () => {
|
describe('addon-tools.hpp: USE_INT_ARG / USE_INT32_ARG', () => {
|
||||||
it('exports useIntArg', () => {
|
it('exports useIntArg', () => {
|
||||||
expect(typeof test.useIntArg).toBe('function');
|
assert.strictEqual(typeof test.useIntArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.useIntArg('1')).toThrow(intArgMsg);
|
assert.throws(() => test.useIntArg('1'), intArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.useIntArg(true)).toThrow(intArgMsg);
|
assert.throws(() => test.useIntArg(true), intArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.useIntArg({})).toThrow(intArgMsg);
|
assert.throws(() => test.useIntArg({}), intArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.useIntArg([])).toThrow(intArgMsg);
|
assert.throws(() => test.useIntArg([]), intArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.useIntArg()).toEqual(10);
|
assert.strictEqual(test.useIntArg(), 10);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.useIntArg(undefined)).toEqual(10);
|
assert.strictEqual(test.useIntArg(undefined), 10);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.useIntArg(null)).toEqual(10);
|
assert.strictEqual(test.useIntArg(null), 10);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.useIntArg(55)).toEqual(55);
|
assert.strictEqual(test.useIntArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,105 +1,109 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const objArgMsg = 'Argument 0 must be of type `Object`';
|
const objArgMsg = { message: 'Argument 0 must be of type `Object`' };
|
||||||
|
const objArgLetMsg = { message: 'Argument 0 must be of type `Object` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / REQ_OBJ_ARG', () => {
|
describe('AT / HPP / REQ_OBJ_ARG', () => {
|
||||||
it('exports reqObjArg', () => {
|
it('exports reqObjArg', () => {
|
||||||
expect(typeof test.reqObjArg).toBe('function');
|
assert.strictEqual(typeof test.reqObjArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqObjArg()).toThrow(objArgMsg);
|
assert.throws(() => test.reqObjArg(), objArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqObjArg(undefined)).toThrow(objArgMsg);
|
assert.throws(() => test.reqObjArg(undefined), objArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqObjArg(null)).toThrow(objArgMsg);
|
assert.throws(() => test.reqObjArg(null), objArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqObjArg('1')).toThrow(objArgMsg);
|
assert.throws(() => test.reqObjArg('1'), objArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.reqObjArg(1)).toThrow(objArgMsg);
|
assert.throws(() => test.reqObjArg(1), objArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqObjArg(true)).toThrow(objArgMsg);
|
assert.throws(() => test.reqObjArg(true), objArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.reqObjArg(test.retExt())).toThrow(objArgMsg);
|
assert.throws(() => test.reqObjArg(test.retExt()), objArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts an object', () => {
|
it('accepts an object', () => {
|
||||||
expect(typeof test.reqObjArg({})).toBe('object');
|
assert.strictEqual(typeof test.reqObjArg({}), 'object');
|
||||||
});
|
});
|
||||||
it('accepts an array', () => {
|
it('accepts an array', () => {
|
||||||
expect(Array.isArray(test.reqObjArg([]))).toBe(true);
|
assert.ok(Array.isArray(test.reqObjArg([])));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: LET_OBJ_ARG', () => {
|
describe('addon-tools.hpp: LET_OBJ_ARG', () => {
|
||||||
it('exports letObjArg', () => {
|
it('exports letObjArg', () => {
|
||||||
expect(typeof test.letObjArg).toBe('function');
|
assert.strictEqual(typeof test.letObjArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.letObjArg('1')).toThrow(objArgMsg);
|
assert.throws(() => test.letObjArg('1'), objArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.letObjArg(1)).toThrow(objArgMsg);
|
assert.throws(() => test.letObjArg(1), objArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.letObjArg(true)).toThrow(objArgMsg);
|
assert.throws(() => test.letObjArg(true), objArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.letObjArg(test.retExt())).toThrow(objArgMsg);
|
assert.throws(() => test.letObjArg(test.retExt()), objArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(typeof test.letObjArg()).toBe('object');
|
assert.strictEqual(typeof test.letObjArg(), 'object');
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(typeof test.letObjArg(undefined)).toBe('object');
|
assert.strictEqual(typeof test.letObjArg(undefined), 'object');
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(typeof test.letObjArg(null)).toBe('object');
|
assert.strictEqual(typeof test.letObjArg(null), 'object');
|
||||||
});
|
});
|
||||||
it('accepts an object', () => {
|
it('accepts an object', () => {
|
||||||
expect(typeof test.letObjArg({})).toBe('object');
|
assert.strictEqual(typeof test.letObjArg({}), 'object');
|
||||||
});
|
});
|
||||||
it('accepts an array', () => {
|
it('accepts an array', () => {
|
||||||
expect(Array.isArray(test.letObjArg([]))).toBe(true);
|
assert.ok(Array.isArray(test.letObjArg([])));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: USE_OBJ_ARG', () => {
|
describe('addon-tools.hpp: USE_OBJ_ARG', () => {
|
||||||
it('exports useObjArg', () => {
|
it('exports useObjArg', () => {
|
||||||
expect(typeof test.useObjArg).toBe('function');
|
assert.strictEqual(typeof test.useObjArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.useObjArg('1')).toThrow(objArgMsg);
|
assert.throws(() => test.useObjArg('1'), objArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.useObjArg(1)).toThrow(objArgMsg);
|
assert.throws(() => test.useObjArg(1), objArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.useObjArg(true)).toThrow(objArgMsg);
|
assert.throws(() => test.useObjArg(true), objArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.useObjArg(test.retExt())).toThrow(objArgMsg);
|
assert.throws(() => test.useObjArg(test.retExt()), objArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(typeof test.useObjArg()).toBe('object');
|
assert.strictEqual(typeof test.useObjArg(), 'object');
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(typeof test.useObjArg(undefined)).toBe('object');
|
assert.strictEqual(typeof test.useObjArg(undefined), 'object');
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(typeof test.useObjArg(null)).toBe('object');
|
assert.strictEqual(typeof test.useObjArg(null), 'object');
|
||||||
});
|
});
|
||||||
it('accepts an object', () => {
|
it('accepts an object', () => {
|
||||||
expect(typeof test.useObjArg({})).toBe('object');
|
assert.strictEqual(typeof test.useObjArg({}), 'object');
|
||||||
});
|
});
|
||||||
it('accepts an array', () => {
|
it('accepts an array', () => {
|
||||||
expect(Array.isArray(test.useObjArg([]))).toBe(true);
|
assert.ok(Array.isArray(test.useObjArg([])));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,96 +1,100 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const numArgMsg = 'Argument 0 must be of type `Number`';
|
const numArgMsg = { message: 'Argument 0 must be of type `Number`' };
|
||||||
|
const numArgLetMsg = { message: 'Argument 0 must be of type `Number` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / REQ_OFFS_ARG', () => {
|
describe('AT / HPP / REQ_OFFS_ARG', () => {
|
||||||
it('exports reqOffsArg', () => {
|
it('exports reqOffsArg', () => {
|
||||||
expect(typeof test.reqOffsArg).toBe('function');
|
assert.strictEqual(typeof test.reqOffsArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqOffsArg()).toThrow(numArgMsg);
|
assert.throws(() => test.reqOffsArg(), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqOffsArg(undefined)).toThrow(numArgMsg);
|
assert.throws(() => test.reqOffsArg(undefined), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqOffsArg(null)).toThrow(numArgMsg);
|
assert.throws(() => test.reqOffsArg(null), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqOffsArg('1')).toThrow(numArgMsg);
|
assert.throws(() => test.reqOffsArg('1'), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqOffsArg(true)).toThrow(numArgMsg);
|
assert.throws(() => test.reqOffsArg(true), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqOffsArg({})).toThrow(numArgMsg);
|
assert.throws(() => test.reqOffsArg({}), numArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqOffsArg([])).toThrow(numArgMsg);
|
assert.throws(() => test.reqOffsArg([]), numArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.reqOffsArg(55)).toEqual(55);
|
assert.strictEqual(test.reqOffsArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: LET_OFFS_ARG', () => {
|
describe('addon-tools.hpp: LET_OFFS_ARG', () => {
|
||||||
it('exports letOffsArg', () => {
|
it('exports letOffsArg', () => {
|
||||||
expect(typeof test.letOffsArg).toBe('function');
|
assert.strictEqual(typeof test.letOffsArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.letOffsArg('1')).toThrow(numArgMsg);
|
assert.throws(() => test.letOffsArg('1'), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.letOffsArg(true)).toThrow(numArgMsg);
|
assert.throws(() => test.letOffsArg(true), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.letOffsArg({})).toThrow(numArgMsg);
|
assert.throws(() => test.letOffsArg({}), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.letOffsArg([])).toThrow(numArgMsg);
|
assert.throws(() => test.letOffsArg([]), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.letOffsArg()).toEqual(0);
|
assert.strictEqual(test.letOffsArg(), 0);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.letOffsArg(undefined)).toEqual(0);
|
assert.strictEqual(test.letOffsArg(undefined), 0);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.letOffsArg(null)).toEqual(0);
|
assert.strictEqual(test.letOffsArg(null), 0);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.letOffsArg(55)).toEqual(55);
|
assert.strictEqual(test.letOffsArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: USE_OFFS_ARG', () => {
|
describe('addon-tools.hpp: USE_OFFS_ARG', () => {
|
||||||
it('exports useOffsArg', () => {
|
it('exports useOffsArg', () => {
|
||||||
expect(typeof test.useOffsArg).toBe('function');
|
assert.strictEqual(typeof test.useOffsArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.useOffsArg('1')).toThrow(numArgMsg);
|
assert.throws(() => test.useOffsArg('1'), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.useOffsArg(true)).toThrow(numArgMsg);
|
assert.throws(() => test.useOffsArg(true), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.useOffsArg({})).toThrow(numArgMsg);
|
assert.throws(() => test.useOffsArg({}), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.useOffsArg([])).toThrow(numArgMsg);
|
assert.throws(() => test.useOffsArg([]), numArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.useOffsArg()).toEqual(10);
|
assert.strictEqual(test.useOffsArg(), 10);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.useOffsArg(undefined)).toEqual(10);
|
assert.strictEqual(test.useOffsArg(undefined), 10);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.useOffsArg(null)).toEqual(10);
|
assert.strictEqual(test.useOffsArg(null), 10);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.useOffsArg(55)).toEqual(55);
|
assert.strictEqual(test.useOffsArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,96 +1,100 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const strArgMsg = 'Argument 0 must be of type `String`';
|
const strArgMsg = { message: 'Argument 0 must be of type `String`' };
|
||||||
|
const strArgLetMsg = { message: 'Argument 0 must be of type `String` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / REQ_STR_ARG', () => {
|
describe('AT / HPP / REQ_STR_ARG', () => {
|
||||||
it('exports reqStrArg', () => {
|
it('exports reqStrArg', () => {
|
||||||
expect(typeof test.reqStrArg).toBe('function');
|
assert.strictEqual(typeof test.reqStrArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqStrArg()).toThrow(strArgMsg);
|
assert.throws(() => test.reqStrArg(), strArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqStrArg(undefined)).toThrow(strArgMsg);
|
assert.throws(() => test.reqStrArg(undefined), strArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqStrArg(null)).toThrow(strArgMsg);
|
assert.throws(() => test.reqStrArg(null), strArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.reqStrArg(1)).toThrow(strArgMsg);
|
assert.throws(() => test.reqStrArg(1), strArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqStrArg(true)).toThrow(strArgMsg);
|
assert.throws(() => test.reqStrArg(true), strArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqStrArg({})).toThrow(strArgMsg);
|
assert.throws(() => test.reqStrArg({}), strArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqStrArg([])).toThrow(strArgMsg);
|
assert.throws(() => test.reqStrArg([]), strArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a string', () => {
|
it('accepts a string', () => {
|
||||||
expect(test.reqStrArg('1abc')).toEqual('1abc');
|
assert.strictEqual(test.reqStrArg('1abc'), '1abc');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: LET_STR_ARG', () => {
|
describe('addon-tools.hpp: LET_STR_ARG', () => {
|
||||||
it('exports letStrArg', () => {
|
it('exports letStrArg', () => {
|
||||||
expect(typeof test.letStrArg).toBe('function');
|
assert.strictEqual(typeof test.letStrArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.letStrArg(1)).toThrow(strArgMsg);
|
assert.throws(() => test.letStrArg(1), strArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.letStrArg(true)).toThrow(strArgMsg);
|
assert.throws(() => test.letStrArg(true), strArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.letStrArg({})).toThrow(strArgMsg);
|
assert.throws(() => test.letStrArg({}), strArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.letStrArg([])).toThrow(strArgMsg);
|
assert.throws(() => test.letStrArg([]), strArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.letStrArg()).toEqual('');
|
assert.strictEqual(test.letStrArg(), '');
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.letStrArg(undefined)).toEqual('');
|
assert.strictEqual(test.letStrArg(undefined), '');
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.letStrArg(null)).toEqual('');
|
assert.strictEqual(test.letStrArg(null), '');
|
||||||
});
|
});
|
||||||
it('accepts a string', () => {
|
it('accepts a string', () => {
|
||||||
expect(test.letStrArg('1abc')).toEqual('1abc');
|
assert.strictEqual(test.letStrArg('1abc'), '1abc');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: USE_STR_ARG', () => {
|
describe('addon-tools.hpp: USE_STR_ARG', () => {
|
||||||
it('exports useStrArg', () => {
|
it('exports useStrArg', () => {
|
||||||
expect(typeof test.useStrArg).toBe('function');
|
assert.strictEqual(typeof test.useStrArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.useStrArg(1)).toThrow(strArgMsg);
|
assert.throws(() => test.useStrArg(1), strArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.useStrArg(true)).toThrow(strArgMsg);
|
assert.throws(() => test.useStrArg(true), strArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.useStrArg({})).toThrow(strArgMsg);
|
assert.throws(() => test.useStrArg({}), strArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.useStrArg([])).toThrow(strArgMsg);
|
assert.throws(() => test.useStrArg([]), strArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.useStrArg()).toEqual('default');
|
assert.strictEqual(test.useStrArg(), 'default');
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.useStrArg(undefined)).toEqual('default');
|
assert.strictEqual(test.useStrArg(undefined), 'default');
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.useStrArg(null)).toEqual('default');
|
assert.strictEqual(test.useStrArg(null), 'default');
|
||||||
});
|
});
|
||||||
it('accepts a string', () => {
|
it('accepts a string', () => {
|
||||||
expect(test.useStrArg('1abc')).toEqual('1abc');
|
assert.strictEqual(test.useStrArg('1abc'), '1abc');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,96 +1,100 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
const uintArgMsg = 'Argument 0 must be of type `Uint32`';
|
const uintArgMsg = { message: 'Argument 0 must be of type `Uint32`' };
|
||||||
|
const uintArgLetMsg = { message: 'Argument 0 must be of type `Uint32` or be `null`/`undefined`' };
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / REQ_UINT_ARG, REQ_UINT32_ARG', () => {
|
describe('AT / HPP / REQ_UINT_ARG, REQ_UINT32_ARG', () => {
|
||||||
it('exports reqUintArg', () => {
|
it('exports reqUintArg', () => {
|
||||||
expect(typeof test.reqUintArg).toBe('function');
|
assert.strictEqual(typeof test.reqUintArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqUintArg()).toThrow(uintArgMsg);
|
assert.throws(() => test.reqUintArg(), uintArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqUintArg(undefined)).toThrow(uintArgMsg);
|
assert.throws(() => test.reqUintArg(undefined), uintArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqUintArg(null)).toThrow(uintArgMsg);
|
assert.throws(() => test.reqUintArg(null), uintArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqUintArg('1')).toThrow(uintArgMsg);
|
assert.throws(() => test.reqUintArg('1'), uintArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqUintArg(true)).toThrow(uintArgMsg);
|
assert.throws(() => test.reqUintArg(true), uintArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqUintArg({})).toThrow(uintArgMsg);
|
assert.throws(() => test.reqUintArg({}), uintArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqUintArg([])).toThrow(uintArgMsg);
|
assert.throws(() => test.reqUintArg([]), uintArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.reqUintArg(55)).toEqual(55);
|
assert.strictEqual(test.reqUintArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: LET_UINT_ARG / LET_UINT32_ARG', () => {
|
describe('addon-tools.hpp: LET_UINT_ARG / LET_UINT32_ARG', () => {
|
||||||
it('exports letUintArg', () => {
|
it('exports letUintArg', () => {
|
||||||
expect(typeof test.letUintArg).toBe('function');
|
assert.strictEqual(typeof test.letUintArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.letUintArg('1')).toThrow(uintArgMsg);
|
assert.throws(() => test.letUintArg('1'), uintArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.letUintArg(true)).toThrow(uintArgMsg);
|
assert.throws(() => test.letUintArg(true), uintArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.letUintArg({})).toThrow(uintArgMsg);
|
assert.throws(() => test.letUintArg({}), uintArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.letUintArg([])).toThrow(uintArgMsg);
|
assert.throws(() => test.letUintArg([]), uintArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.letUintArg()).toEqual(0);
|
assert.strictEqual(test.letUintArg(), 0);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.letUintArg(undefined)).toEqual(0);
|
assert.strictEqual(test.letUintArg(undefined), 0);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.letUintArg(null)).toEqual(0);
|
assert.strictEqual(test.letUintArg(null), 0);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.letUintArg(55)).toEqual(55);
|
assert.strictEqual(test.letUintArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('addon-tools.hpp: USE_UINT_ARG / USE_UINT32_ARG', () => {
|
describe('addon-tools.hpp: USE_UINT_ARG / USE_UINT32_ARG', () => {
|
||||||
it('exports useUintArg', () => {
|
it('exports useUintArg', () => {
|
||||||
expect(typeof test.useUintArg).toBe('function');
|
assert.strictEqual(typeof test.useUintArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.useUintArg('1')).toThrow(uintArgMsg);
|
assert.throws(() => test.useUintArg('1'), uintArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.useUintArg(true)).toThrow(uintArgMsg);
|
assert.throws(() => test.useUintArg(true), uintArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.useUintArg({})).toThrow(uintArgMsg);
|
assert.throws(() => test.useUintArg({}), uintArgLetMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.useUintArg([])).toThrow(uintArgMsg);
|
assert.throws(() => test.useUintArg([]), uintArgLetMsg);
|
||||||
});
|
});
|
||||||
it('accepts an empty arg', () => {
|
it('accepts an empty arg', () => {
|
||||||
expect(test.useUintArg()).toEqual(10);
|
assert.strictEqual(test.useUintArg(), 10);
|
||||||
});
|
});
|
||||||
it('accepts undefined', () => {
|
it('accepts undefined', () => {
|
||||||
expect(test.useUintArg(undefined)).toEqual(10);
|
assert.strictEqual(test.useUintArg(undefined), 10);
|
||||||
});
|
});
|
||||||
it('accepts null', () => {
|
it('accepts null', () => {
|
||||||
expect(test.useUintArg(null)).toEqual(10);
|
assert.strictEqual(test.useUintArg(null), 10);
|
||||||
});
|
});
|
||||||
it('accepts a number', () => {
|
it('accepts a number', () => {
|
||||||
expect(test.useUintArg(55)).toEqual(55);
|
assert.strictEqual(test.useUintArg(55), 55);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,205 +1,211 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const test = require('./build/Release/test.node');
|
const test = require('./build/Release/test.node');
|
||||||
|
|
||||||
|
|
||||||
describe('AT / addon-tools.hpp / Function arguments', () => {
|
describe('AT / HPP / Function arguments', () => {
|
||||||
|
|
||||||
|
const arg3Msg = { message: 'Expected at least 3 arguments' };
|
||||||
|
|
||||||
describe('REQ_ARGS', () => {
|
describe('REQ_ARGS', () => {
|
||||||
it('exports reqArgs3', () => {
|
it('exports reqArgs3', () => {
|
||||||
expect(typeof test.reqArgs3).toBe('function');
|
assert.strictEqual(typeof test.reqArgs3, 'function');
|
||||||
});
|
});
|
||||||
it('throws if no args passed', () => {
|
it('throws if no args passed', () => {
|
||||||
expect(() => test.reqArgs3()).toThrow('Expected at least 3 arguments');
|
assert.throws(() => test.reqArgs3(), arg3Msg);
|
||||||
});
|
});
|
||||||
it('throws if 1 arg passed', () => {
|
it('throws if 1 arg passed', () => {
|
||||||
expect(() => test.reqArgs3(1)).toThrow('Expected at least 3 arguments');
|
assert.throws(() => test.reqArgs3(1), arg3Msg);
|
||||||
});
|
});
|
||||||
it('returns true if 3 args passed', () => {
|
it('returns true if 3 args passed', () => {
|
||||||
expect(test.reqArgs3(1, 2, 3)).toEqual(true);
|
assert.ok(test.reqArgs3(1, 2, 3));
|
||||||
});
|
});
|
||||||
it('returns true if 5 args passed', () => {
|
it('returns true if 5 args passed', () => {
|
||||||
expect(test.reqArgs3(1, 2, 3, 4, 5)).toEqual(true);
|
assert.ok(test.reqArgs3(1, 2, 3, 4, 5));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('IS_ARG_EMPTY', () => {
|
describe('IS_ARG_EMPTY', () => {
|
||||||
it('exports isArg0Empty', () => {
|
it('exports isArg0Empty', () => {
|
||||||
expect(typeof test.isArg0Empty).toBe('function');
|
assert.strictEqual(typeof test.isArg0Empty, 'function');
|
||||||
});
|
});
|
||||||
it('returns true for absent arg', () => {
|
it('returns true for absent arg', () => {
|
||||||
expect(test.isArg0Empty()).toEqual(true);
|
assert.ok(test.isArg0Empty());
|
||||||
});
|
});
|
||||||
it('returns true for undefined arg', () => {
|
it('returns true for undefined arg', () => {
|
||||||
expect(test.isArg0Empty(undefined)).toEqual(true);
|
assert.ok(test.isArg0Empty(undefined));
|
||||||
});
|
});
|
||||||
it('returns true for null arg', () => {
|
it('returns true for null arg', () => {
|
||||||
expect(test.isArg0Empty(null)).toEqual(true);
|
assert.ok(test.isArg0Empty(null));
|
||||||
});
|
});
|
||||||
it('returns false for non-empty value', () => {
|
it('returns false for non-empty value', () => {
|
||||||
expect(test.isArg0Empty(1)).toEqual(false);
|
assert.strictEqual(test.isArg0Empty(1), false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ------------------------------ FUN_ARG
|
// ------------------------------ FUN_ARG
|
||||||
|
|
||||||
const funArgMsg = 'Argument 0 must be of type `Function`';
|
const funArgMsg = { message: 'Argument 0 must be of type `Function`' };
|
||||||
|
|
||||||
describe('REQ_FUN_ARG', () => {
|
describe('REQ_FUN_ARG', () => {
|
||||||
it('exports reqFunArg', () => {
|
it('exports reqFunArg', () => {
|
||||||
expect(typeof test.reqFunArg).toBe('function');
|
assert.strictEqual(typeof test.reqFunArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqFunArg()).toThrow(funArgMsg);
|
assert.throws(() => test.reqFunArg(), funArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqFunArg(undefined)).toThrow(funArgMsg);
|
assert.throws(() => test.reqFunArg(undefined), funArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqFunArg(null)).toThrow(funArgMsg);
|
assert.throws(() => test.reqFunArg(null), funArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqFunArg('1')).toThrow(funArgMsg);
|
assert.throws(() => test.reqFunArg('1'), funArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.reqFunArg(1)).toThrow(funArgMsg);
|
assert.throws(() => test.reqFunArg(1), funArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqFunArg(true)).toThrow(funArgMsg);
|
assert.throws(() => test.reqFunArg(true), funArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.reqFunArg(test.retExt())).toThrow(funArgMsg);
|
assert.throws(() => test.reqFunArg(test.retExt()), funArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqFunArg({})).toThrow(funArgMsg);
|
assert.throws(() => test.reqFunArg({}), funArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqFunArg([])).toThrow(funArgMsg);
|
assert.throws(() => test.reqFunArg([]), funArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a function', () => {
|
it('accepts a function', () => {
|
||||||
expect(typeof test.reqFunArg(() => {})).toBe('function');
|
assert.strictEqual(typeof test.reqFunArg(() => {}), 'function');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ------------------------------ ARRV_ARG
|
// ------------------------------ ARRV_ARG
|
||||||
|
|
||||||
const arrvArgMsg = 'Argument 0 must be of type `ArrayBuffer`';
|
const arrvArgMsg = { message: 'Argument 0 must be of type `ArrayBuffer`' };
|
||||||
|
|
||||||
describe('REQ_ARRV_ARG', () => {
|
describe('REQ_ARRV_ARG', () => {
|
||||||
it('exports reqArrvArg', () => {
|
it('exports reqArrvArg', () => {
|
||||||
expect(typeof test.reqArrvArg).toBe('function');
|
assert.strictEqual(typeof test.reqArrvArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqArrvArg()).toThrow(arrvArgMsg);
|
assert.throws(() => test.reqArrvArg(), arrvArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqArrvArg(undefined)).toThrow(arrvArgMsg);
|
assert.throws(() => test.reqArrvArg(undefined), arrvArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqArrvArg(null)).toThrow(arrvArgMsg);
|
assert.throws(() => test.reqArrvArg(null), arrvArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqArrvArg('1')).toThrow(arrvArgMsg);
|
assert.throws(() => test.reqArrvArg('1'), arrvArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.reqArrvArg(1)).toThrow(arrvArgMsg);
|
assert.throws(() => test.reqArrvArg(1), arrvArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqArrvArg(true)).toThrow(arrvArgMsg);
|
assert.throws(() => test.reqArrvArg(true), arrvArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.reqArrvArg(test.retExt())).toThrow(arrvArgMsg);
|
assert.throws(() => test.reqArrvArg(test.retExt()), arrvArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqArrvArg({})).toThrow(arrvArgMsg);
|
assert.throws(() => test.reqArrvArg({}), arrvArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqArrvArg([])).toThrow(arrvArgMsg);
|
assert.throws(() => test.reqArrvArg([]), arrvArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts an array buffer', () => {
|
it('accepts an array buffer', () => {
|
||||||
const { buffer } = new Uint8Array([1, 2, 3]);
|
const { buffer } = new Uint8Array([1, 2, 3]);
|
||||||
expect(test.reqArrvArg(buffer)).toEqual(buffer);
|
assert.strictEqual(test.reqArrvArg(buffer), buffer);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ------------------------------ BUF_ARG
|
// ------------------------------ BUF_ARG
|
||||||
|
|
||||||
const bufArgMsg = 'Argument 0 must be of type `Buffer`';
|
const bufArgMsg = { message: 'Argument 0 must be of type `Buffer`' };
|
||||||
|
|
||||||
describe('REQ_BUF_ARG', () => {
|
describe('REQ_BUF_ARG', () => {
|
||||||
it('exports reqBufArg', () => {
|
it('exports reqBufArg', () => {
|
||||||
expect(typeof test.reqBufArg).toBe('function');
|
assert.strictEqual(typeof test.reqBufArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqBufArg()).toThrow(bufArgMsg);
|
assert.throws(() => test.reqBufArg(), bufArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqBufArg(undefined)).toThrow(bufArgMsg);
|
assert.throws(() => test.reqBufArg(undefined), bufArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqBufArg(null)).toThrow(bufArgMsg);
|
assert.throws(() => test.reqBufArg(null), bufArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqBufArg('1')).toThrow(bufArgMsg);
|
assert.throws(() => test.reqBufArg('1'), bufArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.reqBufArg(1)).toThrow(bufArgMsg);
|
assert.throws(() => test.reqBufArg(1), bufArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqBufArg(true)).toThrow(bufArgMsg);
|
assert.throws(() => test.reqBufArg(true), bufArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.reqBufArg(test.retExt())).toThrow(bufArgMsg);
|
assert.throws(() => test.reqBufArg(test.retExt()), bufArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqBufArg({})).toThrow(bufArgMsg);
|
assert.throws(() => test.reqBufArg({}), bufArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqBufArg([])).toThrow(bufArgMsg);
|
assert.throws(() => test.reqBufArg([]), bufArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a buffer', () => {
|
it('accepts a buffer', () => {
|
||||||
const buffer = Buffer.from([1, 2, 3]);
|
const buffer = Buffer.from([1, 2, 3]);
|
||||||
expect(test.reqBufArg(buffer)).toEqual(buffer);
|
assert.strictEqual(test.reqBufArg(buffer), buffer);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ------------------------------ TYPED_ARRAY_ARG
|
// ------------------------------ TYPED_ARRAY_ARG
|
||||||
|
|
||||||
const typedArgMsg = 'Argument 0 must be of type `TypedArray`';
|
const typedArgMsg = { message: 'Argument 0 must be of type `TypedArray`' };
|
||||||
|
|
||||||
describe('REQ_TYPED_ARRAY_ARG', () => {
|
describe('REQ_TYPED_ARRAY_ARG', () => {
|
||||||
it('exports reqTypedArg', () => {
|
it('exports reqTypedArg', () => {
|
||||||
expect(typeof test.reqTypedArg).toBe('function');
|
assert.strictEqual(typeof test.reqTypedArg, 'function');
|
||||||
});
|
});
|
||||||
it('throws if arg was not passed', () => {
|
it('throws if arg was not passed', () => {
|
||||||
expect(() => test.reqTypedArg()).toThrow(typedArgMsg);
|
assert.throws(() => test.reqTypedArg(), typedArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed undefined', () => {
|
it('throws if arg was passed undefined', () => {
|
||||||
expect(() => test.reqTypedArg(undefined)).toThrow(typedArgMsg);
|
assert.throws(() => test.reqTypedArg(undefined), typedArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed null', () => {
|
it('throws if arg was passed null', () => {
|
||||||
expect(() => test.reqTypedArg(null)).toThrow(typedArgMsg);
|
assert.throws(() => test.reqTypedArg(null), typedArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a string', () => {
|
it('throws if arg was passed a string', () => {
|
||||||
expect(() => test.reqTypedArg('1')).toThrow(typedArgMsg);
|
assert.throws(() => test.reqTypedArg('1'), typedArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a number', () => {
|
it('throws if arg was passed a number', () => {
|
||||||
expect(() => test.reqTypedArg(1)).toThrow(typedArgMsg);
|
assert.throws(() => test.reqTypedArg(1), typedArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a boolean', () => {
|
it('throws if arg was passed a boolean', () => {
|
||||||
expect(() => test.reqTypedArg(true)).toThrow(typedArgMsg);
|
assert.throws(() => test.reqTypedArg(true), typedArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed a pointer', () => {
|
it('throws if arg was passed a pointer', () => {
|
||||||
expect(() => test.reqTypedArg(test.retExt())).toThrow(typedArgMsg);
|
assert.throws(() => test.reqTypedArg(test.retExt()), typedArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an object', () => {
|
it('throws if arg was passed an object', () => {
|
||||||
expect(() => test.reqTypedArg({})).toThrow(typedArgMsg);
|
assert.throws(() => test.reqTypedArg({}), typedArgMsg);
|
||||||
});
|
});
|
||||||
it('throws if arg was passed an array', () => {
|
it('throws if arg was passed an array', () => {
|
||||||
expect(() => test.reqTypedArg([])).toThrow(typedArgMsg);
|
assert.throws(() => test.reqTypedArg([]), typedArgMsg);
|
||||||
});
|
});
|
||||||
it('accepts a typed array', () => {
|
it('accepts a typed array', () => {
|
||||||
const typed = new Uint8Array([1, 2, 3]);
|
const typed = new Uint8Array([1, 2, 3]);
|
||||||
expect(test.reqTypedArg(typed)).toEqual(typed);
|
assert.strictEqual(test.reqTypedArg(typed), typed);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
set noparent
|
set noparent
|
||||||
linelength=110
|
linelength=110
|
||||||
filter=-legal/copyright
|
|
||||||
filter=-build/include_order
|
|
||||||
filter=-build/include
|
|
||||||
filter=-build/header_guard
|
filter=-build/header_guard
|
||||||
filter=-build/namespaces
|
filter=-build/include
|
||||||
|
filter=-build/include_order
|
||||||
filter=-build/include_what_you_use
|
filter=-build/include_what_you_use
|
||||||
|
filter=-build/namespaces
|
||||||
|
filter=-legal/copyright
|
||||||
|
filter=-readability/todo
|
||||||
|
filter=-runtime/indentation_namespace
|
||||||
filter=-whitespace/blank_line
|
filter=-whitespace/blank_line
|
||||||
|
filter=-whitespace/braces
|
||||||
filter=-whitespace/comments
|
filter=-whitespace/comments
|
||||||
filter=-whitespace/tab
|
|
||||||
filter=-whitespace/end_of_line
|
filter=-whitespace/end_of_line
|
||||||
filter=-whitespace/indent
|
filter=-whitespace/indent
|
||||||
filter=-whitespace/operators
|
filter=-whitespace/operators
|
||||||
filter=-whitespace/parens
|
filter=-whitespace/parens
|
||||||
filter=-readability/todo
|
filter=-whitespace/tab
|
||||||
filter=-runtime/indentation_namespace
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { copy, exists } = require('./files');
|
||||||
|
|
||||||
|
|
||||||
|
const cpcpplint = async () => {
|
||||||
|
const cpplintDest = `${process.cwd()}/CPPLINT.cfg`.replace(/\\/g, '/');
|
||||||
|
const cpplintSrc = `${__dirname}/CPPLINT.cfg`.replace(/\\/g, '/');
|
||||||
|
|
||||||
|
if (!await exists(cpplintSrc) ) {
|
||||||
|
console.error('Error. File "CPPLINT.cfg" not found.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await exists(cpplintDest) ) {
|
||||||
|
console.warn('Warning. Dest "CPPLINT.cfg" exists and will be overwritten.');
|
||||||
|
}
|
||||||
|
|
||||||
|
await copy(cpplintSrc, cpplintDest);
|
||||||
|
|
||||||
|
console.log(`"CPPLINT.cfg" was copied to "${cpplintDest}".`);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { cpcpplint };
|
|
@ -10,10 +10,8 @@ const protocols = { http, https };
|
||||||
|
|
||||||
|
|
||||||
const downloadRecursive = async (url, count = 1) => {
|
const downloadRecursive = async (url, count = 1) => {
|
||||||
url = url.toLowerCase();
|
|
||||||
|
|
||||||
const stream = new WritableBuffer();
|
const stream = new WritableBuffer();
|
||||||
const proto = protocols[url.match(/^https?/)[0]];
|
const proto = protocols[url.match(/^https?/i)[0].toLowerCase()];
|
||||||
|
|
||||||
const response = await new Promise((res, rej) => {
|
const response = await new Promise((res, rej) => {
|
||||||
const request = proto.get(url, (response) => res(response));
|
const request = proto.get(url, (response) => res(response));
|
||||||
|
|
|
@ -5,6 +5,7 @@ module.exports = Object.assign(
|
||||||
{},
|
{},
|
||||||
require('./action-pack'),
|
require('./action-pack'),
|
||||||
require('./cpbin'),
|
require('./cpbin'),
|
||||||
|
require('./cpcpplint'),
|
||||||
require('./download'),
|
require('./download'),
|
||||||
require('./files'),
|
require('./files'),
|
||||||
require('./install'),
|
require('./install'),
|
||||||
|
|
|
@ -12,12 +12,6 @@ const { mkdir, rmdir, rm } = require('./files');
|
||||||
|
|
||||||
const protocols = { http, https };
|
const protocols = { http, https };
|
||||||
|
|
||||||
const onError = (msg) => {
|
|
||||||
console.error(msg);
|
|
||||||
process.exit(-1);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const installRecursive = async (url, count = 1) => {
|
const installRecursive = async (url, count = 1) => {
|
||||||
try {
|
try {
|
||||||
|
@ -34,13 +28,13 @@ const installRecursive = async (url, count = 1) => {
|
||||||
if (count < 5) {
|
if (count < 5) {
|
||||||
return installRecursive(response.headers.location, count + 1);
|
return installRecursive(response.headers.location, count + 1);
|
||||||
}
|
}
|
||||||
console.log(url);
|
console.warn(url);
|
||||||
throw new Error('Error: Too many redirects.');
|
throw new Error('Error: Too many redirects.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle bad status
|
// Handle bad status
|
||||||
if (response.statusCode !== 200) {
|
if (response.statusCode !== 200) {
|
||||||
console.log(url);
|
console.warn(url);
|
||||||
throw new Error(`Response status was ${response.statusCode}`);
|
throw new Error(`Response status was ${response.statusCode}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,18 +50,23 @@ const installRecursive = async (url, count = 1) => {
|
||||||
response.pipe(packWriter);
|
response.pipe(packWriter);
|
||||||
});
|
});
|
||||||
|
|
||||||
await exec(`tar -xzf ${packPath} --directory ${getBin()}`);
|
const { stderr } = await exec(`tar -xzf ${packPath} --directory ${getBin()}`);
|
||||||
|
if (stderr) {
|
||||||
|
console.warn(stderr);
|
||||||
|
}
|
||||||
|
|
||||||
await rm(packPath);
|
await rm(packPath);
|
||||||
} catch (ex) {
|
return true;
|
||||||
onError(ex.message);
|
} catch (error) {
|
||||||
|
console.error(error.message);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const install = (folder) => {
|
const install = async (folder) => {
|
||||||
const url = `${folder}/${getPlatform()}.gz`;
|
const url = `${folder}/${getPlatform()}.gz`;
|
||||||
installRecursive(url).then();
|
return installRecursive(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { install };
|
module.exports = { install };
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('node:assert').strict;
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
|
||||||
const utils = require('.');
|
const utils = require('.');
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +16,7 @@ describe('AT / utils', () => {
|
||||||
|
|
||||||
methods.forEach((name) => {
|
methods.forEach((name) => {
|
||||||
it(`exports the "${name}" function`, () => {
|
it(`exports the "${name}" function`, () => {
|
||||||
expect(typeof utils[name]).toBe('function');
|
assert.strictEqual(typeof utils[name], 'function');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue