diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index a87226721..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-sudo: required
-
-services:
- - docker
-
-notifications:
- email: false
-
-before_install:
- # Create .splunkrc file with default credentials
- - echo host=localhost >> $HOME/.splunkrc
- - echo username=admin >> $HOME/.splunkrc
- - echo password=changed! >> $HOME/.splunkrc
- # Set SPLUNK_HOME
- - export SPLUNK_HOME="/opt/splunk"
- # Add DOCKER to iptables, 1/10 times this is needed, force 0 exit status
- - sudo iptables -N DOCKER || true
- # Start docker-compose in detached mode
- - docker-compose up -d
- # Health Check (3 minutes)
- - for i in `seq 0 180`; do if docker exec -it splunk /sbin/checkstate.sh &> /dev/null; then break; fi; echo $i; sleep 1; done
-
-language: node_js
-node_js:
- - "10.0"
- - "4.2"
- - "0.12"
-
-env:
- - SPLUNK_VERSION=7.3
- - SPLUNK_VERSION=8.0
-
-before_script:
- node sdkdo hint
-
-# Test script, should return non 0 exit status if a test fails
-script:
- node sdkdo tests
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 64ea0335b..c07a3d9dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,29 @@
# Splunk Enterprise SDK for JavaScript Changelog
+## v1.10.0
+
+### Major changes
+* Dropped support for deprecated request http client.
+* Added support for [needle](https://www.npmjs.com/package/needle) http client library.
+
+### Minor changes
+
+* Added support for Splunk Enterprise 8.2
+* Added support for Node v14.
+* Dropped support for deprecated nodeunit testing library.
+* Added support for [mocha](https://www.npmjs.com/package/mocha) for testing and [chai](https://www.npmjs.com/package/chai) for assertions.
+* Updated `cookie` dependency version to `0.4.1`
+* Updated `elementtree` dependency version to `0.1.7`
+* Updated `browserify` dependency version to `17.0.0`
+* Updated `jshint` dependency version to `2.13.0`
+* Updated `mustache` dependency version to `4.2.0`
+* Updated `readable-stream` dependency version to `3.6.0`
+* Updated `uglify-js` dependency version to `3.13.8`
+* Added support for `dotenv@10.0.0` to declared env variables.
+* Added support for `mochawesome@6.2.2` to generate test report.
+* Fixed the Buffer and new Buffer() deprecation warnings appeared when running the tests.
+* Added support for running single test file and test case. Run `make test_specific` for more info.
+
## v1.9.1
### Minor changes
diff --git a/README.md b/README.md
index 8a8948cea..6932640cc 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
[](https://travis-ci.org/splunk/splunk-sdk-javascript)
# The Splunk Enterprise Software Development Kit for JavaScript
-#### Version 1.9.1
+#### Version 1.10.0
The Splunk Enterprise Software Development Kit (SDK) for JavaScript contains library code and examples designed to enable developers to build applications using the Splunk platform and JavaScript. This SDK supports server-side and client-side JavaScript.
@@ -13,7 +13,7 @@ For more information, see [Splunk Enterprise SDK for JavaScript](https://dev.spl
The Splunk Enterprise SDK for JavaScript was tested with Node.js v8.17.0, v14.
-* Splunk Enterprise 8.2.0 or later, or Splunk Cloud
+* Splunk Enterprise 8.0 or 8.2, or Splunk Cloud
The Splunk Enterprise SDK for JavaScript was tested with Splunk Enterprise 8.0 or 8.2, or Splunk Cloud.
@@ -61,13 +61,13 @@ The following examples show you how to list search jobs using client-side and se
### Client-side code example
This HTML example uses the Splunk Enterprise SDK for JavaScript to list all jobs:
-
+```javascript
+```
### Node.js code example
This example shows how to use the Splunk Enterprise SDK for JavaScript and Node.js to list all jobs:
+```javascript
var splunkjs = require('splunk-sdk');
- var service = new splunkjs.Service({username: "admin", password: "changeme"});
+ var service = new splunkjs.Service({username: "admin", password: "changed!"});
service.login(function(err, success) {
if (err) {
throw err;
@@ -104,6 +106,7 @@ This example shows how to use the Splunk Enterprise SDK for JavaScript and Node.
}
});
});
+```
## SDK examples
@@ -125,7 +128,7 @@ To use this convenience file, create a text file with the following format:
# Splunk Enterprise username
username=admin
# Splunk Enterprise password
- password=changeme
+ password=changed!
# Access scheme (default: https)
scheme=https
# Your version of Splunk Enterprise
@@ -209,6 +212,10 @@ To run the HTTP and the Async tests, enter:
node sdkdo tests http,async
+To run tests containing a particular string, enter:
+
+ node sdkdo tests --grep "While success"
+
To run the browser tests, enter:
node sdkdo tests-browser
@@ -217,9 +224,13 @@ To run all unit tests without log messages, enter:
node sdkdo tests --quiet
-To run all the tests and generate JUnit compatible XML in **splunk-sdk-javascript/test_logs/junit_test_results.xml**, enter:
+To run all the tests and generate test report in **splunk-sdk-javascript/mochawesome-report/mochawesome.html**, enter:
+
+ node sdkdo tests --reporter mochawesome
+
+To get more info to run tests, enter:
- node sdkdo tests --reporter junit
+ make test_specific
## Repository
diff --git a/bin/cli.js b/bin/cli.js
index 7cc955948..bd502b741 100755
--- a/bin/cli.js
+++ b/bin/cli.js
@@ -16,16 +16,16 @@
var utils = require('../lib/utils');
var Async = require('../lib/async');
var staticResource = require('../contrib/static-resource/index');
- var dox = require('../contrib/dox/dox');
- var doc_builder = require('../contrib/dox/doc_builder');
- var program = require('../contrib/commander');
- var spawn = require('child_process').spawn;
- var path = require('path');
- var fs = require('fs');
- var browserify = require('browserify');
- var http = require('http');
- var url = require('url');
- var needle = require('needle');
+ var dox = require('../contrib/dox/dox');
+ var doc_builder = require('../contrib/dox/doc_builder');
+ var program = require('../contrib/commander');
+ var spawn = require('child_process').spawn;
+ var path = require('path');
+ var fs = require('fs');
+ var browserify = require('browserify');
+ var http = require('http');
+ var url = require('url');
+ var needle = require('needle');
/**
@@ -830,7 +830,7 @@
.option('--port ', 'Splunk port')
.option('--version ', 'Splunk version')
.option('--namespace ', 'Splunk namespace (in the form of owner:app)')
- .option('--reporter ', '(optional) How to report results, currently "junit" is a valid reporter.')
+ .option('--reporter ', '(optional) How to report results')
.option('--ui ', 'Specify user interface')
.option('--timeout ', 'Specify test timeout threshold (in milliseconds)')
.option('--grep ', 'Only run tests matching this string or regexp')
diff --git a/examples/modularinputs/github_commits/bin/app/github_commits.js b/examples/modularinputs/github_commits/bin/app/github_commits.js
index b6a4de752..d9a387c8e 100644
--- a/examples/modularinputs/github_commits/bin/app/github_commits.js
+++ b/examples/modularinputs/github_commits/bin/app/github_commits.js
@@ -12,21 +12,21 @@
// License for the specific language governing permissions and limitations
// under the License.
-(function() {
- var fs = require("fs");
- var path = require("path");
- var GithubAPI = require("github");
- var splunkjs = require("splunk-sdk");
- var Async = splunkjs.Async;
- var ModularInputs = splunkjs.ModularInputs;
- var Logger = ModularInputs.Logger;
- var Event = ModularInputs.Event;
- var Scheme = ModularInputs.Scheme;
- var Argument = ModularInputs.Argument;
- var utils = ModularInputs.utils;
+(function () {
+ var fs = require("fs");
+ var path = require("path");
+ var GithubAPI = require("github");
+ var splunkjs = require("splunk-sdk");
+ var Async = splunkjs.Async;
+ var ModularInputs = splunkjs.ModularInputs;
+ var Logger = ModularInputs.Logger;
+ var Event = ModularInputs.Event;
+ var Scheme = ModularInputs.Scheme;
+ var Argument = ModularInputs.Argument;
+ var utils = ModularInputs.utils;
// The version number should be updated every time a new version of the JavaScript SDK is released.
- var SDK_UA_STRING = "splunk-sdk-javascript/1.9.1";
+ var SDK_UA_STRING = "splunk-sdk-javascript/1.10.0";
// Create easy to read date format.
function getDisplayDate(date) {
@@ -47,7 +47,7 @@
" - " + hours + ":" + mins + " " + (date.getUTCHours() < 12 ? "AM" : "PM");
}
- exports.getScheme = function() {
+ exports.getScheme = function () {
var scheme = new Scheme("Github Commits");
scheme.description = "Streams events of commits in the specified Github repository (must be public, unless setting a token).";
@@ -81,12 +81,12 @@
return scheme;
};
- exports.validateInput = function(definition, done) {
+ exports.validateInput = function (definition, done) {
var owner = definition.parameters.owner;
var repository = definition.parameters.repository;
var token = definition.parameters.token;
- var Github = new GithubAPI({version: "3.0.0"});
+ var Github = new GithubAPI({ version: "3.0.0" });
try {
// Authenticate with the access token if it was provided.
@@ -98,7 +98,7 @@
}
Github.repos.getCommits({
- headers: {"User-Agent": SDK_UA_STRING},
+ headers: { "User-Agent": SDK_UA_STRING },
user: owner,
repo: repository,
per_page: 1, // The minimum per page value supported by the Github API.
@@ -127,17 +127,17 @@
}
};
- exports.streamEvents = function(name, singleInput, eventWriter, done) {
+ exports.streamEvents = function (name, singleInput, eventWriter, done) {
// Get the checkpoint directory out of the modular input's metadata.
var checkpointDir = this._inputDefinition.metadata["checkpoint_dir"];
var owner = singleInput.owner;
var repository = singleInput.repository;
- var token = singleInput.token;
+ var token = singleInput.token;
var alreadyIndexed = 0;
- var Github = new GithubAPI({version: "3.0.0"});
+ var Github = new GithubAPI({ version: "3.0.0" });
if (token && token.length > 0) {
Github.authenticate({
@@ -150,13 +150,13 @@
var working = true;
Async.whilst(
- function() {
+ function () {
return working;
},
- function(callback) {
+ function (callback) {
try {
Github.repos.getCommits({
- headers: {"User-Agent": SDK_UA_STRING},
+ headers: { "User-Agent": SDK_UA_STRING },
user: owner,
repo: repository,
per_page: 100, // The maximum per page value supported by the Github API.
@@ -172,7 +172,7 @@
working = false;
}
- var checkpointFilePath = path.join(checkpointDir, owner + " " + repository + ".txt");
+ var checkpointFilePath = path.join(checkpointDir, owner + " " + repository + ".txt");
var checkpointFileNewContents = "";
var errorFound = false;
@@ -248,7 +248,7 @@
callback(e);
}
},
- function(err) {
+ function (err) {
// We're done streaming.
done(err);
}
diff --git a/package.json b/package.json
index 180d16d5a..9c010eda1 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "splunk-sdk",
- "version": "1.9.1",
+ "version": "1.10.0",
"description": "SDK for usage with the Splunk REST API",
"homepage": "http://dev.splunk.com",
"main": "index.js",
@@ -21,7 +21,7 @@
"javascript"
],
"scripts": {
- "test": "mocha tests_spike/tests.js -t 50000 --allow-uncaught --exit"
+ "test": "nyc mocha tests/tests.js -t 50000 --allow-uncaught --exit --reporter mochawesome"
},
"dependencies": {
"cookie": "0.4.1",
@@ -34,6 +34,7 @@
"chai": "^4.3.4",
"jshint": "2.13.0",
"mocha": "7.2.0",
+ "mochawesome": "^6.2.2",
"mustache": "4.2.0",
"nyc": "^15.1.0",
"readable-stream": "3.6.0",