launchdarkly-node-client-sdk 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +23 -16
- package/.eslintrc.yaml +1 -1
- package/.ldrelease/config.yml +1 -1
- package/CHANGELOG.md +11 -0
- package/CONTRIBUTING.md +6 -0
- package/babel.config.js +12 -0
- package/contract-tests/README.md +7 -0
- package/contract-tests/index.js +106 -0
- package/contract-tests/log.js +23 -0
- package/contract-tests/package.json +15 -0
- package/contract-tests/sdkClientEntity.js +148 -0
- package/package.json +42 -24
- package/.babelrc +0 -16
- package/jest.config.js +0 -15
- package/src/jest.setup.js +0 -1
package/.circleci/config.yml
CHANGED
|
@@ -16,20 +16,14 @@ workflows:
|
|
|
16
16
|
docker-image: cimg/node:current
|
|
17
17
|
run-lint: true
|
|
18
18
|
- build-test-linux:
|
|
19
|
-
name: Node
|
|
20
|
-
docker-image: cimg/node:
|
|
19
|
+
name: Node 18.10
|
|
20
|
+
docker-image: cimg/node:18.10
|
|
21
21
|
- build-test-linux:
|
|
22
|
-
name: Node
|
|
23
|
-
docker-image: cimg/node:
|
|
22
|
+
name: Node 16.14
|
|
23
|
+
docker-image: cimg/node:16.17
|
|
24
24
|
- build-test-linux:
|
|
25
|
-
name: Node 14.
|
|
26
|
-
docker-image: cimg/node:14.
|
|
27
|
-
- build-test-linux:
|
|
28
|
-
name: Node 13.14
|
|
29
|
-
docker-image: cimg/node:13.14
|
|
30
|
-
- build-test-linux:
|
|
31
|
-
name: Node 12.22
|
|
32
|
-
docker-image: cimg/node:12.22
|
|
25
|
+
name: Node 14.19
|
|
26
|
+
docker-image: cimg/node:14.20
|
|
33
27
|
- build-test-windows:
|
|
34
28
|
name: Windows
|
|
35
29
|
|
|
@@ -41,6 +35,9 @@ jobs:
|
|
|
41
35
|
run-lint:
|
|
42
36
|
type: boolean
|
|
43
37
|
default: false
|
|
38
|
+
run-contract-tests:
|
|
39
|
+
type: boolean
|
|
40
|
+
default: true
|
|
44
41
|
|
|
45
42
|
docker:
|
|
46
43
|
- image: <<parameters.docker-image>>
|
|
@@ -54,10 +51,7 @@ jobs:
|
|
|
54
51
|
|
|
55
52
|
- run: npm install
|
|
56
53
|
|
|
57
|
-
- run:
|
|
58
|
-
command: npm test
|
|
59
|
-
environment:
|
|
60
|
-
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
|
|
54
|
+
- run: npm run test
|
|
61
55
|
|
|
62
56
|
- when:
|
|
63
57
|
condition: <<parameters.run-lint>>
|
|
@@ -65,6 +59,19 @@ jobs:
|
|
|
65
59
|
- run: npm run lint:all
|
|
66
60
|
- run: npm run check-typescript
|
|
67
61
|
|
|
62
|
+
- when:
|
|
63
|
+
condition: <<parameters.run-contract-tests>>
|
|
64
|
+
steps:
|
|
65
|
+
- run:
|
|
66
|
+
name: start contact test service
|
|
67
|
+
command: npm run contract-test-service
|
|
68
|
+
background: true
|
|
69
|
+
- run:
|
|
70
|
+
name: run contract tests
|
|
71
|
+
command: |
|
|
72
|
+
mkdir -p reports/junit
|
|
73
|
+
TEST_HARNESS_PARAMS="-junit reports/junit/contract-test-results.xml" npm run contract-test-harness
|
|
74
|
+
|
|
68
75
|
- run:
|
|
69
76
|
name: dependency audit
|
|
70
77
|
command: ./scripts/better-audit.sh
|
package/.eslintrc.yaml
CHANGED
package/.ldrelease/config.yml
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the LaunchDarkly Client-Side SDK for Node.js will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.0.4] - 2022-04-27
|
|
6
|
+
### Changed:
|
|
7
|
+
- CI builds now include a cross-platform test suite implemented in https://github.com/launchdarkly/sdk-test-harness. This covers many test cases that are also implemented in unit tests, but may be extended in the future to ensure consistent behavior across SDKs in other areas.
|
|
8
|
+
|
|
9
|
+
### Fixed:
|
|
10
|
+
- The `baseUrl`, `streamUrl`, and `eventsUrl` properties now work properly regardless of whether the URL string has a trailing slash. Previously, a trailing slash would cause request URL paths to have double slashes.
|
|
11
|
+
|
|
12
|
+
## [2.0.3] - 2022-03-14
|
|
13
|
+
### Fixed:
|
|
14
|
+
- The `original` dependency (and therefore its transitive dependency `url-parse`) had accidentally been included twice, once as a dependency of `js-eventsource` and then again directly in the SDK's `package.json`. This has been removed so there is no longer any reference to the vulnerable `url-parse` that was meant to be removed in [2.0.2](https://github.com/launchdarkly/node-client-sdk/releases/tag/2.0.2). (Thanks, [AlexHladin](https://github.com/launchdarkly/node-client-sdk/pull/26)!)
|
|
15
|
+
|
|
5
16
|
## [2.0.2] - 2022-03-10
|
|
6
17
|
### Fixed:
|
|
7
18
|
- Removed a transitive dependency on the package `url-parse`, which was flagged in [CVE-2022-0686](https://nvd.nist.gov/vuln/detail/CVE-2022-0686).
|
package/CONTRIBUTING.md
CHANGED
|
@@ -39,3 +39,9 @@ To verify that the TypeScript declarations compile correctly (this involves comp
|
|
|
39
39
|
```
|
|
40
40
|
npm run check-typescript
|
|
41
41
|
```
|
|
42
|
+
|
|
43
|
+
To run the SDK contract test suite (see [`contract-tests/README.md`](./contract-tests/README.md)):
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm run contract-tests
|
|
47
|
+
```
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# SDK contract test service
|
|
2
|
+
|
|
3
|
+
This directory contains an implementation of the cross-platform SDK testing protocol defined by https://github.com/launchdarkly/sdk-test-harness. See that project's `README` for details of this protocol, and the kinds of SDK capabilities that are relevant to the contract tests. This code should not need to be updated unless the SDK has added or removed such capabilities.
|
|
4
|
+
|
|
5
|
+
To run these tests locally, run `npm run contract-tests` from the SDK project root directory. This will start the test service, download the correct version of the test harness tool, and run the tests.
|
|
6
|
+
|
|
7
|
+
Or, to test against an in-progress local version of the test harness, run `npm run contract-test-service` from the SDK project root directory; then, in the root directory of the `sdk-test-harness` project, build the test harness and run it from the command line.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const bodyParser = require('body-parser');
|
|
3
|
+
|
|
4
|
+
const { Log } = require('./log');
|
|
5
|
+
const { newSdkClientEntity, badCommandError } = require('./sdkClientEntity');
|
|
6
|
+
|
|
7
|
+
const app = express();
|
|
8
|
+
let server = null;
|
|
9
|
+
|
|
10
|
+
const port = 8000;
|
|
11
|
+
|
|
12
|
+
let clientCounter = 0;
|
|
13
|
+
const clients = {};
|
|
14
|
+
|
|
15
|
+
const mainLog = Log('service');
|
|
16
|
+
|
|
17
|
+
app.use(bodyParser.json());
|
|
18
|
+
|
|
19
|
+
app.get('/', (req, res) => {
|
|
20
|
+
res.header('Content-Type', 'application/json');
|
|
21
|
+
res.json({
|
|
22
|
+
capabilities: [
|
|
23
|
+
'client-side',
|
|
24
|
+
'service-endpoints',
|
|
25
|
+
'tags'
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
app.delete('/', (req, res) => {
|
|
31
|
+
mainLog.info('Test service has told us to exit');
|
|
32
|
+
res.status(204);
|
|
33
|
+
res.send();
|
|
34
|
+
|
|
35
|
+
// Defer the following actions till after the response has been sent
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
server.close(() => process.exit());
|
|
38
|
+
// We force-quit with process.exit because, even after closing the server, there could be some
|
|
39
|
+
// scheduled tasks lingering if an SDK instance didn't get cleaned up properly, and we don't want
|
|
40
|
+
// that to prevent us from quitting.
|
|
41
|
+
}, 1);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
app.post('/', async (req, res) => {
|
|
45
|
+
const options = req.body;
|
|
46
|
+
|
|
47
|
+
clientCounter += 1;
|
|
48
|
+
const clientId = clientCounter.toString();
|
|
49
|
+
const resourceUrl = `/clients/${clientId}`;
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const client = await newSdkClientEntity(options);
|
|
53
|
+
clients[clientId] = client;
|
|
54
|
+
|
|
55
|
+
res.status(201);
|
|
56
|
+
res.set('Location', resourceUrl);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
res.status(500);
|
|
59
|
+
const message = e.message || JSON.stringify(e);
|
|
60
|
+
mainLog.error('Error creating client: ' + message);
|
|
61
|
+
res.write(message);
|
|
62
|
+
}
|
|
63
|
+
res.send();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
app.post('/clients/:id', async (req, res) => {
|
|
67
|
+
const client = clients[req.params.id];
|
|
68
|
+
if (!client) {
|
|
69
|
+
res.status(404);
|
|
70
|
+
} else {
|
|
71
|
+
try {
|
|
72
|
+
const respValue = await client.doCommand(req.body);
|
|
73
|
+
if (respValue) {
|
|
74
|
+
res.status(200);
|
|
75
|
+
res.write(JSON.stringify(respValue));
|
|
76
|
+
} else {
|
|
77
|
+
res.status(204);
|
|
78
|
+
}
|
|
79
|
+
} catch (e) {
|
|
80
|
+
const isBadRequest = e === badCommandError;
|
|
81
|
+
res.status(isBadRequest ? 400 : 500);
|
|
82
|
+
res.write(e.message || JSON.stringify(e));
|
|
83
|
+
if (!isBadRequest && e.stack) {
|
|
84
|
+
console.log(e.stack);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
res.send();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
app.delete('/clients/:id', async (req, res) => {
|
|
92
|
+
const client = clients[req.params.id];
|
|
93
|
+
if (!client) {
|
|
94
|
+
res.status(404);
|
|
95
|
+
res.send();
|
|
96
|
+
} else {
|
|
97
|
+
client.close();
|
|
98
|
+
delete clients[req.params.id];
|
|
99
|
+
res.status(204);
|
|
100
|
+
res.send();
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
server = app.listen(port, () => {
|
|
105
|
+
console.log('Listening on port %d', port);
|
|
106
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const ld = require('launchdarkly-node-client-sdk');
|
|
2
|
+
|
|
3
|
+
function Log(tag) {
|
|
4
|
+
function doLog(level, message) {
|
|
5
|
+
console.log(new Date().toISOString() + ` [${tag}] ${level}: ${message}`);
|
|
6
|
+
}
|
|
7
|
+
return {
|
|
8
|
+
info: message => doLog('info', message),
|
|
9
|
+
error: message => doLog('error', message),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function sdkLogger(tag) {
|
|
14
|
+
return ld.basicLogger({
|
|
15
|
+
level: 'debug',
|
|
16
|
+
destination: line => {
|
|
17
|
+
console.log(new Date().toISOString() + ` [${tag}.sdk] ${line}`);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports.Log = Log;
|
|
23
|
+
module.exports.sdkLogger = sdkLogger;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "node-client-sdk-contract-tests",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "node index.js"
|
|
7
|
+
},
|
|
8
|
+
"author": "",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"body-parser": "^1.19.0",
|
|
12
|
+
"express": "^4.17.1",
|
|
13
|
+
"launchdarkly-node-client-sdk": "file:.."
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
const ld = require('launchdarkly-node-client-sdk');
|
|
2
|
+
|
|
3
|
+
const { Log, sdkLogger } = require('./log');
|
|
4
|
+
|
|
5
|
+
const badCommandError = new Error('unsupported command');
|
|
6
|
+
|
|
7
|
+
function makeSdkConfig(options, tag) {
|
|
8
|
+
if (!options.clientSide) {
|
|
9
|
+
throw new Error('configuration did not include clientSide options');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const isSet = x => x !== null && x !== undefined;
|
|
13
|
+
const maybeTime = seconds => isSet(seconds) ? seconds / 1000 : undefined;
|
|
14
|
+
|
|
15
|
+
const cf = {
|
|
16
|
+
autoAliasingOptOut: options.clientSide.autoAliasingOptOut,
|
|
17
|
+
evaluationReasons: options.clientSide.evaluationReasons,
|
|
18
|
+
logger: sdkLogger(tag),
|
|
19
|
+
useReport: options.clientSide.useReport
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
if (options.serviceEndpoints) {
|
|
23
|
+
cf.streamUrl = options.serviceEndpoints.streaming;
|
|
24
|
+
cf.baseUrl = options.serviceEndpoints.polling;
|
|
25
|
+
cf.eventsUrl = options.serviceEndpoints.events;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (options.streaming) {
|
|
29
|
+
if (options.streaming.baseUri) {
|
|
30
|
+
cf.streamUrl = options.streaming.baseUri;
|
|
31
|
+
}
|
|
32
|
+
cf.streaming = true;
|
|
33
|
+
cf.streamReconnectDelay = maybeTime(options.streaming.initialRetryDelayMs);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (options.polling) {
|
|
37
|
+
if (options.polling.baseUri) {
|
|
38
|
+
cf.baseUrl = options.polling.baseUri;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (options.events) {
|
|
43
|
+
if (options.events.baseUri) {
|
|
44
|
+
cf.eventsUrl = options.events.baseUri;
|
|
45
|
+
}
|
|
46
|
+
cf.allAttributesPrivate = options.events.allAttributesPrivate;
|
|
47
|
+
cf.eventCapacity = options.events.capacity;
|
|
48
|
+
cf.diagnosticOptOut = !options.events.enableDiagnostics;
|
|
49
|
+
cf.flushInterval = maybeTime(options.events.flushIntervalMs);
|
|
50
|
+
cf.inlineUsersInEvents = options.events.inlineUsers;
|
|
51
|
+
cf.privateAttributeNames = options.events.globalPrivateAttributes;
|
|
52
|
+
} else {
|
|
53
|
+
cf.sendEvents = false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (options.tags) {
|
|
57
|
+
cf.application = {
|
|
58
|
+
id: options.tags.applicationId,
|
|
59
|
+
version: options.tags.applicationVersion
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return cf;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function makeDefaultInitialUser() {
|
|
67
|
+
return {key: 'key-not-specified'};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function newSdkClientEntity(options) {
|
|
71
|
+
const c = {};
|
|
72
|
+
const log = Log(options.tag);
|
|
73
|
+
|
|
74
|
+
log.info('Creating client with configuration: ' + JSON.stringify(options.configuration));
|
|
75
|
+
|
|
76
|
+
const timeout =
|
|
77
|
+
options.configuration.startWaitTimeMs !== null && options.configuration.startWaitTimeMs !== undefined
|
|
78
|
+
? options.configuration.startWaitTimeMs
|
|
79
|
+
: 5000;
|
|
80
|
+
const sdkConfig = makeSdkConfig(options.configuration, options.tag);
|
|
81
|
+
const initialUser = (options.configuration.clientSide && options.configuration.clientSide.initialUser)
|
|
82
|
+
|| makeDefaultInitialUser();
|
|
83
|
+
const client = ld.initialize(
|
|
84
|
+
options.configuration.credential || 'unknown-env-id',
|
|
85
|
+
initialUser,
|
|
86
|
+
sdkConfig
|
|
87
|
+
);
|
|
88
|
+
let failed = false;
|
|
89
|
+
try {
|
|
90
|
+
await Promise.race([client.waitForInitialization(), new Promise((resolve, reject) => setTimeout(reject, timeout))]);
|
|
91
|
+
} catch (_) {
|
|
92
|
+
// we get here if waitForInitialization() rejects or if we timed out
|
|
93
|
+
failed = true
|
|
94
|
+
}
|
|
95
|
+
if (failed && !options.configuration.initCanFail) {
|
|
96
|
+
client.close();
|
|
97
|
+
throw new Error('client initialization failed');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
c.close = () => {
|
|
101
|
+
client.close();
|
|
102
|
+
log.info('Test ended');
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
c.doCommand = async params => {
|
|
106
|
+
log.info('Received command: ' + params.command);
|
|
107
|
+
switch (params.command) {
|
|
108
|
+
case 'evaluate': {
|
|
109
|
+
const pe = params.evaluate;
|
|
110
|
+
if (pe.detail) {
|
|
111
|
+
return client.variationDetail(pe.flagKey, pe.defaultValue);
|
|
112
|
+
} else {
|
|
113
|
+
const value = client.variation(pe.flagKey, pe.defaultValue);
|
|
114
|
+
return { value };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
case 'evaluateAll':
|
|
119
|
+
return { state: client.allFlags() };
|
|
120
|
+
|
|
121
|
+
case 'identifyEvent':
|
|
122
|
+
await client.identify(params.identifyEvent.user);
|
|
123
|
+
return undefined;
|
|
124
|
+
|
|
125
|
+
case 'customEvent': {
|
|
126
|
+
const pce = params.customEvent;
|
|
127
|
+
client.track(pce.eventKey, pce.data, pce.metricValue);
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
case 'aliasEvent':
|
|
132
|
+
client.alias(params.aliasEvent.user, params.aliasEvent.previousUser);
|
|
133
|
+
return undefined;
|
|
134
|
+
|
|
135
|
+
case 'flushEvents':
|
|
136
|
+
client.flush();
|
|
137
|
+
return undefined;
|
|
138
|
+
|
|
139
|
+
default:
|
|
140
|
+
throw badCommandError;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
return c;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
module.exports.newSdkClientEntity = newSdkClientEntity;
|
|
148
|
+
module.exports.badCommandError = badCommandError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "launchdarkly-node-client-sdk",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "LaunchDarkly Client-Side SDK for Node.js",
|
|
5
5
|
"author": "LaunchDarkly <team@launchdarkly.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -14,39 +14,57 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"lint": "eslint --format 'node_modules/eslint-formatter-pretty' --ignore-path .eslintignore",
|
|
16
16
|
"lint:all": "eslint --format 'node_modules/eslint-formatter-pretty' --ignore-path .eslintignore src",
|
|
17
|
-
"test": "jest",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
17
|
+
"test": "jest --ci",
|
|
18
|
+
"check-typescript": "node_modules/typescript/bin/tsc",
|
|
19
|
+
"contract-test-service": "npm --prefix contract-tests install && npm --prefix contract-tests start",
|
|
20
|
+
"contract-test-harness": "curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/main/downloader/run.sh \\ | VERSION=v1 PARAMS=\"-url http://localhost:8000 -debug -stop-service-at-end $TEST_HARNESS_PARAMS\" sh",
|
|
21
|
+
"contract-tests": "npm run contract-test-service & npm run contract-test-harness"
|
|
20
22
|
},
|
|
21
23
|
"engines": {
|
|
22
24
|
"node": ">= 12.0.0"
|
|
23
25
|
},
|
|
24
26
|
"devDependencies": {
|
|
25
|
-
"@babel/core": "^7.
|
|
26
|
-
"@babel/preset-env": "^7.
|
|
27
|
+
"@babel/core": "^7.19.3",
|
|
28
|
+
"@babel/preset-env": "^7.19.3",
|
|
27
29
|
"@types/node": "^12.12.6",
|
|
28
|
-
"babel-
|
|
29
|
-
"babel-jest": "^
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"eslint": "^
|
|
33
|
-
"eslint-config-
|
|
34
|
-
"eslint-
|
|
35
|
-
"eslint-
|
|
36
|
-
"eslint-plugin-
|
|
37
|
-
"
|
|
38
|
-
"jest": "^
|
|
39
|
-
"jest-junit": "^13.0.0",
|
|
30
|
+
"@babel/eslint-parser": "7.19.1",
|
|
31
|
+
"babel-jest": "^29.1.0",
|
|
32
|
+
"cross-env": "^7.0.3",
|
|
33
|
+
"eslint": "^8.24.0",
|
|
34
|
+
"eslint-config-prettier": "^8.5.0",
|
|
35
|
+
"eslint-config-xo": "^0.42.0",
|
|
36
|
+
"eslint-formatter-pretty": "^4.1.0",
|
|
37
|
+
"eslint-plugin-babel": "^5.3.1",
|
|
38
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
39
|
+
"jest": "^29.1.1",
|
|
40
|
+
"jest-junit": "^14.0.1",
|
|
40
41
|
"launchdarkly-js-test-helpers": "1.2.1",
|
|
41
|
-
"prettier": "
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
42
|
+
"prettier": "2.7.1",
|
|
43
|
+
"typescript": "^4.8.4"
|
|
44
|
+
},
|
|
45
|
+
"jest": {
|
|
46
|
+
"rootDir": "src",
|
|
47
|
+
"testEnvironment": "node",
|
|
48
|
+
"testMatch": [
|
|
49
|
+
"<rootDir>/**/*-test.js"
|
|
50
|
+
],
|
|
51
|
+
"testResultsProcessor": "jest-junit",
|
|
52
|
+
"transform": {
|
|
53
|
+
"^.+\\.js$": [
|
|
54
|
+
"babel-jest",
|
|
55
|
+
{
|
|
56
|
+
"rootMode": "upward"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"jest-junit": {
|
|
62
|
+
"outputDirectory": "./reports/junit",
|
|
63
|
+
"outputName": "junit.xml"
|
|
46
64
|
},
|
|
47
65
|
"dependencies": {
|
|
48
66
|
"launchdarkly-eventsource": "1.4.3",
|
|
49
|
-
"launchdarkly-js-sdk-common": "4.0
|
|
67
|
+
"launchdarkly-js-sdk-common": "4.2.0",
|
|
50
68
|
"node-localstorage": "^1.3.1"
|
|
51
69
|
},
|
|
52
70
|
"repository": {
|
package/.babelrc
DELETED
package/jest.config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const version = process.env.npm_package_version;
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
automock: false,
|
|
5
|
-
resetModules: true,
|
|
6
|
-
rootDir: 'src',
|
|
7
|
-
setupFiles: ['./jest.setup.js'],
|
|
8
|
-
testMatch: ['**/__tests__/**/*-test.js'],
|
|
9
|
-
transform: {
|
|
10
|
-
'^.+\\.js$': 'babel-jest',
|
|
11
|
-
},
|
|
12
|
-
globals: {
|
|
13
|
-
VERSION: version,
|
|
14
|
-
},
|
|
15
|
-
};
|
package/src/jest.setup.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// Test environment setup
|