From ee52fa4e2d8898a67970c6c0b1c2ddbfd96fa43d Mon Sep 17 00:00:00 2001 From: Maxim Van de Wynckel Date: Wed, 28 Feb 2024 16:15:11 +0100 Subject: [PATCH] test: fixed unit tests --- .../docs/out/classes/WLANSourceNode.html | 12 ++-- .../docs/out/interfaces/WifiPlugin.html | 6 +- .../docs/out/variables/Wifi.html | 2 +- modules/capacitor-wlan/package.json | 5 +- modules/capacitor-wlan/rollup.config.js | 2 +- package.json | 2 +- yarn.lock | 71 +++++++++++-------- 7 files changed, 55 insertions(+), 45 deletions(-) diff --git a/modules/capacitor-wlan/docs/out/classes/WLANSourceNode.html b/modules/capacitor-wlan/docs/out/classes/WLANSourceNode.html index aa1a654..4142626 100644 --- a/modules/capacitor-wlan/docs/out/classes/WLANSourceNode.html +++ b/modules/capacitor-wlan/docs/out/classes/WLANSourceNode.html @@ -1,5 +1,5 @@ WLANSourceNode | @openhps/capacitor-wlan

WLAN source node

-

Hierarchy

  • SourceNode<DataFrame>
    • WLANSourceNode

Constructors

Hierarchy

  • SourceNode<DataFrame>
    • WLANSourceNode

Constructors

Properties

options: SensorSourceOptions
captureRejectionSymbol: typeof captureRejectionSymbol

Value: Symbol.for('nodejs.rejection')

+

Constructors

Properties

options: SensorSourceOptions
captureRejectionSymbol: typeof captureRejectionSymbol

Value: Symbol.for('nodejs.rejection')

See how to write a custom rejection handler.

Since

v13.4.0, v12.16.0

captureRejections: boolean

Value: boolean

@@ -102,7 +102,7 @@

Returns DataObject

Existing object

  • Alias for emitter.removeListener().

    Type Parameters

    • K

    Parameters

    • eventName: string | symbol
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

    Since

    v10.0.0

    -
  • Adds the listener function to the beginning of the listeners array for the +

  • Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

    @@ -164,7 +164,7 @@
  • Set the node options

    Parameters

    • options: NodeOptions

      Node options to set

    Returns this

    Node instance

    -
  • Experimental

    Listens once to the abort event on the provided signal.

    +
  • Experimental

    Listens once to the abort event on the provided signal.

    Listening to the abort event on abort signals is unsafe and may lead to resource leaks since another third party with the signal can call e.stopImmediatePropagation(). Unfortunately Node.js cannot change @@ -178,7 +178,7 @@

    Parameters

    • signal: AbortSignal
    • resource: ((event) => void)
        • (event): void
        • Parameters

          • event: Event

          Returns void

    Returns Disposable

    Disposable that removes the abort listener.

    Since

    v20.5.0

    -
  • Returns a copy of the array of listeners for the event named eventName.

    +
  • Returns a copy of the array of listeners for the event named eventName.

    For EventEmitters this behaves exactly the same as calling .listeners on the emitter.

    For EventTargets this is the only way to get the event listeners for the @@ -231,7 +231,7 @@

    Deprecated

    Since v3.2.0 - Use listenerCount instead.

    import { EventEmitter, once } from 'node:events';

    const ee = new EventEmitter();
    const ac = new AbortController();

    async function foo(emitter, event, signal) {
    try {
    await once(emitter, event, { signal });
    console.log('event emitted!');
    } catch (error) {
    if (error.name === 'AbortError') {
    console.error('Waiting for the event was canceled!');
    } else {
    console.error('There was an error', error.message);
    }
    }
    }

    foo(ee, 'foo', ac.signal);
    ac.abort(); // Abort waiting for the event
    ee.emit('foo'); // Prints: Waiting for the event was canceled!

    Parameters

    • emitter: _NodeEventTarget
    • eventName: string | symbol
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

    Since

    v11.13.0, v10.16.0

    -
  • Parameters

    • emitter: _DOMEventTarget
    • eventName: string
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

  • import { setMaxListeners, EventEmitter } from 'node:events';

    const target = new EventTarget();
    const emitter = new EventEmitter();

    setMaxListeners(5, target, emitter); +
  • Parameters

    • emitter: _DOMEventTarget
    • eventName: string
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

Returns Promise<{
    ssid: string;
}>

  • Returns Promise<{
        scanResult: any;
        scanSuccess: boolean;
        startScanSuccess: boolean;
    }>

