There are few mocha tests which needs to be migrated to Jest.
Following test cases should be converted to jest.
โฐโ yarn test:mocha โโฏ
yarn run v1.22.10
$ node scripts/mocha
dev/File
constructor
โ throws if path is not a string
#getRelativePath()
โ returns the path relative to the repo root
#isJs()
โ returns true if extension is .js
โ returns false if extension is .xml
โ returns false if extension is .css
โ returns false if extension is .html
โ returns false if file has no extension
#getRelativeParentDirs()
โ returns the parents of a file, stopping at the repo root, in descending order
#toString()
โ returns the relativePath
#toJSON()
โ returns the relativePath
All configs should use a single version of Node
โ should compare .node-version and .nvmrc
โ should compare .node-version and engines.node from package.json
getUrl
โ should convert to a url
โ should convert to a url with port
โ should convert to a secure hashed url
tasks/lib/licenses
assertLicensesValid()
โ returns undefined when package has valid license
โ throw an error when the packages license is invalid
โ throws an error when the package has no licenses
โ includes the relative path to packages in error message
dev/mocha/junit report generation
โ reports on failed setup hooks
unset(obj, key)
invalid input
โ should do nothing if not given an object
โ should do nothing if not given a key
โ should do nothing if given an empty string as a key
shallow removal
โ should remove the param using a string key
โ should remove the param using an array key
deep removal
โ should remove the param using a string key
โ should remove the param using an array key
recursive removal
โ should clear object if only value is removed
โ should clear object if no props are left
โ should remove deep property, then clear the object
plugins/console
#getOpenSearchProxyConfig
โ sets timeout
โ uses https.Agent when url's protocol is https
โ uses http.Agent when url's protocol is http
ssl
โ sets rejectUnauthorized to false when verificationMode is none
โ sets rejectUnauthorized to true when verificationMode is certificate
โ sets checkServerIdentity to not check hostname when verificationMode is certificate
โ sets rejectUnauthorized to true when verificationMode is full
โ doesn't set checkServerIdentity when verificationMode is full
โ sets ca when certificateAuthorities are specified
when alwaysPresentCertificate is false
โ doesn't set cert and key when certificate and key paths are specified
โ doesn't set passphrase when certificate, key and keyPassphrase are specified
when alwaysPresentCertificate is true
โ sets cert and key when certificate and key are specified
โ sets passphrase when certificate, key and keyPassphrase are specified
โ doesn't set cert when only certificate path is specified
โ doesn't set key when only key path is specified
ProxyConfig
constructor
โ uses ca to create sslAgent
โ uses cert, and key to create sslAgent
โ uses ca, cert, and key to create sslAgent
#getForParsedUri
parsed url does not match
โ returns {}
parsed url does match
โ assigns timeout value
โ assigns ssl.verify to rejectUnauthorized
uri us http
ca is set
โ creates but does not output the agent
cert is set
โ creates but does not output the agent
key is set
โ creates but does not output the agent
cert + key are set
โ creates but does not output the agent
uri us https
ca is set
โ creates and outputs the agent
cert is set
โ creates and outputs the agent
key is set
โ creates and outputs the agent
cert + key are set
โ creates and outputs the agent
ProxyConfigCollection
http://localhost:5601
โ defaults to the first matching timeout
https://localhost:5601/.opensearch_dashboards
โ defaults to the first matching timeout
http://localhost:5602
โ defaults to the first matching timeout
https://localhost:5602
โ defaults to the first matching timeout
http://localhost:5603
โ defaults to the first matching timeout
https://localhost:5603
โ defaults to the first matching timeout
https://localhost:5601/index
โ defaults to the first matching timeout
http://localhost:5601/index
โ defaults to the first matching timeout
https://localhost:5601/index/type
โ defaults to the first matching timeout
http://notlocalhost
โ defaults to the first matching timeout
collection with ssl config and root level verify:false
โ verifies for config that produces ssl agent
โ disabled verification for * config
#set_headers
โ throws if not given an object as the first argument
โ throws if not given an object as the second argument
โ returns a new object
โ returns object with newHeaders merged with originalHeaders
โ returns object where newHeaders takes precedence for any matching keys
WildcardMatcher
pattern = *
โ matches http
โ matches https
โ matches nothing
โ does not match /
โ matches localhost
โ matches a path
defaultValue = /
โ matches /
pattern = http
โ matches http
โ does not match https
โ does not match nothing
โ does not match localhost
โ does not match a path
pattern = 560{1..9}
โ does not match http
โ does not matches 5600
โ matches 5601
โ matches 5602
โ matches 5603
โ matches 5604
โ matches 5605
โ matches 5606
โ matches 5607
โ matches 5608
โ matches 5609
โ does not matches 5610
dateMath
errors
โ should return undefined if passed something falsy
โ should return undefined if I pass an operator besides [+-/]
โ should return undefined if I pass a unit besidess,m,h,d,w,M,y,ms
โ should return undefined if rounding unit is not 1
โ should not go into an infinite loop when missing a unit
forceNow
โ should throw an Error if passed a string
โ should throw an Error if passed a moment
โ should throw an Error if passed an invalid date
objects and strings
โ should return the same moment if passed a moment
โ should return a moment if passed a date
โ should return a moment if passed an ISO8601 string
โ should return the current time when parsing now
โ should use the forceNow parameter when parsing now
subtraction
โ should return 5s ago
โ should return 5s before 2014-01-01T06:06:06.666Z
โ should return 5s before forceNow
โ should return 5m ago
โ should return 5m before 2014-01-01T06:06:06.666Z
โ should return 5m before forceNow
โ should return 5h ago
โ should return 5h before 2014-01-01T06:06:06.666Z
โ should return 5h before forceNow
โ should return 5d ago
โ should return 5d before 2014-01-01T06:06:06.666Z
โ should return 5d before forceNow
โ should return 5w ago
โ should return 5w before 2014-01-01T06:06:06.666Z
โ should return 5w before forceNow
โ should return 5M ago
โ should return 5M before 2014-01-01T06:06:06.666Z
โ should return 5M before forceNow
โ should return 5y ago
โ should return 5y before 2014-01-01T06:06:06.666Z
โ should return 5y before forceNow
โ should return 5ms ago
โ should return 5ms before 2014-01-01T06:06:06.666Z
โ should return 5ms before forceNow
โ should return 12s ago
โ should return 12s before 2014-01-01T06:06:06.666Z
โ should return 12s before forceNow
โ should return 12m ago
โ should return 12m before 2014-01-01T06:06:06.666Z
โ should return 12m before forceNow
โ should return 12h ago
โ should return 12h before 2014-01-01T06:06:06.666Z
โ should return 12h before forceNow
โ should return 12d ago
โ should return 12d before 2014-01-01T06:06:06.666Z
โ should return 12d before forceNow
โ should return 12w ago
โ should return 12w before 2014-01-01T06:06:06.666Z
โ should return 12w before forceNow
โ should return 12M ago
โ should return 12M before 2014-01-01T06:06:06.666Z
โ should return 12M before forceNow
โ should return 12y ago
โ should return 12y before 2014-01-01T06:06:06.666Z
โ should return 12y before forceNow
โ should return 12ms ago
โ should return 12ms before 2014-01-01T06:06:06.666Z
โ should return 12ms before forceNow
โ should return 247s ago
โ should return 247s before 2014-01-01T06:06:06.666Z
โ should return 247s before forceNow
โ should return 247m ago
โ should return 247m before 2014-01-01T06:06:06.666Z
โ should return 247m before forceNow
โ should return 247h ago
โ should return 247h before 2014-01-01T06:06:06.666Z
โ should return 247h before forceNow
โ should return 247d ago
โ should return 247d before 2014-01-01T06:06:06.666Z
โ should return 247d before forceNow
โ should return 247w ago
โ should return 247w before 2014-01-01T06:06:06.666Z
โ should return 247w before forceNow
โ should return 247M ago
โ should return 247M before 2014-01-01T06:06:06.666Z
โ should return 247M before forceNow
โ should return 247y ago
โ should return 247y before 2014-01-01T06:06:06.666Z
โ should return 247y before forceNow
โ should return 247ms ago
โ should return 247ms before 2014-01-01T06:06:06.666Z
โ should return 247ms before forceNow
addition
โ should return 5s from now
โ should return 5s after 2014-01-01T06:06:06.666Z
โ should return 5s after forceNow
โ should return 5m from now
โ should return 5m after 2014-01-01T06:06:06.666Z
โ should return 5m after forceNow
โ should return 5h from now
โ should return 5h after 2014-01-01T06:06:06.666Z
โ should return 5h after forceNow
โ should return 5d from now
โ should return 5d after 2014-01-01T06:06:06.666Z
โ should return 5d after forceNow
โ should return 5w from now
โ should return 5w after 2014-01-01T06:06:06.666Z
โ should return 5w after forceNow
โ should return 5M from now
โ should return 5M after 2014-01-01T06:06:06.666Z
โ should return 5M after forceNow
โ should return 5y from now
โ should return 5y after 2014-01-01T06:06:06.666Z
โ should return 5y after forceNow
โ should return 5ms from now
โ should return 5ms after 2014-01-01T06:06:06.666Z
โ should return 5ms after forceNow
โ should return 12s from now
โ should return 12s after 2014-01-01T06:06:06.666Z
โ should return 12s after forceNow
โ should return 12m from now
โ should return 12m after 2014-01-01T06:06:06.666Z
โ should return 12m after forceNow
โ should return 12h from now
โ should return 12h after 2014-01-01T06:06:06.666Z
โ should return 12h after forceNow
โ should return 12d from now
โ should return 12d after 2014-01-01T06:06:06.666Z
โ should return 12d after forceNow
โ should return 12w from now
โ should return 12w after 2014-01-01T06:06:06.666Z
โ should return 12w after forceNow
โ should return 12M from now
โ should return 12M after 2014-01-01T06:06:06.666Z
โ should return 12M after forceNow
โ should return 12y from now
โ should return 12y after 2014-01-01T06:06:06.666Z
โ should return 12y after forceNow
โ should return 12ms from now
โ should return 12ms after 2014-01-01T06:06:06.666Z
โ should return 12ms after forceNow
โ should return 247s from now
โ should return 247s after 2014-01-01T06:06:06.666Z
โ should return 247s after forceNow
โ should return 247m from now
โ should return 247m after 2014-01-01T06:06:06.666Z
โ should return 247m after forceNow
โ should return 247h from now
โ should return 247h after 2014-01-01T06:06:06.666Z
โ should return 247h after forceNow
โ should return 247d from now
โ should return 247d after 2014-01-01T06:06:06.666Z
โ should return 247d after forceNow
โ should return 247w from now
โ should return 247w after 2014-01-01T06:06:06.666Z
โ should return 247w after forceNow
โ should return 247M from now
โ should return 247M after 2014-01-01T06:06:06.666Z
โ should return 247M after forceNow
โ should return 247y from now
โ should return 247y after 2014-01-01T06:06:06.666Z
โ should return 247y after forceNow
โ should return 247ms from now
โ should return 247ms after 2014-01-01T06:06:06.666Z
โ should return 247ms after forceNow
rounding
โ should round now to the beginning of the s
โ should round now to the beginning of forceNow's s
โ should round now to the end of the s
โ should round now to the end of forceNow's s
โ should round now to the beginning of the m
โ should round now to the beginning of forceNow's m
โ should round now to the end of the m
โ should round now to the end of forceNow's m
โ should round now to the beginning of the h
โ should round now to the beginning of forceNow's h
โ should round now to the end of the h
โ should round now to the end of forceNow's h
โ should round now to the beginning of the d
โ should round now to the beginning of forceNow's d
โ should round now to the end of the d
โ should round now to the end of forceNow's d
โ should round now to the beginning of the w
โ should round now to the beginning of forceNow's w
โ should round now to the end of the w
โ should round now to the end of forceNow's w
โ should round now to the beginning of the M
โ should round now to the beginning of forceNow's M
โ should round now to the end of the M
โ should round now to the end of forceNow's M
โ should round now to the beginning of the y
โ should round now to the beginning of forceNow's y
โ should round now to the end of the y
โ should round now to the end of forceNow's y
โ should round now to the beginning of the ms
โ should round now to the beginning of forceNow's ms
โ should round now to the end of the ms
โ should round now to the end of forceNow's ms
math and rounding
โ should round to the nearest second with 0 value
โ should subtract 17s, rounded to the nearest second
โ should add 555ms, rounded to the nearest millisecond
โ should subtract 555ms, rounded to the nearest second
โ should round weeks to Sunday by default
โ should round weeks based on the passed moment locale start of week setting
โ should round up weeks based on the passed moment locale start of week setting
โ should round relative to forceNow
โ should parse long expressions
used momentjs instance
โ should use the default moment instance if parameter not specified
โ should not use default moment instance if parameter is specified
โ should work with multiple different instances
โ should use global instance after passing an instance
units
โ should have units descending for unitsDesc
โ should have units ascending for unitsAsc
testSubjSelector()
โ converts subjectSelectors to cssSelectors
@osd/eslint/disallow-license-headers
valid
โ /* license */
console.log('foo')
โ // license
console.log('foo')
invalid
โ console.log('foo')
โ console.log('foo')
โ console.log('foo')
โ console.log('foo')
โ console.log('foo')
@osd/eslint/no-restricted-paths
valid
โ import a from "../client/a.js"
โ const a = require("../client/a.js")
โ import b from "../server/b.js"
โ notrequire("../server/b.js")
โ notrequire("../server/b.js")
โ require("../server/b.js")
โ import b from "../server/b.js"
โ require("os")
โ const d = require("./deep/d.js")
โ const d = require("./deep/d.js")
โ import { X } from "./index_patterns"
invalid
โ export { b } from "../server/b.js"
โ import b from "../server/b.js"
โ import a from "../client/a"
import c from "./c"
โ const b = require("../server/b.js")
โ const b = require("../server/b.js")
โ const d = require("./deep/d.js")
โ const d = require("src/core/server/saved_objects")
โ const d = require("ui/kfetch")
โ const d = require("ui/kfetch/public/index")
โ import { X } from "./index_patterns"
@osd/eslint/require-license-header
valid
โ /* license */
console.log('foo')
โ // license
console.log('foo')
invalid
โ console.log('foo')
โ console.log('foo')
โ console.log('foo')
โ console.log('foo')
โ console.log('foo')
โ console.log('foo')
โ
/* license */
console.log('foo')
โ /* not license */
/* license */
console.log('foo')
opensearchArchiver: Stats
#skippedIndex(index)
โ marks the index as skipped
โ logs that the index was skipped
#deletedIndex(index)
โ marks the index as deleted
โ logs that the index was deleted
#createdIndex(index, [metadata])
โ marks the index as created
โ logs that the index was created
with metadata
โ debug-logs each key from the metadata
without metadata
โ no debug logging
#archivedIndex(index, [metadata])
โ marks the index as archived
โ logs that the index was archived
with metadata
โ debug-logs each key from the metadata
without metadata
โ no debug logging
#indexedDoc(index)
โ increases the docs.indexed count for the index
#archivedDoc(index)
โ increases the docs.archived count for the index
#toJSON()
โ returns the stats for all indexes
โ returns a deep clone of the stats
#forEachIndex(fn)
โ iterates a clone of the index stats
opensearchArchiver createFormatArchiveStreams
{ gzip: false }
โ returns an array of streams
โ streams consume js values and produces buffers
โ product is pretty-printed JSON separated by two newlines
{ gzip: true }
โ returns an array of streams
โ streams consume js values and produces buffers
โ output can be gunzipped
defaults
โ product is not gzipped
opensearchArchiver createParseArchiveStreams
{ gzip: false }
โ returns an array of streams
streams
โ consume buffers of valid JSON
โ consume buffers of valid JSON separated by two newlines
โ provides each JSON object as soon as it is parsed
stream errors
โ stops when any document contains invalid json
{ gzip: true }
โ returns an array of streams
โ parses blank files
streams
โ consumes gzipped buffers of valid JSON
โ parses valid gzipped JSON strings separated by two newlines
stream errors
โ stops when the input is not valid gzip archive
defaults
โ does not try to gunzip the content
opensearchArchiver: createGenerateDocRecordsStream()
โ scolls 1000 documents at a time
โ uses a 1 minute scroll timeout
โ consumes index names and scrolls completely before continuing
opensearchArchiver: createIndexDocRecordsStream()
โ consumes doc records and sends to `_bulk` api
โ consumes multiple doc records and sends to `_bulk` api together
โ waits until request is complete before sending more
โ sends a maximum of 300 documents at a time
โ emits an error if any request fails
opensearchArchiver: createCreateIndexStream()
defaults
โ deletes existing indices, creates all
โ deletes existing aliases, creates all
โ passes through "hit" records
โ creates aliases
โ passes through records with unknown types
โ passes through non-record values
skipExisting = true
โ ignores preexisting indexes
โ filters documents for skipped indices
opensearchArchiver: createDeleteIndexStream()
โ deletes the index without checking if it exists
โ reports the delete when the index existed
opensearchArchiver: createGenerateIndexRecordsStream()
โ consumes index names and queries for the mapping of each
โ filters index metadata from settings
โ produces one index record for each index name it receives
โ understands aliases
opensearchArchiver: createFilterRecordsStream()
โ consumes any value
โ produces record values that have a matching type
basic config file with a single app and test
โ runs and prints expected output
failure hooks
โ runs and prints expected output
readConfigFile()
โ reads config from a file, returns an instance of Config class
โ merges setting overrides into log
โ supports loading config files from within config files
โ throws if settings are invalid
408 passing (6s)
Done in 8.62s.