Skip to content

Commit

Permalink
chore: code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
erossignon committed Jun 5, 2023
1 parent fdcdb03 commit af92e66
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 24 deletions.
10 changes: 10 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
require: [
"source-map-support/register",
"ts-node/register/transpile-only",
"should",
],
timeout: 20000,
extension: ["js", "ts"],
bail: true
};
50 changes: 35 additions & 15 deletions .nycrc.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
extends: "@istanbuljs/nyc-config-typescript"
all: false
# check-coverage: true
report: none
source-map: true
check-coverage: true
# report: none
# source-map: true
# reporter: [ text-lcov ]
exclude-after-remap: false
include:
- packages/node-opcua-*/dist/**/*.js
exclude-after-remap: true
cwd: ./packages
include:
- node-opcua-*/**/*.js
- node-opcua-*/**/*.ts

exclude:
- packages/node-opcua-*/test/**/*.js
- _generated_opcua_types.ts
- packages/node-opcua-types/**/*.*
- packages/node-opcua-utils/**/*.*
- packages/node-opcua-generator/**/*.*
- packages/node-opcua-end2end-test/**/*.*
- packages/node-opcua-debug/**/*.*
- packages/node-opcua-xml2json/**/*.*
- "**/test/**"
- "**/test_helpers/**"
- "**/test-fixtures/**"
# - node-opcua-*/test/**/*.js
- "**/**/_generated_opcua_types.*"
- node-opcua-types
- node-opcua-utils
- node-opcua-benchmarker
- node-opcua-packet-analyzer
- node-opcua-schemas
- node-opcua-generator
- node-opcua-end2end-test
- node-opcua-debug
- node-opcua-leak-detector
- node-opcua-modeler
- node-opcua-nodesets
- node-opcua-nodeset-*
- node-opcua-xml2json
- node-opcua-address-space-for-conformance-testing
- node-opcua-assert
- node-opcua-test-helpers
- node-opcua-test-fixtures
- node-opcua-convert-nodeset-to-javascript
- node-opcua-service-discovery/source/bonjour.ts
- node-opcua-hostname

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
test-cov: istanbul

istanbul:
npx -y nyc@15 --cwd=. node -r source-map-support/register --max_old_space_size=8192 ./packages/run_all_mocha_tests.js
npx -y nyc@15 node -r source-map-support/register --max_old_space_size=8192 ./packages/run_all_mocha_tests.js
npx -y nyc@15 report --reporter=lcov --reporter=html

# literate_programming stuff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,24 @@ export function readHistoryServerCapabilities(
const properties = [
"AccessHistoryDataCapability",
"AccessHistoryEventsCapability",

"DeleteAtTimeCapability",
"DeleteRawCapability",
"DeleteEventCapability",

"InsertAnnotationCapability",
"InsertDataCapability",
"InsertEventCapability",

"ReplaceDataCapability",
"ReplaceEventCapability",

"UpdateDataCapability",
"UpdateEventCapability",

"MaxReturnDataValues",
"MaxReturnEventValues",

"AggregateFunctions/AnnotationCount",
"AggregateFunctions/Average",
"AggregateFunctions/Count",
Expand Down
12 changes: 7 additions & 5 deletions packages/node-opcua-modeler/test/test_issue_889.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as path from "path";
import * as os from "os";
import { spy } from "sinon";
import "should";

Expand All @@ -15,7 +17,8 @@ import {
DataType,
ExtensionObjectDefinition,
NodeClassMask,
StructureDefinitionOptions} from "..";
StructureDefinitionOptions
} from "..";

describe("loading very large DataType Definitions ", function (this: any) {
this.timeout(Math.max(10000, this.timeout()));
Expand Down Expand Up @@ -92,12 +95,11 @@ describe("loading very large DataType Definitions ", function (this: any) {
const xml = namespace.toNodeset2XML();
if (true) {
const fs = require("fs");
const tmpFile = "tmp_1.xml";
const tmpFile = path.join(os.tmpdir(), "tmp_1.xml");
await fs.promises.writeFile(tmpFile, xml, "utf-8");
/* to be completed */
}



const maxBrowseContinuationPoints = 2;
const maxNodesPerBrowse = 100;

Expand Down Expand Up @@ -135,7 +137,7 @@ describe("loading very large DataType Definitions ", function (this: any) {

const browseSpy = spy(session, "browse");
const browseNextSpy = spy(session, "browseNext");

const dataTypeManager = new ExtraDataTypeManager();
await populateDataTypeManager(session, dataTypeManager);

Expand Down
4 changes: 2 additions & 2 deletions packages/node-opcua-numeric-range/source/numeric_range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export class NumericRange implements NumericalRange1 {
* @param dimensions: of the matrix if data is a matrix
* @return {*}
*/
public extract_values<U, T extends ArrayLike<U>>(array: T, dimensions?: number[]): ExtractResult<T> {
public extract_values<U, T extends ArrayLike<U>>(array: T, dimensions?: number[] | null): ExtractResult<T> {
const self = this as NumericalRange0;

if (!array) {
Expand Down Expand Up @@ -654,7 +654,7 @@ function extract_matrix_range<U, T extends ArrayLike<U>>(
array: T,
rowRange: number[],
colRange: number[],
dimension?: number[]
dimension?: number[] | null
): ExtractResult<T> {
assert(Array.isArray(rowRange) && Array.isArray(colRange));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const secure_channel = require("node-opcua-service-secure-channel");
const CloseSecureChannelResponse = secure_channel.CloseSecureChannelResponse;
const { encode_decode_round_trip_test } = require("node-opcua-packet-analyzer/dist/test_helpers");

const { compare_buffers } = require("node-opcua-utils");
const { clone_buffer } = require("node-opcua-buffer-utils");
const { hexDump, makeBufferFromTrace } = require("node-opcua-debug");

Expand Down

0 comments on commit af92e66

Please sign in to comment.