\ No newline at end of file diff --git a/modules/capacitor-wlan/docs/out/variables/Wifi.html b/modules/capacitor-wlan/docs/out/variables/Wifi.html index fa3bb1f..3eca06f 100644 --- a/modules/capacitor-wlan/docs/out/variables/Wifi.html +++ b/modules/capacitor-wlan/docs/out/variables/Wifi.html @@ -1 +1 @@ -Wifi | @openhps/capacitor-wlan
\ No newline at end of file +Wifi | @openhps/capacitor-wlan
\ No newline at end of file diff --git a/modules/capacitor-wlan/package.json b/modules/capacitor-wlan/package.json index cd9e516..b866f8e 100644 --- a/modules/capacitor-wlan/package.json +++ b/modules/capacitor-wlan/package.json @@ -4,7 +4,6 @@ "description": "Open Hybrid Positioning System - Capacitor WLAN Scanning", "author": "Maxim Van de Wynckel", "license": "Apache-2.0", - "type": "module", "repository": { "type": "git", "url": "https://github.com/OpenHPS/openhps-capacitor.git" @@ -46,8 +45,8 @@ "prettier": "prettier \"**/*.{css,html,ts,js,java}\"", "swiftlint": "node-swiftlint", "build": "npm run clean && cross-env ../../node_modules/.bin/npm-run-all --parallel build:ts:* && npm run build:rollup && npm run build:electron && npm run build:typedoc", - "build:rollup": "rollup -c rollup.config.js", - "build:electron": "cross-env ../../node_modules/.bin/tsc --project electron/tsconfig.json && rollup -c electron/rollup.config.js && rimraf ./electron/build", + "build:rollup": "rollup -c rollup.config.js --bundleConfigAsCjs", + "build:electron": "cross-env ../../node_modules/.bin/tsc --project electron/tsconfig.json && rollup -c electron/rollup.config.js --bundleConfigAsCjs && rimraf ./electron/build", "clean": "rimraf ./dist", "watch": "cross-env ../../node_modules/.bin/tsc --watch", "test": "cross-env ../../node_modules/.bin/mocha --config test/.mocharc.json", diff --git a/modules/capacitor-wlan/rollup.config.js b/modules/capacitor-wlan/rollup.config.js index da42702..cfb5620 100644 --- a/modules/capacitor-wlan/rollup.config.js +++ b/modules/capacitor-wlan/rollup.config.js @@ -1,7 +1,7 @@ import resolve from 'rollup-plugin-node-resolve'; export default { - input: 'dist/esm/index.js', + input: 'dist/cjs/index.js', output: [ { file: 'dist/plugin.js', diff --git a/package.json b/package.json index ca66018..8cfa61b 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@types/node": "^20.11.21", "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.1.0", - "chai": "^5.1.0", + "chai": "^4", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-deprecation": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 1f1ab4c..463e5bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2621,10 +2621,10 @@ arrify@^1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== -assertion-error@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-2.0.1.tgz#f641a196b335690b1070bf00b6e7593fec190bf7" - integrity sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA== +assertion-error@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" + integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== astral-regex@^2.0.0: version "2.0.0" @@ -2913,16 +2913,18 @@ caniuse-lite@^1.0.30001587: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz#16745e50263edc9f395895a7cd468b9f3767cf33" integrity sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ== -chai@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/chai/-/chai-5.1.0.tgz#648cf2d8b5d16f32646612e22ffd12dc617ef960" - integrity sha512-kDZ7MZyM6Q1DhR9jy7dalKohXQ2yrlXkk59CR52aRKxJrobmlBNqnFQxX9xOX8w+4mz8SYlKJa/7D7ddltFXCw== +chai@^4: + version "4.4.1" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.4.1.tgz#3603fa6eba35425b0f2ac91a009fe924106e50d1" + integrity sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g== dependencies: - assertion-error "^2.0.1" - check-error "^2.0.0" - deep-eql "^5.0.1" - loupe "^3.1.0" - pathval "^2.0.0" + assertion-error "^1.1.0" + check-error "^1.0.3" + deep-eql "^4.1.3" + get-func-name "^2.0.2" + loupe "^2.3.6" + pathval "^1.1.1" + type-detect "^4.0.8" chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" @@ -2951,10 +2953,12 @@ charenc@0.0.2: resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA== -check-error@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/check-error/-/check-error-2.0.0.tgz#589a4f201b6256fd93a2d165089fe43d2676d8c6" - integrity sha512-tjLAOBHKVxtPoHe/SA7kNOMvhCRdCJ3vETdeY0RuAc9popf+hyaSV6ZEg9hr4cpWF7jmo/JSWEnLDrnijS9Tog== +check-error@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694" + integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== + dependencies: + get-func-name "^2.0.2" chevrotain-allstar@0.3.1: version "0.3.1" @@ -3540,10 +3544,12 @@ decompress-response@^6.0.0: dependencies: mimic-response "^3.1.0" -deep-eql@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-5.0.1.tgz#21ea2c0d561a4d08cdd99c417ac584e0fb121385" - integrity sha512-nwQCf6ne2gez3o1MxWifqkciwt0zhl0LO1/UwVu4uMBuPmflWM4oQ70XMqHqnBJA+nhzncaqL9HVL6KkHJ28lw== +deep-eql@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" + integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== + dependencies: + type-detect "^4.0.0" deep-extend@^0.6.0, deep-extend@~0.6.0: version "0.6.0" @@ -4455,7 +4461,7 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-func-name@^2.0.1: +get-func-name@^2.0.1, get-func-name@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41" integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== @@ -5658,10 +5664,10 @@ log-symbols@4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" -loupe@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/loupe/-/loupe-3.1.0.tgz#46ef1a4ffee73145f5c0a627536d754787c1ea2a" - integrity sha512-qKl+FrLXUhFuHUoDJG7f8P8gEMHq9NFS0c6ghXG1J0rldmZFQZoNVv/vyirE9qwCIhWZDsvEFd1sbFu3GvRQFg== +loupe@^2.3.6: + version "2.3.7" + resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.7.tgz#6e69b7d4db7d3ab436328013d37d1c8c3540c697" + integrity sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA== dependencies: get-func-name "^2.0.1" @@ -6718,10 +6724,10 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== -pathval@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/pathval/-/pathval-2.0.0.tgz#7e2550b422601d4f6b8e26f1301bc8f15a741a25" - integrity sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA== +pathval@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" + integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== picocolors@^1.0.0: version "1.0.0" @@ -8129,6 +8135,11 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" +type-detect@^4.0.0, type-detect@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + type-fest@^0.18.0: version "0.18.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f"