mirror of
https://github.com/github/codeql-action.git
synced 2025-12-21 14:50:08 +08:00
Compare commits
53 Commits
codeql-bun
...
v3.26.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
461ef6c76d | ||
|
|
00b1146c45 | ||
|
|
f861efb2b3 | ||
|
|
426821d803 | ||
|
|
07e8133971 | ||
|
|
e0a151e64e | ||
|
|
6b0ce4e274 | ||
|
|
07fd497921 | ||
|
|
2cddcb1990 | ||
|
|
6225a95822 | ||
|
|
9580b7e6d5 | ||
|
|
b436a5fca7 | ||
|
|
7a2719db05 | ||
|
|
65e62c7ee1 | ||
|
|
ef130516b1 | ||
|
|
132b18f2f0 | ||
|
|
edf2ee9ac8 | ||
|
|
74e989e9a5 | ||
|
|
bff5ba0a53 | ||
|
|
ed5036d7fa | ||
|
|
f9ae1f1149 | ||
|
|
b78ab6c660 | ||
|
|
a7b66734cc | ||
|
|
323f5ef653 | ||
|
|
a41f61f2b3 | ||
|
|
7513a95cdc | ||
|
|
574aaa5812 | ||
|
|
3b3a4a69cf | ||
|
|
799e477cb3 | ||
|
|
c38521e711 | ||
|
|
65efd221e9 | ||
|
|
294a9d9291 | ||
|
|
00b3604ce7 | ||
|
|
64431c66d0 | ||
|
|
e0e2d7557d | ||
|
|
cb28816228 | ||
|
|
498c508900 | ||
|
|
a1a585f2ab | ||
|
|
34666c10b6 | ||
|
|
6e24973d7a | ||
|
|
d0a3cf2152 | ||
|
|
78d398ebc6 | ||
|
|
782de45248 | ||
|
|
642bbfc83a | ||
|
|
213bf3678c | ||
|
|
dd7307d603 | ||
|
|
bbd7c801a0 | ||
|
|
80d7a6c8d4 | ||
|
|
6989ba7bd2 | ||
|
|
1afca056e3 | ||
|
|
6cc325341d | ||
|
|
bbd9c4a63d | ||
|
|
d061f2cdd0 |
44
.github/workflows/__go-custom-queries.yml
generated
vendored
44
.github/workflows/__go-custom-queries.yml
generated
vendored
@@ -28,53 +28,9 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-12
|
||||
version: stable-v2.13.5
|
||||
- os: windows-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-12
|
||||
version: stable-v2.14.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.15.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.15.5
|
||||
- os: windows-latest
|
||||
version: stable-v2.15.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.16.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.16.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.16.6
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.17.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.17.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.17.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
version: default
|
||||
- os: windows-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: linked
|
||||
- os: macos-latest
|
||||
version: linked
|
||||
- os: windows-latest
|
||||
version: linked
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
- os: macos-latest
|
||||
version: nightly-latest
|
||||
- os: windows-latest
|
||||
version: nightly-latest
|
||||
name: 'Go: Custom queries'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
44
.github/workflows/__remote-config.yml
generated
vendored
44
.github/workflows/__remote-config.yml
generated
vendored
@@ -28,53 +28,9 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-12
|
||||
version: stable-v2.13.5
|
||||
- os: windows-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-12
|
||||
version: stable-v2.14.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.15.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.15.5
|
||||
- os: windows-latest
|
||||
version: stable-v2.15.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.16.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.16.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.16.6
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.17.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.17.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.17.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
version: default
|
||||
- os: windows-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: linked
|
||||
- os: macos-latest
|
||||
version: linked
|
||||
- os: windows-latest
|
||||
version: linked
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
- os: macos-latest
|
||||
version: nightly-latest
|
||||
- os: windows-latest
|
||||
version: nightly-latest
|
||||
name: Remote config file
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
12
.github/workflows/__unset-environment.yml
generated
vendored
12
.github/workflows/__unset-environment.yml
generated
vendored
@@ -27,18 +27,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.15.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.16.6
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.17.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: linked
|
||||
- os: ubuntu-latest
|
||||
|
||||
2
.github/workflows/pr-checks.yml
vendored
2
.github/workflows/pr-checks.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
||||
- name: Upload sarif
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
# Only upload SARIF for the latest version of Node.js
|
||||
if: "always() && matrix.node-types-version == 'current'"
|
||||
if: "!cancelled() && matrix.node-types-version == 'current' && !startsWith(github.head_ref, 'dependabot/')"
|
||||
with:
|
||||
sarif_file: eslint.sarif
|
||||
category: eslint
|
||||
|
||||
3
.github/workflows/rebuild.yml
vendored
3
.github/workflows/rebuild.yml
vendored
@@ -69,7 +69,8 @@ jobs:
|
||||
if [ ! -z "$(git status --porcelain)" ]; then
|
||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git commit -am "Rebuild"
|
||||
git add --all
|
||||
git commit -m "Rebuild"
|
||||
git push origin "HEAD:$BRANCH"
|
||||
echo "Pushed a commit to rebuild the Action." \
|
||||
"Please mark the PR as ready for review to trigger PR checks." |
|
||||
|
||||
4
.github/workflows/update-release-branch.yml
vendored
4
.github/workflows/update-release-branch.yml
vendored
@@ -116,7 +116,7 @@ jobs:
|
||||
TARGET_BRANCH: ${{ matrix.target_branch }}
|
||||
steps:
|
||||
- name: Generate token
|
||||
uses: actions/create-github-app-token@31c86eb3b33c9b601a1f60f98dcbfd1d70f379b4
|
||||
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ vars.AUTOMATION_APP_ID }}
|
||||
@@ -134,7 +134,7 @@ jobs:
|
||||
echo SOURCE_BRANCH=${SOURCE_BRANCH}
|
||||
echo TARGET_BRANCH=${TARGET_BRANCH}
|
||||
python .github/update-release-branch.py \
|
||||
--github-token ${GITHUB_TOKEN} \
|
||||
--github-token ${{ secrets.GITHUB_TOKEN }} \
|
||||
--repository-nwo ${{ github.repository }} \
|
||||
--source-branch ${SOURCE_BRANCH} \
|
||||
--target-branch ${TARGET_BRANCH} \
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,3 +7,5 @@ node_modules/.cache/
|
||||
.DS_Store
|
||||
# eslint sarif report
|
||||
eslint.sarif
|
||||
# for local incremental compilation
|
||||
tsconfig.tsbuildinfo
|
||||
@@ -4,10 +4,14 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
|
||||
|
||||
Note that the only difference between `v2` and `v3` of the CodeQL Action is the node version they support, with `v3` running on node 20 while we continue to release `v2` to support running on node 16. For example `3.22.11` was the first `v3` release and is functionally identical to `2.22.11`. This approach ensures an easy way to track exactly which features are included in different versions, indicated by the minor and patch version numbers.
|
||||
|
||||
## [UNRELEASED]
|
||||
## 3.26.9 - 24 Sep 2024
|
||||
|
||||
No user facing changes.
|
||||
|
||||
## 3.26.8 - 19 Sep 2024
|
||||
|
||||
- Update default CodeQL bundle version to 2.19.0. [#2483](https://github.com/github/codeql-action/pull/2483)
|
||||
|
||||
## 3.26.7 - 13 Sep 2024
|
||||
|
||||
- Update default CodeQL bundle version to 2.18.4. [#2471](https://github.com/github/codeql-action/pull/2471)
|
||||
|
||||
6
lib/analyze-action-post.js
generated
6
lib/analyze-action-post.js
generated
@@ -31,17 +31,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
||||
const environment_1 = require("./environment");
|
||||
const logging_1 = require("./logging");
|
||||
const util_1 = require("./util");
|
||||
async function runWrapper() {
|
||||
try {
|
||||
const logger = (0, logging_1.getActionsLogger)();
|
||||
// Upload SARIF artifacts if we determine that this is a first-party analysis run.
|
||||
// For third-party runs, this artifact will be uploaded in the `upload-sarif-post` step.
|
||||
if (process.env[environment_1.EnvVar.INIT_ACTION_HAS_RUN] === "true") {
|
||||
await debugArtifacts.uploadCombinedSarifArtifacts();
|
||||
await (0, logging_1.withGroup)("Uploading combined SARIF debug artifact", () => debugArtifacts.uploadCombinedSarifArtifacts(logger));
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`analyze post-action step failed: ${(0, util_1.wrapError)(error).message}`);
|
||||
core.setFailed(`analyze post-action step failed: ${(0, util_1.getErrorMessage)(error)}`);
|
||||
}
|
||||
}
|
||||
void runWrapper();
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"analyze-action-post.js","sourceRoot":"","sources":["../src/analyze-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,kEAAoD;AACpD,+CAAuC;AACvC,iCAAmC;AAEnC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,kFAAkF;QAClF,wFAAwF;QACxF,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAM,CAAC,mBAAmB,CAAC,KAAK,MAAM,EAAE,CAAC;YACvD,MAAM,cAAc,CAAC,4BAA4B,EAAE,CAAC;QACtD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,oCAAoC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
{"version":3,"file":"analyze-action-post.js","sourceRoot":"","sources":["../src/analyze-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,kEAAoD;AACpD,+CAAuC;AACvC,uCAAwD;AACxD,iCAAyC;AAEzC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;QAElC,kFAAkF;QAClF,wFAAwF;QACxF,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAM,CAAC,mBAAmB,CAAC,KAAK,MAAM,EAAE,CAAC;YACvD,MAAM,IAAA,mBAAS,EAAC,yCAAyC,EAAE,GAAG,EAAE,CAC9D,cAAc,CAAC,4BAA4B,CAAC,MAAM,CAAC,CACpD,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,oCAAoC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CAC7D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
2
lib/analyze-action.js
generated
2
lib/analyze-action.js
generated
@@ -245,7 +245,7 @@ async function runWrapper() {
|
||||
await exports.runPromise;
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`analyze action failed: ${util.wrapError(error).message}`);
|
||||
core.setFailed(`analyze action failed: ${util.getErrorMessage(error)}`);
|
||||
}
|
||||
await util.checkForTimeout();
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
lib/analyze.js
generated
2
lib/analyze.js
generated
@@ -186,7 +186,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||
}
|
||||
catch (e) {
|
||||
statusReport.analyze_failure_language = language;
|
||||
throw new CodeQLAnalysisError(statusReport, `Error running analysis for ${language}: ${util.wrapError(e).message}`, util.wrapError(e));
|
||||
throw new CodeQLAnalysisError(statusReport, `Error running analysis for ${language}: ${util.getErrorMessage(e)}`, util.wrapError(e));
|
||||
}
|
||||
}
|
||||
return statusReport;
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
lib/autobuild-action.js
generated
2
lib/autobuild-action.js
generated
@@ -96,7 +96,7 @@ async function runWrapper() {
|
||||
await run();
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`autobuild action failed. ${(0, util_1.wrapError)(error).message}`);
|
||||
core.setFailed(`autobuild action failed. ${(0, util_1.getErrorMessage)(error)}`);
|
||||
}
|
||||
}
|
||||
void runWrapper();
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AAC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O,cAAc,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,IAAA,gBAAS,EAAC,cAAc,CAAC,CAAC;QACxC,IAAI,CAAC,SAAS,CACZ,kIAAkI,KAAK,CAAC,OAAO,EAAE,CAClJ,CAAC;QACF,MAAM,yBAAyB,CAC7B,MAAM,EACN,MAAM,EACN,SAAS,EACT,SAAS,IAAI,EAAE,EACf,eAAe,EACf,KAAK,CACN,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,CAAC,cAAc,CAAC,oBAAM,CAAC,mCAAmC,EAAE,MAAM,CAAC,CAAC;IAExE,MAAM,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CAAC,4BAA4B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,qCAAqC;AACrC,iDAAmD;AACnD,+CAAuC;AAEvC,uCAAqD;AACrD,mDAMyB;AACzB,mDAAuD;AACvD,iCAOgB;AAShB,KAAK,UAAU,yBAAyB,CACtC,MAA0B,EAC1B,MAAc,EACd,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;IAEb,IAAA,4BAAqB,EAAC,IAAA,+BAAgB,GAAE,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAA,gCAAgB,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC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IAExE,MAAM,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CAAC,4BAA4B,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
7
lib/codeql.js
generated
7
lib/codeql.js
generated
@@ -142,7 +142,7 @@ async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliV
|
||||
};
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Unable to download and extract CodeQL CLI: ${(0, util_1.wrapError)(e).message}`);
|
||||
throw new Error(`Unable to download and extract CodeQL CLI: ${(0, util_1.getErrorMessage)(e)}`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -359,10 +359,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
const prefix = "We were unable to automatically build your code. " +
|
||||
"Please change the build mode for this language to manual and specify build steps " +
|
||||
`for your project. See ${doc_url_1.DocUrl.AUTOMATIC_BUILD_FAILED} for more information.`;
|
||||
const ErrorConstructor = e instanceof util.ConfigurationError
|
||||
? util.ConfigurationError
|
||||
: Error;
|
||||
throw new ErrorConstructor(`${prefix} ${util.wrapError(e).message}`);
|
||||
throw new util.ConfigurationError(`${prefix} ${(0, util_1.getErrorMessage)(e)}`);
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
|
||||
File diff suppressed because one or more lines are too long
117
lib/debug-artifacts.js
generated
117
lib/debug-artifacts.js
generated
@@ -26,9 +26,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sanitizeArifactName = sanitizeArifactName;
|
||||
exports.sanitizeArtifactName = sanitizeArtifactName;
|
||||
exports.uploadCombinedSarifArtifacts = uploadCombinedSarifArtifacts;
|
||||
exports.uploadAllAvailableDebugArtifacts = uploadAllAvailableDebugArtifacts;
|
||||
exports.tryUploadAllAvailableDebugArtifacts = tryUploadAllAvailableDebugArtifacts;
|
||||
exports.uploadDebugArtifacts = uploadDebugArtifacts;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
@@ -40,19 +40,20 @@ const actions_util_1 = require("./actions-util");
|
||||
const analyze_1 = require("./analyze");
|
||||
const codeql_1 = require("./codeql");
|
||||
const environment_1 = require("./environment");
|
||||
const logging_1 = require("./logging");
|
||||
const util_1 = require("./util");
|
||||
function sanitizeArifactName(name) {
|
||||
function sanitizeArtifactName(name) {
|
||||
return name.replace(/[^a-zA-Z0-9_\\-]+/g, "");
|
||||
}
|
||||
/**
|
||||
* Upload Actions SARIF artifacts for debugging when CODEQL_ACTION_DEBUG_COMBINED_SARIF
|
||||
* environment variable is set
|
||||
*/
|
||||
async function uploadCombinedSarifArtifacts() {
|
||||
async function uploadCombinedSarifArtifacts(logger) {
|
||||
const tempDir = (0, actions_util_1.getTemporaryDirectory)();
|
||||
// Upload Actions SARIF artifacts for debugging when environment variable is set
|
||||
if (process.env["CODEQL_ACTION_DEBUG_COMBINED_SARIF"] === "true") {
|
||||
core.info("Uploading available combined SARIF files as Actions debugging artifact...");
|
||||
logger.info("Uploading available combined SARIF files as Actions debugging artifact...");
|
||||
const baseTempDir = path.resolve(tempDir, "combined-sarif");
|
||||
const toUpload = [];
|
||||
if (fs.existsSync(baseTempDir)) {
|
||||
@@ -66,49 +67,112 @@ async function uploadCombinedSarifArtifacts() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (toUpload.length > 0) {
|
||||
try {
|
||||
await uploadDebugArtifacts(toUpload, baseTempDir, "combined-sarif-artifacts");
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Failed to upload combined SARIF files as Actions debugging artifact. Reason: ${(0, util_1.getErrorMessage)(e)}`);
|
||||
}
|
||||
}
|
||||
async function uploadAllAvailableDebugArtifacts(config, logger) {
|
||||
const filesToUpload = [];
|
||||
}
|
||||
/**
|
||||
* Try to prepare a SARIF result debug artifact for the given language.
|
||||
*
|
||||
* @return The path to that debug artifact, or undefined if an error occurs.
|
||||
*/
|
||||
function tryPrepareSarifDebugArtifact(config, language, logger) {
|
||||
try {
|
||||
const analyzeActionOutputDir = process.env[environment_1.EnvVar.SARIF_RESULTS_OUTPUT_DIR];
|
||||
for (const lang of config.languages) {
|
||||
// Add any SARIF files, if they exist
|
||||
if (analyzeActionOutputDir !== undefined &&
|
||||
fs.existsSync(analyzeActionOutputDir) &&
|
||||
fs.lstatSync(analyzeActionOutputDir).isDirectory()) {
|
||||
const sarifFile = path.resolve(analyzeActionOutputDir, `${lang}.sarif`);
|
||||
const sarifFile = path.resolve(analyzeActionOutputDir, `${language}.sarif`);
|
||||
// Move SARIF to DB location so that they can be uploaded with the same root directory as the other artifacts.
|
||||
if (fs.existsSync(sarifFile)) {
|
||||
const sarifInDbLocation = path.resolve(config.dbLocation, `${lang}.sarif`);
|
||||
const sarifInDbLocation = path.resolve(config.dbLocation, `${language}.sarif`);
|
||||
fs.copyFileSync(sarifFile, sarifInDbLocation);
|
||||
filesToUpload.push(sarifInDbLocation);
|
||||
return sarifInDbLocation;
|
||||
}
|
||||
}
|
||||
// Add any log files
|
||||
const databaseDirectory = (0, util_1.getCodeQLDatabasePath)(config, lang);
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Failed to find SARIF results path for ${language}. Reason: ${(0, util_1.getErrorMessage)(e)}`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Try to bundle the database for the given language.
|
||||
*
|
||||
* @return The path to the database bundle, or undefined if an error occurs.
|
||||
*/
|
||||
async function tryBundleDatabase(config, language, logger) {
|
||||
try {
|
||||
if ((0, analyze_1.dbIsFinalized)(config, language, logger)) {
|
||||
try {
|
||||
return await createDatabaseBundleCli(config, language);
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Failed to bundle database for ${language} using the CLI. ` +
|
||||
`Falling back to a partial bundle. Reason: ${(0, util_1.getErrorMessage)(e)}`);
|
||||
}
|
||||
}
|
||||
return await createPartialDatabaseBundle(config, language);
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Failed to bundle database for ${language}. Reason: ${(0, util_1.getErrorMessage)(e)}`);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Attempt to upload all available debug artifacts.
|
||||
*
|
||||
* Logs and suppresses any errors that occur.
|
||||
*/
|
||||
async function tryUploadAllAvailableDebugArtifacts(config, logger) {
|
||||
const filesToUpload = [];
|
||||
try {
|
||||
for (const language of config.languages) {
|
||||
await (0, logging_1.withGroup)(`Uploading debug artifacts for ${language}`, async () => {
|
||||
logger.info("Preparing SARIF result debug artifact...");
|
||||
const sarifResultDebugArtifact = tryPrepareSarifDebugArtifact(config, language, logger);
|
||||
if (sarifResultDebugArtifact) {
|
||||
filesToUpload.push(sarifResultDebugArtifact);
|
||||
logger.info("SARIF result debug artifact ready for upload.");
|
||||
}
|
||||
logger.info("Preparing database logs debug artifact...");
|
||||
const databaseDirectory = (0, util_1.getCodeQLDatabasePath)(config, language);
|
||||
const logsDirectory = path.resolve(databaseDirectory, "log");
|
||||
if ((0, util_1.doesDirectoryExist)(logsDirectory)) {
|
||||
filesToUpload.push(...(0, util_1.listFolder)(logsDirectory));
|
||||
logger.info("Database logs debug artifact ready for upload.");
|
||||
}
|
||||
// Multilanguage tracing: there are additional logs in the root of the cluster
|
||||
logger.info("Preparing database cluster logs debug artifact...");
|
||||
const multiLanguageTracingLogsDirectory = path.resolve(config.dbLocation, "log");
|
||||
if ((0, util_1.doesDirectoryExist)(multiLanguageTracingLogsDirectory)) {
|
||||
filesToUpload.push(...(0, util_1.listFolder)(multiLanguageTracingLogsDirectory));
|
||||
logger.info("Database cluster logs debug artifact ready for upload.");
|
||||
}
|
||||
// Add database bundle
|
||||
let databaseBundlePath;
|
||||
if (!(0, analyze_1.dbIsFinalized)(config, lang, logger)) {
|
||||
databaseBundlePath = await createPartialDatabaseBundle(config, lang);
|
||||
logger.info("Preparing database bundle debug artifact...");
|
||||
const databaseBundle = await tryBundleDatabase(config, language, logger);
|
||||
if (databaseBundle) {
|
||||
filesToUpload.push(databaseBundle);
|
||||
logger.info("Database bundle debug artifact ready for upload.");
|
||||
}
|
||||
else {
|
||||
databaseBundlePath = await createDatabaseBundleCli(config, lang);
|
||||
});
|
||||
}
|
||||
filesToUpload.push(databaseBundlePath);
|
||||
}
|
||||
await uploadDebugArtifacts(filesToUpload, config.dbLocation, config.debugArtifactName);
|
||||
catch (e) {
|
||||
logger.warning(`Failed to prepare debug artifacts. Reason: ${(0, util_1.getErrorMessage)(e)}`);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await (0, logging_1.withGroup)("Uploading debug artifacts", async () => uploadDebugArtifacts(filesToUpload, config.dbLocation, config.debugArtifactName));
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Failed to upload debug artifacts. Reason: ${(0, util_1.getErrorMessage)(e)}`);
|
||||
}
|
||||
}
|
||||
async function uploadDebugArtifacts(toUpload, rootDir, artifactName) {
|
||||
if (toUpload.length === 0) {
|
||||
@@ -125,18 +189,12 @@ async function uploadDebugArtifacts(toUpload, rootDir, artifactName) {
|
||||
core.info("Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input.");
|
||||
}
|
||||
}
|
||||
try {
|
||||
await artifact.create().uploadArtifact(sanitizeArifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir), {
|
||||
await artifact.create().uploadArtifact(sanitizeArtifactName(`${artifactName}${suffix}`), toUpload.map((file) => path.normalize(file)), path.normalize(rootDir), {
|
||||
continueOnError: true,
|
||||
// ensure we don't keep the debug artifacts around for too long since they can be large.
|
||||
retentionDays: 7,
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
// A failure to upload debug artifacts should not fail the entire action.
|
||||
core.warning(`Failed to upload debug artifacts: ${e}`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* If a database has not been finalized, we cannot run the `codeql database bundle`
|
||||
* command in the CLI because it will return an error. Instead we directly zip
|
||||
@@ -159,7 +217,6 @@ async function createPartialDatabaseBundle(config, language) {
|
||||
* Runs `codeql database bundle` command and returns the path.
|
||||
*/
|
||||
async function createDatabaseBundleCli(config, language) {
|
||||
// Otherwise run `codeql database bundle` command.
|
||||
const databaseBundlePath = await (0, util_1.bundleDb)(config, language, await (0, codeql_1.getCodeQL)(config.codeQLCmd), `${config.debugDatabaseName}-${language}`);
|
||||
return databaseBundlePath;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
10
lib/debug-artifacts.test.js
generated
10
lib/debug-artifacts.test.js
generated
@@ -28,11 +28,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
||||
(0, ava_1.default)("sanitizeArifactName", (t) => {
|
||||
t.deepEqual(debugArtifacts.sanitizeArifactName("hello-world_"), "hello-world_");
|
||||
t.deepEqual(debugArtifacts.sanitizeArifactName("hello`world`"), "helloworld");
|
||||
t.deepEqual(debugArtifacts.sanitizeArifactName("hello===123"), "hello123");
|
||||
t.deepEqual(debugArtifacts.sanitizeArifactName("*m)a&n^y%i££n+v!a:l[i]d"), "manyinvalid");
|
||||
(0, ava_1.default)("sanitizeArtifactName", (t) => {
|
||||
t.deepEqual(debugArtifacts.sanitizeArtifactName("hello-world_"), "hello-world_");
|
||||
t.deepEqual(debugArtifacts.sanitizeArtifactName("hello`world`"), "helloworld");
|
||||
t.deepEqual(debugArtifacts.sanitizeArtifactName("hello===123"), "hello123");
|
||||
t.deepEqual(debugArtifacts.sanitizeArtifactName("*m)a&n^y%i££n+v!a:l[i]d"), "manyinvalid");
|
||||
});
|
||||
(0, ava_1.default)("uploadDebugArtifacts", async (t) => {
|
||||
// Test that no error is thrown if artifacts list is empty.
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"debug-artifacts.test.js","sourceRoot":"","sources":["../src/debug-artifacts.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAuB;AAEvB,kEAAoD;AAEpD,IAAA,aAAI,EAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,EAAE;IAChC,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,mBAAmB,CAAC,cAAc,CAAC,EAClD,cAAc,CACf,CAAC;IACF,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,mBAAmB,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC,CAAC;IAC9E,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,mBAAmB,CAAC,yBAAyB,CAAC,EAC7D,aAAa,CACd,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,sBAAsB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvC,2DAA2D;IAC3D,MAAM,CAAC,CAAC,cAAc,CACpB,cAAc,CAAC,oBAAoB,CAAC,EAAE,EAAE,SAAS,EAAE,cAAc,CAAC,CACnE,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
||||
{"version":3,"file":"debug-artifacts.test.js","sourceRoot":"","sources":["../src/debug-artifacts.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAuB;AAEvB,kEAAoD;AAEpD,IAAA,aAAI,EAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE;IACjC,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,oBAAoB,CAAC,cAAc,CAAC,EACnD,cAAc,CACf,CAAC;IACF,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,oBAAoB,CAAC,cAAc,CAAC,EACnD,YAAY,CACb,CAAC;IACF,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,oBAAoB,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,CAAC;IAC5E,CAAC,CAAC,SAAS,CACT,cAAc,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,EAC9D,aAAa,CACd,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,IAAA,aAAI,EAAC,sBAAsB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvC,2DAA2D;IAC3D,MAAM,CAAC,CAAC,cAAc,CACpB,cAAc,CAAC,oBAAoB,CAAC,EAAE,EAAE,SAAS,EAAE,cAAc,CAAC,CACnE,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"bundleVersion": "codeql-bundle-v2.18.4",
|
||||
"cliVersion": "2.18.4",
|
||||
"priorBundleVersion": "codeql-bundle-v2.18.3",
|
||||
"priorCliVersion": "2.18.3"
|
||||
"bundleVersion": "codeql-bundle-v2.19.0",
|
||||
"cliVersion": "2.19.0",
|
||||
"priorBundleVersion": "codeql-bundle-v2.18.4",
|
||||
"priorCliVersion": "2.18.4"
|
||||
}
|
||||
|
||||
2
lib/init-action-post.js
generated
2
lib/init-action-post.js
generated
@@ -54,7 +54,7 @@ async function runWrapper() {
|
||||
logger.warning("Debugging artifacts are unavailable since the 'init' Action failed before it could produce any.");
|
||||
return;
|
||||
}
|
||||
uploadFailedSarifResult = await initActionPostHelper.run(debugArtifacts.uploadAllAvailableDebugArtifacts, actions_util_1.printDebugLogs, config, repositoryNwo, features, logger);
|
||||
uploadFailedSarifResult = await initActionPostHelper.run(debugArtifacts.tryUploadAllAvailableDebugArtifacts, actions_util_1.printDebugLogs, config, repositoryNwo, features, logger);
|
||||
}
|
||||
catch (unwrappedError) {
|
||||
const error = (0, util_1.wrapError)(unwrappedError);
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"init-action-post.js","sourceRoot":"","sources":["../src/init-action-post.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AAEtC,iDAAuE;AACvE,6CAAgD;AAChD,iDAAmD;AACnD,kEAAoD;AACpD,mDAA2C;AAC3C,gFAAkE;AAClE,uCAA6C;AAC7C,6CAAkD;AAClD,mDAOyB;AACzB,iCAKgB;AAOhB,KAAK,UAAU,UAAU;IACvB,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAClC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,MAA0B,CAAC;IAC/B,IAAI,uBAES,CAAC;IACd,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAEjD,MAAM,aAAa,GAAG,IAAA,+BAAkB,EACtC,IAAA,0BAAmB,EAAC,mBAAmB,CAAC,CACzC,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,wBAAQ,CAC3B,aAAa,EACb,aAAa,EACb,IAAA,oCAAqB,GAAE,EACvB,MAAM,CACP,CAAC;QAEF,MAAM,GAAG,MAAM,IAAA,wBAAS,EAAC,IAAA,oCAAqB,GAAE,EAAE,MAAM,CAAC,CAAC;QAC1D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,CAAC,OAAO,CACZ,iGAAiG,CAClG,CAAC;YACF,OAAO;QACT,CAAC;QAED,uBAAuB,GAAG,MAAM,oBAAoB,CAAC,GAAG,CACtD,cAAc,CAAC,gCAAgC,EAC/C,6BAAc,EACd,MAAM,EACN,aAAa,EACb,QAAQ,EACR,MAAM,C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B,GAAG,MAAM,IAAA,sCAAsB,EACnD,0BAAU,CAAC,QAAQ,EACnB,IAAA,gCAAgB,EAAC,KAAK,CAAC,EACvB,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,MAAM,EACN,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CACZ,CAAC;QACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACnC,MAAM,IAAA,gCAAgB,EAAC,gBAAgB,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO;IACT,CAAC;IACD,MAAM,SAAS,GAAG,oBAAoB,CAAC,iBAAiB,EAAE,CAAC;IAC3D,MAAM,CAAC,IAAI,CAAC,yBAAyB,IAAA,uCAAuB,EAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAE5E,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,0BAAU,CAAC,QAAQ,EACnB,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,MAAM,CACP,CAAC;IACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,YAAY,GAAyB;YACzC,GAAG,gBAAgB;YACnB,GAAG,uBAAuB;YAC1B,UAAU,EAAE,oBAAoB,CAAC,iBAAiB,EAAE;SACrD,CAAC;QACF,MAAM,IAAA,gCAAgB,EAAC,YAAY,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
2
lib/init-action.js
generated
2
lib/init-action.js
generated
@@ -412,7 +412,7 @@ async function runWrapper() {
|
||||
await run();
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`init action failed: ${(0, util_1.wrapError)(error).message}`);
|
||||
core.setFailed(`init action failed: ${(0, util_1.getErrorMessage)(error)}`);
|
||||
}
|
||||
await (0, util_1.checkForTimeout)();
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
lib/init.js
generated
4
lib/init.js
generated
@@ -115,12 +115,12 @@ rmSync = fs.rmSync) {
|
||||
// Hosted runners are automatically cleaned up, so this error should not occur for hosted runners.
|
||||
if ((0, actions_util_1.isSelfHostedRunner)()) {
|
||||
throw new util.ConfigurationError(`${blurb} This can happen if another process is using the directory or the directory is owned by a different user. ` +
|
||||
`Please clean up the directory manually and rerun the job. Details: ${util.wrapError(e).message}`);
|
||||
`Please clean up the directory manually and rerun the job. Details: ${util.getErrorMessage(e)}`);
|
||||
}
|
||||
else {
|
||||
throw new Error(`${blurb} This shouldn't typically happen on hosted runners. ` +
|
||||
"If you are using an advanced setup, please check your workflow, otherwise we " +
|
||||
`recommend rerunning the job. Details: ${util.wrapError(e).message}`);
|
||||
`recommend rerunning the job. Details: ${util.getErrorMessage(e)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,gCA2BC;AAED,gCAgBC;AAED,0BAkCC;AAED,0DAeC;AAMD,sDAkBC;AAED,0EAoDC;AAlMD,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAEpD,iDAAsE;AAEtE,qCAA+C;AAC/C,4DAA8C;AAE9C,2CAA0D;AAG1D,qDAAgD;AAChD,mDAAwE;AACxE,6CAA+B;AAExB,KAAK,UAAU,UAAU,CAC9B,UAA8B,EAC9B,UAA4B,EAC5B,OAAe,EACf,OAA2B,EAC3B,iBAA2C,EAC3C,MAAc;IAOd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,yBAAyB,EAAE,WAAW,EAAE,YAAY,EAAE,GACpE,MAAM,IAAA,oBAAW,EACf,UAAU,EACV,UAAU,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,MAAM,EACN,IAAI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iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,sDAAsD;oBAC5D,+EAA+E;oBAC/E,yCAAyC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CACrE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
||||
10
lib/logging.js
generated
10
lib/logging.js
generated
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getActionsLogger = getActionsLogger;
|
||||
exports.getRunnerLogger = getRunnerLogger;
|
||||
exports.withGroup = withGroup;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
function getActionsLogger() {
|
||||
return core;
|
||||
@@ -44,4 +45,13 @@ function getRunnerLogger(debugMode) {
|
||||
endGroup: () => undefined,
|
||||
};
|
||||
}
|
||||
function withGroup(groupName, f) {
|
||||
core.startGroup(groupName);
|
||||
try {
|
||||
return f();
|
||||
}
|
||||
finally {
|
||||
core.endGroup();
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=logging.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAcA,4CAEC;AAED,0CAcC;AAhCD,oDAAsC;AActC,SAAgB,gBAAgB;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,eAAe,CAAC,SAAkB;IAChD,OAAO;QACL,sCAAsC;QACtC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS;QAClD,sCAAsC;QACtC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,sCAAsC;QACtC,OAAO,EAAE,OAAO,CAAC,IAAI;QACrB,sCAAsC;QACtC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;QACxB,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;QAC3B,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS;KAC1B,CAAC;AACJ,CAAC"}
|
||||
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAcA,4CAEC;AAED,0CAcC;AAED,8BAOC;AAzCD,oDAAsC;AActC,SAAgB,gBAAgB;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,eAAe,CAAC,SAAkB;IAChD,OAAO;QACL,sCAAsC;QACtC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS;QAClD,sCAAsC;QACtC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,sCAAsC;QACtC,OAAO,EAAE,OAAO,CAAC,IAAI;QACrB,sCAAsC;QACtC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;QACxB,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;QAC3B,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS;KAC1B,CAAC;AACJ,CAAC;AAED,SAAgB,SAAS,CAAI,SAAiB,EAAE,CAAU;IACxD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC3B,IAAI,CAAC;QACH,OAAO,CAAC,EAAE,CAAC;IACb,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;AACH,CAAC"}
|
||||
2
lib/resolve-environment-action.js
generated
2
lib/resolve-environment-action.js
generated
@@ -81,7 +81,7 @@ async function runWrapper() {
|
||||
await run();
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`${status_report_1.ActionName.ResolveEnvironment} action failed: ${(0, util_1.wrapError)(error).message}`);
|
||||
core.setFailed(`${status_report_1.ActionName.ResolveEnvironment} action failed: ${(0, util_1.getErrorMessage)(error)}`);
|
||||
}
|
||||
await (0, util_1.checkForTimeout)();
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAKwB;AACxB,6CAAgD;AAChD,6CAAsD;AACtD,iDAAmD;AACnD,uCAA6C;AAC7C,+DAAmE;AACnE,mDAKyB;AACzB,iCAMgB;AAEhB,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAElC,IAAI,MAA0B,CAAC;IAE/B,IAAI,CAAC;QACH,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,0BAAU,CAAC,kBAAkB,EAC7B,UAAU,EACV,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,MAAM,CACP,CAAC;QACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACnC,MAAM,IAAA,gCAAgB,EAAC,gBAAgB,CAAC,CAAC;QAC3C,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACjD,IAAA,yBAAkB,EAAC,IAAA,+BAAgB,GAAE,EAAE,aAAa,CAAC,CAAC;QAEtD,MAAM,GAAG,MAAM,IAAA,wBAAS,EAAC,IAAA,oCAAqB,GAAE,EAAE,MAAM,CAAC,CAAC;QAC1D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,yFAAyF,CAC1F,CAAC;Q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A,qBAAc,EAAC,MAAM,CAAC,EAC5B,MAAM,CACP,CAAC;IACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,IAAA,gCAAgB,EAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,GAAG,0BAAU,CAAC,kBAAkB,mBAC9B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OACnB,EAAE,CACH,CAAC;IACJ,CAAC;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
{"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAKwB;AACxB,6CAAgD;AAChD,6CAAsD;AACtD,iDAAmD;AACnD,uCAA6C;AAC7C,+DAAmE;AACnE,mDAKyB;AACzB,iCAOgB;AAEhB,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAElC,IAAI,MAA0B,CAAC;IAE/B,IAAI,CAAC;QACH,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,0BAAU,CAAC,kBAAkB,EAC7B,UAAU,EACV,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,MAAM,CACP,CAAC;QACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACnC,MAAM,IAAA,gCAAgB,EAAC,gBAAgB,CAAC,CAAC;QAC3C,CAA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M,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,MAAM,EACN,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CACZ,CAAC;YACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,MAAM,IAAA,gCAAgB,EAAC,gBAAgB,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QAED,OAAO;IACT,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,0BAAU,CAAC,kBAAkB,EAC7B,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,MAAM,CACP,CAAC;IACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,IAAA,gCAAgB,EAAC,gBAAgB,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,GAAG,0BAAU,CAAC,kBAAkB,mBAAmB,IAAA,sBAAe,EAChE,KAAK,CACN,EAAE,CACJ,CAAC;IACJ,CAAC;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
2
lib/setup-codeql.test.js
generated
2
lib/setup-codeql.test.js
generated
@@ -56,7 +56,7 @@ ava_1.default.beforeEach(() => {
|
||||
t.deepEqual(parsedVersion, expectedVersion);
|
||||
}
|
||||
catch (e) {
|
||||
t.fail((0, util_1.wrapError)(e).message);
|
||||
t.fail((0, util_1.getErrorMessage)(e));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
lib/start-proxy-action-post.js
generated
2
lib/start-proxy-action-post.js
generated
@@ -41,7 +41,7 @@ async function runWrapper() {
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`start-proxy post-action step failed: ${(0, util_1.wrapError)(error).message}`);
|
||||
core.setFailed(`start-proxy post-action step failed: ${(0, util_1.getErrorMessage)(error)}`);
|
||||
}
|
||||
const config = await configUtils.getConfig(actionsUtil.getTemporaryDirectory(), core);
|
||||
if ((config && config.debugMode) || core.isDebug()) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"start-proxy-action-post.js","sourceRoot":"","sources":["../src/start-proxy-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,4DAA8C;AAC9C,oDAAsC;AAEtC,4DAA8C;AAC9C,4DAA8C;AAC9C,iCAAmC;AAEnC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAC/C,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,wCAAwC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CACnE,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,CACxC,WAAW,CAAC,qBAAqB,EAAE,EACnC,IAAI,CACL,CAAC;IAEF,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,CACP,wEAAwE,CACzE,CAAC;QACF,IAAI,CAAC;YACH,MAAM,QAAQ;iBACX,MAAM,EAAE;iBACR,cAAc,CACb,gBAAgB,EAChB,CAAC,WAAW,CAAC,EACb,WAAW,CAAC,qBAAqB,EAAE,EACnC;gBACE,eAAe,EAAE,IAAI;gBACrB,aAAa,EAAE,CAAC;aACjB,CACF,CAAC;QACN,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,yEAAyE;YACzE,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAAC,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
{"version":3,"file":"start-proxy-action-post.js","sourceRoot":"","sources":["../src/start-proxy-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,4DAA8C;AAC9C,oDAAsC;AAEtC,4DAA8C;AAC9C,4DAA8C;AAC9C,iCAAyC;AAEzC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAC/C,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,wCAAwC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CACjE,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,CACxC,WAAW,CAAC,qBAAqB,EAAE,EACnC,IAAI,CACL,CAAC;IAEF,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,CACP,wEAAwE,CACzE,CAAC;QACF,IAAI,CAAC;YACH,MAAM,QAAQ;iBACX,MAAM,EAAE;iBACR,cAAc,CACb,gBAAgB,EAChB,CAAC,WAAW,CAAC,EACb,WAAW,CAAC,qBAAqB,EAAE,EACnC;gBACE,eAAe,EAAE,IAAI;gBACrB,aAAa,EAAE,CAAC;aACjB,CACF,CAAC;QACN,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,yEAAyE;YACzE,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAAC,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
2
lib/start-proxy-action.js
generated
2
lib/start-proxy-action.js
generated
@@ -142,7 +142,7 @@ async function startProxy(binPath, config, logFilePath, logger) {
|
||||
core.setOutput("proxy_ca_certificate", config.ca.cert);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`start-proxy action failed: ${util.wrapError(error).message}`);
|
||||
core.setFailed(`start-proxy action failed: ${util.getErrorMessage(error)}`);
|
||||
}
|
||||
}
|
||||
// getCredentials returns registry credentials from action inputs.
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
lib/status-report.js
generated
2
lib/status-report.js
generated
@@ -278,7 +278,7 @@ async function sendStatusReport(statusReport) {
|
||||
}
|
||||
// something else has gone wrong and the request/response will be logged by octokit
|
||||
// it's possible this is a transient error and we should continue scanning
|
||||
core.warning(`An unexpected error occurred when sending code scanning status report: ${(0, util_1.wrapError)(e).message}`);
|
||||
core.warning(`An unexpected error occurred when sending code scanning status report: ${(0, util_1.getErrorMessage)(e)}`);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=status-report.js.map
|
||||
File diff suppressed because one or more lines are too long
2
lib/trap-caching.js
generated
2
lib/trap-caching.js
generated
@@ -183,7 +183,7 @@ async function cleanupTrapCaches(config, features, logger) {
|
||||
else {
|
||||
logger.info(`Failed to cleanup TRAP caches, continuing. Details: ${e}`);
|
||||
}
|
||||
return { trap_cache_cleanup_error: (0, util_1.wrapError)(e).message };
|
||||
return { trap_cache_cleanup_error: (0, util_1.getErrorMessage)(e) };
|
||||
}
|
||||
}
|
||||
async function getTrapCachesForLanguage(allCaches, language, logger) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
11
lib/upload-lib.js
generated
11
lib/upload-lib.js
generated
@@ -319,15 +319,20 @@ function validateSarifFileSchema(sarifFilePath, logger) {
|
||||
sarif = JSON.parse(fs.readFileSync(sarifFilePath, "utf8"));
|
||||
}
|
||||
catch (e) {
|
||||
throw new InvalidSarifUploadError(`Invalid SARIF. JSON syntax error: ${(0, util_1.wrapError)(e).message}`);
|
||||
throw new InvalidSarifUploadError(`Invalid SARIF. JSON syntax error: ${(0, util_1.getErrorMessage)(e)}`);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const schema = require("../src/sarif-schema-2.1.0.json");
|
||||
const result = new jsonschema.Validator().validate(sarif, schema);
|
||||
// Filter errors related to invalid URIs in the artifactLocation field as this
|
||||
// is a breaking change. See https://github.com/github/codeql-action/issues/1703
|
||||
const errors = (result.errors || []).filter((err) => err.argument !== "uri-reference");
|
||||
const warnings = (result.errors || []).filter((err) => err.argument === "uri-reference");
|
||||
const warningAttributes = ["uri-reference", "uri"];
|
||||
const errors = (result.errors ?? []).filter((err) => !(err.name === "format" &&
|
||||
typeof err.argument === "string" &&
|
||||
warningAttributes.includes(err.argument)));
|
||||
const warnings = (result.errors ?? []).filter((err) => err.name === "format" &&
|
||||
typeof err.argument === "string" &&
|
||||
warningAttributes.includes(err.argument));
|
||||
for (const warning of warnings) {
|
||||
logger.info(`Warning: '${warning.instance}' is not a valid URI in '${warning.property}'.`);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
lib/upload-lib.test.js
generated
4
lib/upload-lib.test.js
generated
@@ -192,8 +192,8 @@ ava_1.default.beforeEach(() => {
|
||||
};
|
||||
const sarifFile = `${__dirname}/../src/testdata/with-invalid-uri.sarif`;
|
||||
uploadLib.validateSarifFileSchema(sarifFile, mockLogger);
|
||||
t.deepEqual(loggedMessages.length, 2);
|
||||
t.deepEqual(loggedMessages[1], "Warning: 'not a valid URI' is not a valid URI in 'instance.runs[0].results[0].locations[0].physicalLocation.artifactLocation.uri'.");
|
||||
t.deepEqual(loggedMessages.length, 3);
|
||||
t.deepEqual(loggedMessages[1], "Warning: 'not a valid URI' is not a valid URI in 'instance.runs[0].tool.driver.rules[0].helpUri'.", "Warning: 'not a valid URI' is not a valid URI in 'instance.runs[0].results[0].locations[0].physicalLocation.artifactLocation.uri'.");
|
||||
});
|
||||
(0, ava_1.default)("shouldShowCombineSarifFilesDeprecationWarning when on dotcom", async (t) => {
|
||||
t.true(await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([createMockSarif("abc", "def"), createMockSarif("abc", "def")], {
|
||||
|
||||
File diff suppressed because one or more lines are too long
6
lib/upload-sarif-action-post.js
generated
6
lib/upload-sarif-action-post.js
generated
@@ -31,17 +31,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const debugArtifacts = __importStar(require("./debug-artifacts"));
|
||||
const environment_1 = require("./environment");
|
||||
const logging_1 = require("./logging");
|
||||
const util_1 = require("./util");
|
||||
async function runWrapper() {
|
||||
try {
|
||||
const logger = (0, logging_1.getActionsLogger)();
|
||||
// Upload SARIF artifacts if we determine that this is a third-party analysis run.
|
||||
// For first-party runs, this artifact will be uploaded in the `analyze-post` step.
|
||||
if (process.env[environment_1.EnvVar.INIT_ACTION_HAS_RUN] !== "true") {
|
||||
await debugArtifacts.uploadCombinedSarifArtifacts();
|
||||
await (0, logging_1.withGroup)("Uploading combined SARIF debug artifact", () => debugArtifacts.uploadCombinedSarifArtifacts(logger));
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`upload-sarif post-action step failed: ${(0, util_1.wrapError)(error).message}`);
|
||||
core.setFailed(`upload-sarif post-action step failed: ${(0, util_1.getErrorMessage)(error)}`);
|
||||
}
|
||||
}
|
||||
void runWrapper();
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"upload-sarif-action-post.js","sourceRoot":"","sources":["../src/upload-sarif-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,kEAAoD;AACpD,+CAAuC;AACvC,iCAAmC;AAEnC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,kFAAkF;QAClF,mFAAmF;QACnF,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAM,CAAC,mBAAmB,CAAC,KAAK,MAAM,EAAE,CAAC;YACvD,MAAM,cAAc,CAAC,4BAA4B,EAAE,CAAC;QACtD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,yCAAyC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CACpE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
{"version":3,"file":"upload-sarif-action-post.js","sourceRoot":"","sources":["../src/upload-sarif-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,kEAAoD;AACpD,+CAAuC;AACvC,uCAAwD;AACxD,iCAAyC;AAEzC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;QAClC,kFAAkF;QAClF,mFAAmF;QACnF,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAM,CAAC,mBAAmB,CAAC,KAAK,MAAM,EAAE,CAAC;YACvD,MAAM,IAAA,mBAAS,EAAC,yCAAyC,EAAE,GAAG,EAAE,CAC9D,cAAc,CAAC,4BAA4B,CAAC,MAAM,CAAC,CACpD,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,yCAAyC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CAClE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
2
lib/upload-sarif-action.js
generated
2
lib/upload-sarif-action.js
generated
@@ -86,7 +86,7 @@ async function runWrapper() {
|
||||
await run();
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(`codeql/upload-sarif action failed: ${(0, util_1.wrapError)(error).message}`);
|
||||
core.setFailed(`codeql/upload-sarif action failed: ${(0, util_1.getErrorMessage)(error)}`);
|
||||
}
|
||||
}
|
||||
void runWrapper();
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"upload-sarif-action.js","sourceRoot":"","sources":["../src/upload-sarif-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,4DAA8C;AAC9C,iDAAyE;AACzE,6CAAgD;AAChD,mDAA2C;AAC3C,uCAAqD;AACrD,6CAAkD;AAClD,mDAOyB;AACzB,yDAA2C;AAC3C,iCAQgB;AAMhB,KAAK,UAAU,uBAAuB,CACpC,SAAe,EACf,WAA0C,EAC1C,MAAc;IAEd,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,0BAAU,CAAC,WAAW,EACtB,SAAS,EACT,SAAS,EACT,SAAS,EACT,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,MAAM,CACP,CAAC;IACF,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,YAAY,GAA4B;YAC5C,GAAG,gBAAgB;YACnB,GAAG,WAAW;SACf,CAAC;QACF,MAAM,IAAA,gCAAgB,EAAC,YAAY,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAClC,IAAA,4BAAqB,EAAC,IAAA,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G,KAAK,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAExB,MAAM,qBAAqB,GAAG,MAAM,IAAA,sCAAsB,EACxD,0BAAU,CAAC,WAAW,EACtB,IAAA,gCAAgB,EAAC,KAAK,CAAC,EACvB,SAAS,EACT,SAAS,EACT,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,KAAK,CAAC,KAAK,CACZ,CAAC;QACF,IAAI,qBAAqB,KAAK,SAAS,EAAE,CAAC;YACxC,MAAM,IAAA,gCAAgB,EAAC,qBAAqB,CAAC,CAAC;QAChD,CAAC;QACD,OAAO;IACT,CAAC;AACH,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,sCAAsC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
8
lib/util.js
generated
8
lib/util.js
generated
@@ -784,8 +784,14 @@ function fixInvalidNotificationsInFile(inputPath, outputPath, logger) {
|
||||
function wrapError(error) {
|
||||
return error instanceof Error ? error : new Error(String(error));
|
||||
}
|
||||
/**
|
||||
* Returns an appropriate message for the error.
|
||||
*
|
||||
* If the error is an `Error` instance, this returns the error message without
|
||||
* an `Error: ` prefix.
|
||||
*/
|
||||
function getErrorMessage(error) {
|
||||
return error instanceof Error ? error.toString() : String(error);
|
||||
return error instanceof Error ? error.message : String(error);
|
||||
}
|
||||
function prettyPrintPack(pack) {
|
||||
return `${pack.name}${pack.version ? `@${pack.version}` : ""}${pack.path ? `:${pack.path}` : ""}`;
|
||||
|
||||
File diff suppressed because one or more lines are too long
1101
node_modules/.package-lock.json
generated
vendored
1101
node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
2
node_modules/@eslint/js/package.json
generated
vendored
2
node_modules/@eslint/js/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@eslint/js",
|
||||
"version": "9.9.1",
|
||||
"version": "9.11.0",
|
||||
"description": "ESLint JavaScript language implementation",
|
||||
"main": "./src/index.js",
|
||||
"scripts": {},
|
||||
|
||||
126
node_modules/@humanwhocodes/config-array/api.js
generated
vendored
126
node_modules/@humanwhocodes/config-array/api.js
generated
vendored
@@ -154,8 +154,82 @@ const MINIMATCH_OPTIONS = {
|
||||
|
||||
const CONFIG_TYPES = new Set(['array', 'function']);
|
||||
|
||||
/**
|
||||
* Fields that are considered metadata and not part of the config object.
|
||||
*/
|
||||
const META_FIELDS = new Set(['name']);
|
||||
|
||||
const FILES_AND_IGNORES_SCHEMA = new objectSchema.ObjectSchema(filesAndIgnoresSchema);
|
||||
|
||||
/**
|
||||
* Wrapper error for config validation errors that adds a name to the front of the
|
||||
* error message.
|
||||
*/
|
||||
class ConfigError extends Error {
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {string} name The config object name causing the error.
|
||||
* @param {number} index The index of the config object in the array.
|
||||
* @param {Error} source The source error.
|
||||
*/
|
||||
constructor(name, index, { cause, message }) {
|
||||
|
||||
|
||||
const finalMessage = message || cause.message;
|
||||
|
||||
super(`Config ${name}: ${finalMessage}`, { cause });
|
||||
|
||||
// copy over custom properties that aren't represented
|
||||
if (cause) {
|
||||
for (const key of Object.keys(cause)) {
|
||||
if (!(key in this)) {
|
||||
this[key] = cause[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the error.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
this.name = 'ConfigError';
|
||||
|
||||
/**
|
||||
* The index of the config object in the array.
|
||||
* @type {number}
|
||||
* @readonly
|
||||
*/
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of a config object.
|
||||
* @param {object} config The config object to get the name of.
|
||||
* @returns {string} The name of the config object.
|
||||
*/
|
||||
function getConfigName(config) {
|
||||
if (config && typeof config.name === 'string' && config.name) {
|
||||
return `"${config.name}"`;
|
||||
}
|
||||
|
||||
return '(unnamed)';
|
||||
}
|
||||
|
||||
/**
|
||||
* Rethrows a config error with additional information about the config object.
|
||||
* @param {object} config The config object to get the name of.
|
||||
* @param {number} index The index of the config object in the array.
|
||||
* @param {Error} error The error to rethrow.
|
||||
* @throws {ConfigError} When the error is rethrown for a config.
|
||||
*/
|
||||
function rethrowConfigError(config, index, error) {
|
||||
const configName = getConfigName(config);
|
||||
throw new ConfigError(configName, index, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shorthand for checking if a value is a string.
|
||||
* @param {any} value The value to check.
|
||||
@@ -166,23 +240,43 @@ function isString(value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the files and ignores keys of a config object are valid as per base schema.
|
||||
* @param {object} config The config object to check.
|
||||
* Creates a function that asserts that the config is valid
|
||||
* during normalization. This checks that the config is not nullish
|
||||
* and that files and ignores keys of a config object are valid as per base schema.
|
||||
* @param {Object} config The config object to check.
|
||||
* @param {number} index The index of the config object in the array.
|
||||
* @returns {void}
|
||||
* @throws {TypeError} If the files and ignores keys of a config object are not valid.
|
||||
* @throws {ConfigError} If the files and ignores keys of a config object are not valid.
|
||||
*/
|
||||
function assertValidFilesAndIgnores(config) {
|
||||
if (!config || typeof config !== 'object') {
|
||||
return;
|
||||
function assertValidBaseConfig(config, index) {
|
||||
|
||||
if (config === null) {
|
||||
throw new ConfigError(getConfigName(config), index, { message: 'Unexpected null config.' });
|
||||
}
|
||||
|
||||
if (config === undefined) {
|
||||
throw new ConfigError(getConfigName(config), index, { message: 'Unexpected undefined config.' });
|
||||
}
|
||||
|
||||
if (typeof config !== 'object') {
|
||||
throw new ConfigError(getConfigName(config), index, { message: 'Unexpected non-object config.' });
|
||||
}
|
||||
|
||||
const validateConfig = { };
|
||||
|
||||
if ('files' in config) {
|
||||
validateConfig.files = config.files;
|
||||
}
|
||||
|
||||
if ('ignores' in config) {
|
||||
validateConfig.ignores = config.ignores;
|
||||
}
|
||||
|
||||
try {
|
||||
FILES_AND_IGNORES_SCHEMA.validate(validateConfig);
|
||||
} catch (validationError) {
|
||||
rethrowConfigError(config, index, { cause: validationError });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -377,7 +471,7 @@ function pathMatchesIgnores(filePath, basePath, config) {
|
||||
*/
|
||||
const relativeFilePath = path.relative(basePath, filePath);
|
||||
|
||||
return Object.keys(config).length > 1 &&
|
||||
return Object.keys(config).filter(key => !META_FIELDS.has(key)).length > 1 &&
|
||||
!shouldIgnorePath(config.ignores, filePath, relativeFilePath);
|
||||
}
|
||||
|
||||
@@ -511,7 +605,7 @@ class ConfigArray extends Array {
|
||||
/**
|
||||
* Tracks if the array has been normalized.
|
||||
* @property isNormalized
|
||||
* @type boolean
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this[ConfigArraySymbol.isNormalized] = normalized;
|
||||
@@ -530,7 +624,7 @@ class ConfigArray extends Array {
|
||||
* The path of the config file that this array was loaded from.
|
||||
* This is used to calculate filename matches.
|
||||
* @property basePath
|
||||
* @type string
|
||||
* @type {string}
|
||||
*/
|
||||
this.basePath = basePath;
|
||||
|
||||
@@ -539,14 +633,14 @@ class ConfigArray extends Array {
|
||||
/**
|
||||
* The supported config types.
|
||||
* @property configTypes
|
||||
* @type Array<string>
|
||||
* @type {Array<string>}
|
||||
*/
|
||||
this.extraConfigTypes = Object.freeze([...extraConfigTypes]);
|
||||
|
||||
/**
|
||||
* A cache to store calculated configs for faster repeat lookup.
|
||||
* @property configCache
|
||||
* @type Map
|
||||
* @type {Map<string, Object>}
|
||||
* @private
|
||||
*/
|
||||
this[ConfigArraySymbol.configCache] = new Map();
|
||||
@@ -645,7 +739,7 @@ class ConfigArray extends Array {
|
||||
* In this case, it acts list a globally ignored pattern. If there
|
||||
* are additional keys, then ignores act like exclusions.
|
||||
*/
|
||||
if (config.ignores && Object.keys(config).length === 1) {
|
||||
if (config.ignores && Object.keys(config).filter(key => !META_FIELDS.has(key)).length === 1) {
|
||||
result.push(...config.ignores);
|
||||
}
|
||||
}
|
||||
@@ -677,7 +771,7 @@ class ConfigArray extends Array {
|
||||
const normalizedConfigs = await normalize(this, context, this.extraConfigTypes);
|
||||
this.length = 0;
|
||||
this.push(...normalizedConfigs.map(this[ConfigArraySymbol.preprocessConfig].bind(this)));
|
||||
this.forEach(assertValidFilesAndIgnores);
|
||||
this.forEach(assertValidBaseConfig);
|
||||
this[ConfigArraySymbol.isNormalized] = true;
|
||||
|
||||
// prevent further changes
|
||||
@@ -699,7 +793,7 @@ class ConfigArray extends Array {
|
||||
const normalizedConfigs = normalizeSync(this, context, this.extraConfigTypes);
|
||||
this.length = 0;
|
||||
this.push(...normalizedConfigs.map(this[ConfigArraySymbol.preprocessConfig].bind(this)));
|
||||
this.forEach(assertValidFilesAndIgnores);
|
||||
this.forEach(assertValidBaseConfig);
|
||||
this[ConfigArraySymbol.isNormalized] = true;
|
||||
|
||||
// prevent further changes
|
||||
@@ -932,7 +1026,11 @@ class ConfigArray extends Array {
|
||||
// otherwise construct the config
|
||||
|
||||
finalConfig = matchingConfigIndices.reduce((result, index) => {
|
||||
try {
|
||||
return this[ConfigArraySymbol.schema].merge(result, this[index]);
|
||||
} catch (validationError) {
|
||||
rethrowConfigError(this[index], index, { cause: validationError});
|
||||
}
|
||||
}, {}, this);
|
||||
|
||||
finalConfig = this[ConfigArraySymbol.finalizeConfig](finalConfig);
|
||||
|
||||
8
node_modules/@humanwhocodes/config-array/package.json
generated
vendored
8
node_modules/@humanwhocodes/config-array/package.json
generated
vendored
@@ -1,11 +1,13 @@
|
||||
{
|
||||
"name": "@humanwhocodes/config-array",
|
||||
"version": "0.11.14",
|
||||
"version": "0.13.0",
|
||||
"description": "Glob-based configuration matching.",
|
||||
"author": "Nicholas C. Zakas",
|
||||
"main": "api.js",
|
||||
"files": [
|
||||
"api.js"
|
||||
"api.js",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -42,7 +44,7 @@
|
||||
"node": ">=10.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@humanwhocodes/object-schema": "^2.0.2",
|
||||
"@humanwhocodes/object-schema": "^2.0.3",
|
||||
"debug": "^4.3.1",
|
||||
"minimatch": "^3.0.5"
|
||||
},
|
||||
|
||||
29
node_modules/@humanwhocodes/object-schema/.eslintrc.js
generated
vendored
29
node_modules/@humanwhocodes/object-schema/.eslintrc.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
module.exports = {
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
4
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"double"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
]
|
||||
}
|
||||
};
|
||||
27
node_modules/@humanwhocodes/object-schema/.github/workflows/nodejs-test.yml
generated
vendored
27
node_modules/@humanwhocodes/object-schema/.github/workflows/nodejs-test.yml
generated
vendored
@@ -1,27 +0,0 @@
|
||||
name: Node CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, macOS-latest, ubuntu-latest]
|
||||
node: [18.x, 19.x, 20.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: npm install, build, and test
|
||||
run: |
|
||||
npm install
|
||||
npm run build --if-present
|
||||
npm test
|
||||
env:
|
||||
CI: true
|
||||
39
node_modules/@humanwhocodes/object-schema/.github/workflows/release-please.yml
generated
vendored
39
node_modules/@humanwhocodes/object-schema/.github/workflows/release-please.yml
generated
vendored
@@ -1,39 +0,0 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
name: release-please
|
||||
jobs:
|
||||
release-please:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: GoogleCloudPlatform/release-please-action@v3
|
||||
id: release
|
||||
with:
|
||||
release-type: node
|
||||
package-name: object-schema
|
||||
# The logic below handles the npm publication:
|
||||
- uses: actions/checkout@v4
|
||||
# these if statements ensure that a publication only occurs when
|
||||
# a new release is created:
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 12
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
- run: npm ci
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
- run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
|
||||
# Tweets out release announcement
|
||||
- run: 'npx @humanwhocodes/tweet "Object Schema v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released!\n\n${{ github.event.release.html_url }}"'
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
env:
|
||||
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
|
||||
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
|
||||
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
|
||||
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
|
||||
7
node_modules/@humanwhocodes/object-schema/CHANGELOG.md
generated
vendored
7
node_modules/@humanwhocodes/object-schema/CHANGELOG.md
generated
vendored
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## [2.0.3](https://github.com/humanwhocodes/object-schema/compare/v2.0.2...v2.0.3) (2024-04-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Ensure test files are not including in package ([6eeb32c](https://github.com/humanwhocodes/object-schema/commit/6eeb32cc76a3e37d76b2990bd603d72061c816e0)), closes [#19](https://github.com/humanwhocodes/object-schema/issues/19)
|
||||
|
||||
## [2.0.2](https://github.com/humanwhocodes/object-schema/compare/v2.0.1...v2.0.2) (2024-01-10)
|
||||
|
||||
|
||||
|
||||
7
node_modules/@humanwhocodes/object-schema/package.json
generated
vendored
7
node_modules/@humanwhocodes/object-schema/package.json
generated
vendored
@@ -1,8 +1,13 @@
|
||||
{
|
||||
"name": "@humanwhocodes/object-schema",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.3",
|
||||
"description": "An object schema merger/validator",
|
||||
"main": "src/index.js",
|
||||
"files": [
|
||||
"src",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
|
||||
66
node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js
generated
vendored
66
node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js
generated
vendored
@@ -1,66 +0,0 @@
|
||||
/**
|
||||
* @filedescription Merge Strategy Tests
|
||||
*/
|
||||
/* global it, describe, beforeEach */
|
||||
|
||||
"use strict";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const assert = require("chai").assert;
|
||||
const { MergeStrategy } = require("../src/");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
describe("MergeStrategy", () => {
|
||||
|
||||
|
||||
describe("overwrite()", () => {
|
||||
|
||||
it("should overwrite the first value with the second when the second is defined", () => {
|
||||
const result = MergeStrategy.overwrite(1, 2);
|
||||
assert.strictEqual(result, 2);
|
||||
});
|
||||
|
||||
it("should overwrite the first value with the second when the second is undefined", () => {
|
||||
const result = MergeStrategy.overwrite(1, undefined);
|
||||
assert.strictEqual(result, undefined);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("replace()", () => {
|
||||
|
||||
it("should overwrite the first value with the second when the second is defined", () => {
|
||||
const result = MergeStrategy.replace(1, 2);
|
||||
assert.strictEqual(result, 2);
|
||||
});
|
||||
|
||||
it("should return the first value when the second is undefined", () => {
|
||||
const result = MergeStrategy.replace(1, undefined);
|
||||
assert.strictEqual(result, 1);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("assign()", () => {
|
||||
|
||||
it("should merge properties from two objects when called", () => {
|
||||
|
||||
const object1 = { foo: 1, bar: 3 };
|
||||
const object2 = { foo: 2 };
|
||||
|
||||
const result = MergeStrategy.assign(object1, object2);
|
||||
assert.deepStrictEqual(result, {
|
||||
foo: 2,
|
||||
bar: 3
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
659
node_modules/@humanwhocodes/object-schema/tests/object-schema.js
generated
vendored
659
node_modules/@humanwhocodes/object-schema/tests/object-schema.js
generated
vendored
@@ -1,659 +0,0 @@
|
||||
/**
|
||||
* @filedescription Object Schema Tests
|
||||
*/
|
||||
/* global it, describe, beforeEach */
|
||||
|
||||
"use strict";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const assert = require("chai").assert;
|
||||
const { ObjectSchema } = require("../src/");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
describe("ObjectSchema", () => {
|
||||
|
||||
let schema;
|
||||
|
||||
describe("new ObjectSchema()", () => {
|
||||
|
||||
it("should add a new key when a strategy is passed", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {},
|
||||
validate() {}
|
||||
}
|
||||
});
|
||||
|
||||
assert.isTrue(schema.hasKey("foo"));
|
||||
});
|
||||
|
||||
it("should throw an error when a strategy is missing a merge() method", () => {
|
||||
assert.throws(() => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
validate() { }
|
||||
}
|
||||
});
|
||||
}, /Definition for key "foo" must have a merge property/);
|
||||
});
|
||||
|
||||
it("should throw an error when a strategy is missing a merge() method", () => {
|
||||
assert.throws(() => {
|
||||
schema = new ObjectSchema();
|
||||
}, /Schema definitions missing/);
|
||||
});
|
||||
|
||||
it("should throw an error when a strategy is missing a validate() method", () => {
|
||||
assert.throws(() => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() { },
|
||||
}
|
||||
});
|
||||
}, /Definition for key "foo" must have a validate\(\) method/);
|
||||
});
|
||||
|
||||
it("should throw an error when merge is an invalid string", () => {
|
||||
assert.throws(() => {
|
||||
new ObjectSchema({
|
||||
foo: {
|
||||
merge: "bar",
|
||||
validate() { }
|
||||
}
|
||||
});
|
||||
}, /key "foo" missing valid merge strategy/);
|
||||
});
|
||||
|
||||
it("should throw an error when validate is an invalid string", () => {
|
||||
assert.throws(() => {
|
||||
new ObjectSchema({
|
||||
foo: {
|
||||
merge: "assign",
|
||||
validate: "s"
|
||||
}
|
||||
});
|
||||
}, /key "foo" missing valid validation strategy/);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe("merge()", () => {
|
||||
|
||||
it("should throw an error when an unexpected key is found", () => {
|
||||
let schema = new ObjectSchema({});
|
||||
|
||||
assert.throws(() => {
|
||||
schema.merge({ foo: true }, { foo: true });
|
||||
}, /Unexpected key "foo"/);
|
||||
});
|
||||
|
||||
it("should throw an error when merge() throws an error", () => {
|
||||
let schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
throw new Error("Boom!");
|
||||
},
|
||||
validate() {}
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
schema.merge({ foo: true }, { foo: true });
|
||||
}, /Key "foo": Boom!/);
|
||||
|
||||
});
|
||||
|
||||
it("should throw an error when merge() throws an error with a readonly message", () => {
|
||||
let schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
throw {
|
||||
get message() {
|
||||
return "Boom!";
|
||||
}
|
||||
};
|
||||
},
|
||||
validate() {}
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
schema.merge({ foo: true }, { foo: true });
|
||||
}, /Key "foo": Boom!/);
|
||||
|
||||
});
|
||||
|
||||
it("should throw an error with custom properties when merge() throws an error with custom properties", () => {
|
||||
let schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
throw {
|
||||
get message() {
|
||||
return "Boom!";
|
||||
},
|
||||
booya: true
|
||||
};
|
||||
},
|
||||
validate() {}
|
||||
}
|
||||
});
|
||||
|
||||
let errorThrown = false;
|
||||
|
||||
try {
|
||||
schema.merge({ foo: true }, { foo: true });
|
||||
} catch (ex) {
|
||||
errorThrown = true;
|
||||
assert.isTrue(ex.booya);
|
||||
}
|
||||
|
||||
assert.isTrue(errorThrown);
|
||||
|
||||
});
|
||||
|
||||
it("should call the merge() strategy for one key when called", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate() {}
|
||||
}
|
||||
});
|
||||
|
||||
const result = schema.merge({ foo: true }, { foo: false });
|
||||
assert.propertyVal(result, "foo", "bar");
|
||||
});
|
||||
|
||||
it("should not call the merge() strategy when both objects don't contain the key", () => {
|
||||
|
||||
let called = false;
|
||||
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
called = true;
|
||||
},
|
||||
validate() {}
|
||||
}
|
||||
});
|
||||
|
||||
schema.merge({}, {});
|
||||
assert.isFalse(called, "The merge() strategy should not have been called.");
|
||||
});
|
||||
|
||||
it("should omit returning the key when the merge() strategy returns undefined", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return undefined;
|
||||
},
|
||||
validate() { }
|
||||
}
|
||||
});
|
||||
|
||||
const result = schema.merge({ foo: true }, { foo: false });
|
||||
assert.notProperty(result, "foo");
|
||||
});
|
||||
|
||||
it("should call the merge() strategy for two keys when called", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate() { }
|
||||
},
|
||||
bar: {
|
||||
merge() {
|
||||
return "baz";
|
||||
},
|
||||
validate() {}
|
||||
}
|
||||
});
|
||||
|
||||
const result = schema.merge({ foo: true, bar: 1 }, { foo: true, bar: 2 });
|
||||
assert.propertyVal(result, "foo", "bar");
|
||||
assert.propertyVal(result, "bar", "baz");
|
||||
});
|
||||
|
||||
it("should call the merge() strategy for two keys when called on three objects", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate() { }
|
||||
},
|
||||
bar: {
|
||||
merge() {
|
||||
return "baz";
|
||||
},
|
||||
validate() { }
|
||||
}
|
||||
});
|
||||
|
||||
const result = schema.merge(
|
||||
{ foo: true, bar: 1 },
|
||||
{ foo: true, bar: 3 },
|
||||
{ foo: false, bar: 2 }
|
||||
);
|
||||
assert.propertyVal(result, "foo", "bar");
|
||||
assert.propertyVal(result, "bar", "baz");
|
||||
});
|
||||
|
||||
it("should call the merge() strategy when defined as 'overwrite'", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge: "overwrite",
|
||||
validate() { }
|
||||
}
|
||||
});
|
||||
|
||||
const result = schema.merge(
|
||||
{ foo: true },
|
||||
{ foo: false }
|
||||
);
|
||||
assert.propertyVal(result, "foo", false);
|
||||
});
|
||||
|
||||
it("should call the merge() strategy when defined as 'assign'", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge: "assign",
|
||||
validate() { }
|
||||
}
|
||||
});
|
||||
|
||||
const result = schema.merge(
|
||||
{ foo: { bar: true } },
|
||||
{ foo: { baz: false } }
|
||||
);
|
||||
|
||||
assert.strictEqual(result.foo.bar, true);
|
||||
assert.strictEqual(result.foo.baz, false);
|
||||
});
|
||||
|
||||
it("should call the merge strategy when there's a subschema", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
name: {
|
||||
schema: {
|
||||
first: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
},
|
||||
last: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const result = schema.merge({
|
||||
name: {
|
||||
first: "n",
|
||||
last: "z"
|
||||
}
|
||||
}, {
|
||||
name: {
|
||||
first: "g"
|
||||
}
|
||||
});
|
||||
|
||||
assert.strictEqual(result.name.first, "g");
|
||||
assert.strictEqual(result.name.last, "z");
|
||||
});
|
||||
|
||||
it("should return separate objects when using subschema", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
age: {
|
||||
merge: "replace",
|
||||
validate: "number"
|
||||
},
|
||||
address: {
|
||||
schema: {
|
||||
street: {
|
||||
schema: {
|
||||
number: {
|
||||
merge: "replace",
|
||||
validate: "number"
|
||||
},
|
||||
streetName: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
state: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const baseObject = {
|
||||
address: {
|
||||
street: {
|
||||
number: 100,
|
||||
streetName: "Foo St"
|
||||
},
|
||||
state: "HA"
|
||||
}
|
||||
};
|
||||
|
||||
const result = schema.merge(baseObject, {
|
||||
age: 29
|
||||
});
|
||||
|
||||
assert.notStrictEqual(result.address.street, baseObject.address.street);
|
||||
assert.deepStrictEqual(result.address, baseObject.address);
|
||||
});
|
||||
|
||||
it("should not error when calling the merge strategy when there's a subschema and no matching key in second object", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
name: {
|
||||
schema: {
|
||||
first: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
},
|
||||
last: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const result = schema.merge({
|
||||
name: {
|
||||
first: "n",
|
||||
last: "z"
|
||||
}
|
||||
}, {
|
||||
});
|
||||
|
||||
assert.strictEqual(result.name.first, "n");
|
||||
assert.strictEqual(result.name.last, "z");
|
||||
});
|
||||
|
||||
it("should not error when calling the merge strategy when there's multiple subschemas and no matching key in second object", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
user: {
|
||||
schema: {
|
||||
name: {
|
||||
schema: {
|
||||
first: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
},
|
||||
last: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const result = schema.merge({
|
||||
user: {
|
||||
name: {
|
||||
first: "n",
|
||||
last: "z"
|
||||
}
|
||||
}
|
||||
}, {
|
||||
});
|
||||
|
||||
assert.strictEqual(result.user.name.first, "n");
|
||||
assert.strictEqual(result.user.name.last, "z");
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
describe("validate()", () => {
|
||||
|
||||
it("should throw an error when an unexpected key is found", () => {
|
||||
let schema = new ObjectSchema({});
|
||||
assert.throws(() => {
|
||||
schema.validate({ foo: true });
|
||||
}, /Unexpected key "foo"/);
|
||||
});
|
||||
|
||||
it("should not throw an error when an expected key is found", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate() {}
|
||||
}
|
||||
});
|
||||
|
||||
schema.validate({ foo: true });
|
||||
});
|
||||
|
||||
it("should pass the property value into validate() when key is found", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate(value) {
|
||||
assert.isTrue(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
schema.validate({ foo: true });
|
||||
});
|
||||
|
||||
it("should not throw an error when expected keys are found", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate() {}
|
||||
},
|
||||
bar: {
|
||||
merge() {
|
||||
return "baz";
|
||||
},
|
||||
validate() {}
|
||||
}
|
||||
});
|
||||
|
||||
schema.validate({ foo: true, bar: true });
|
||||
});
|
||||
|
||||
it("should not throw an error when expected keys are found with required keys", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate() { }
|
||||
},
|
||||
bar: {
|
||||
requires: ["foo"],
|
||||
merge() {
|
||||
return "baz";
|
||||
},
|
||||
validate() { }
|
||||
}
|
||||
});
|
||||
|
||||
schema.validate({ foo: true, bar: true });
|
||||
});
|
||||
|
||||
it("should throw an error when expected keys are found without required keys", () => {
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate() { }
|
||||
},
|
||||
baz: {
|
||||
merge() {
|
||||
return "baz";
|
||||
},
|
||||
validate() { }
|
||||
},
|
||||
bar: {
|
||||
name: "bar",
|
||||
requires: ["foo", "baz"],
|
||||
merge() { },
|
||||
validate() { }
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
schema.validate({ bar: true });
|
||||
}, /Key "bar" requires keys "foo", "baz"./);
|
||||
});
|
||||
|
||||
|
||||
it("should throw an error when an expected key is found but is invalid", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate() {
|
||||
throw new Error("Invalid key.");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
schema.validate({ foo: true });
|
||||
}, /Key "foo": Invalid key/);
|
||||
});
|
||||
|
||||
it("should throw an error when an expected key is found but is invalid with a string validator", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate: "string"
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
schema.validate({ foo: true });
|
||||
}, /Key "foo": Expected a string/);
|
||||
});
|
||||
|
||||
it("should throw an error when an expected key is found but is invalid with a number validator", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate: "number"
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
schema.validate({ foo: true });
|
||||
}, /Key "foo": Expected a number/);
|
||||
});
|
||||
|
||||
it("should throw an error when a required key is missing", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
foo: {
|
||||
required: true,
|
||||
merge() {
|
||||
return "bar";
|
||||
},
|
||||
validate() {}
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
schema.validate({});
|
||||
}, /Missing required key "foo"/);
|
||||
});
|
||||
|
||||
it("should throw an error when a subschema is provided and the value doesn't validate", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
name: {
|
||||
schema: {
|
||||
first: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
},
|
||||
last: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
schema.validate({
|
||||
name: {
|
||||
first: 123,
|
||||
last: "z"
|
||||
}
|
||||
});
|
||||
|
||||
}, /Key "name": Key "first": Expected a string/);
|
||||
});
|
||||
|
||||
it("should not throw an error when a subschema is provided and the value validates", () => {
|
||||
|
||||
schema = new ObjectSchema({
|
||||
name: {
|
||||
schema: {
|
||||
first: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
},
|
||||
last: {
|
||||
merge: "replace",
|
||||
validate: "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
schema.validate({
|
||||
name: {
|
||||
first: "n",
|
||||
last: "z"
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
186
node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js
generated
vendored
186
node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js
generated
vendored
@@ -1,186 +0,0 @@
|
||||
/**
|
||||
* @filedescription Merge Strategy Tests
|
||||
*/
|
||||
/* global it, describe, beforeEach */
|
||||
|
||||
"use strict";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const assert = require("chai").assert;
|
||||
const { ValidationStrategy } = require("../src/");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Class
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
describe("ValidationStrategy", () => {
|
||||
|
||||
describe("boolean", () => {
|
||||
it("should not throw an error when the value is a boolean", () => {
|
||||
ValidationStrategy.boolean(true);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is null", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.boolean(null);
|
||||
}, /Expected a Boolean/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is a string", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.boolean("foo");
|
||||
}, /Expected a Boolean/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is a number", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.boolean(123);
|
||||
}, /Expected a Boolean/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is an object", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.boolean({});
|
||||
}, /Expected a Boolean/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("number", () => {
|
||||
it("should not throw an error when the value is a number", () => {
|
||||
ValidationStrategy.number(25);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is null", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.number(null);
|
||||
}, /Expected a number/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is a string", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.number("foo");
|
||||
}, /Expected a number/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is a boolean", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.number(true);
|
||||
}, /Expected a number/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is an object", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.number({});
|
||||
}, /Expected a number/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("object", () => {
|
||||
it("should not throw an error when the value is an object", () => {
|
||||
ValidationStrategy.object({});
|
||||
});
|
||||
|
||||
it("should throw an error when the value is null", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.object(null);
|
||||
}, /Expected an object/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is a string", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.object("");
|
||||
}, /Expected an object/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("array", () => {
|
||||
it("should not throw an error when the value is an array", () => {
|
||||
ValidationStrategy.array([]);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is null", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.array(null);
|
||||
}, /Expected an array/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is a string", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.array("");
|
||||
}, /Expected an array/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is an object", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.array({});
|
||||
}, /Expected an array/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("object?", () => {
|
||||
it("should not throw an error when the value is an object", () => {
|
||||
ValidationStrategy["object?"]({});
|
||||
});
|
||||
|
||||
it("should not throw an error when the value is null", () => {
|
||||
ValidationStrategy["object?"](null);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is a string", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy["object?"]("");
|
||||
}, /Expected an object/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("string", () => {
|
||||
it("should not throw an error when the value is a string", () => {
|
||||
ValidationStrategy.string("foo");
|
||||
});
|
||||
|
||||
it("should not throw an error when the value is an empty string", () => {
|
||||
ValidationStrategy.string("");
|
||||
});
|
||||
|
||||
it("should throw an error when the value is null", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.string(null);
|
||||
}, /Expected a string/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is an object", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy.string({});
|
||||
}, /Expected a string/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("string!", () => {
|
||||
it("should not throw an error when the value is an string", () => {
|
||||
ValidationStrategy["string!"]("foo");
|
||||
});
|
||||
|
||||
it("should throw an error when the value is an empty string", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy["string!"]("");
|
||||
}, /Expected a non-empty string/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is null", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy["string!"](null);
|
||||
}, /Expected a non-empty string/);
|
||||
});
|
||||
|
||||
it("should throw an error when the value is an object", () => {
|
||||
assert.throws(() => {
|
||||
ValidationStrategy["string!"]({});
|
||||
}, /Expected a non-empty string/);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
73
node_modules/@sinonjs/fake-timers/README.md
generated
vendored
73
node_modules/@sinonjs/fake-timers/README.md
generated
vendored
@@ -3,19 +3,27 @@
|
||||
[](https://codecov.io/gh/sinonjs/fake-timers)
|
||||
<a href="CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
|
||||
|
||||
JavaScript implementation of the timer APIs; `setTimeout`, `clearTimeout`, `setImmediate`, `clearImmediate`, `setInterval`, `clearInterval`, `requestAnimationFrame`, `cancelAnimationFrame`, `requestIdleCallback`, and `cancelIdleCallback`, along with a clock instance that controls the flow of time. FakeTimers also provides a `Date` implementation that gets its time from the clock.
|
||||
JavaScript implementation of the timer
|
||||
APIs; `setTimeout`, `clearTimeout`, `setImmediate`, `clearImmediate`, `setInterval`, `clearInterval`, `requestAnimationFrame`, `cancelAnimationFrame`, `requestIdleCallback`,
|
||||
and `cancelIdleCallback`, along with a clock instance that controls the flow of time. FakeTimers also provides a `Date`
|
||||
implementation that gets its time from the clock.
|
||||
|
||||
In addition in browser environment `@sinonjs/fake-timers` provides a `performance` implementation that gets its time from the clock. In Node environments FakeTimers provides a `nextTick` implementation that is synchronized with the clock - and a `process.hrtime` shim that works with the clock.
|
||||
In addition in browser environment `@sinonjs/fake-timers` provides a `performance` implementation that gets its time
|
||||
from the clock. In Node environments FakeTimers provides a `nextTick` implementation that is synchronized with the
|
||||
clock - and a `process.hrtime` shim that works with the clock.
|
||||
|
||||
`@sinonjs/fake-timers` can be used to simulate passing time in automated tests and other
|
||||
situations where you want the scheduling semantics, but don't want to actually
|
||||
wait.
|
||||
|
||||
`@sinonjs/fake-timers` is extracted from [Sinon.JS](https://github.com/sinonjs/sinon.js) and targets the [same runtimes](https://sinonjs.org/releases/latest/#supported-runtimes).
|
||||
`@sinonjs/fake-timers` is extracted from [Sinon.JS](https://github.com/sinonjs/sinon.js) and targets
|
||||
the [same runtimes](https://sinonjs.org/releases/latest/#supported-runtimes).
|
||||
|
||||
## Autocomplete, IntelliSense and TypeScript definitions
|
||||
|
||||
Version 7 introduced JSDoc to the codebase. This should provide autocomplete and type suggestions in supporting IDEs. If you need more elaborate type support, TypeScript definitions for the Sinon projects are independently maintained by the Definitely Types community:
|
||||
Version 7 introduced JSDoc to the codebase. This should provide autocomplete and type suggestions in supporting IDEs. If
|
||||
you need more elaborate type support, TypeScript definitions for the Sinon projects are independently maintained by the
|
||||
Definitely Types community:
|
||||
|
||||
```
|
||||
npm install -D @types/sinonjs__fake-timers
|
||||
@@ -29,7 +37,8 @@ npm install -D @types/sinonjs__fake-timers
|
||||
npm install @sinonjs/fake-timers
|
||||
```
|
||||
|
||||
If you want to use `@sinonjs/fake-timers` in a browser you can either build your own bundle or use [Skypack](https://www.skypack.dev).
|
||||
If you want to use `@sinonjs/fake-timers` in a browser you can either build your own bundle or
|
||||
use [Skypack](https://www.skypack.dev).
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -54,7 +63,8 @@ clock.tick(15);
|
||||
|
||||
Upon executing the last line, an interesting fact about the
|
||||
[Poblano](https://en.wikipedia.org/wiki/Poblano) will be printed synchronously to
|
||||
the screen. If you want to simulate asynchronous behavior, please see the `async` function variants (eg `clock.tick(time)` vs `await clock.tickAsync(time)`).
|
||||
the screen. If you want to simulate asynchronous behavior, please see the `async` function variants (
|
||||
eg `clock.tick(time)` vs `await clock.tickAsync(time)`).
|
||||
|
||||
The `next`, `runAll`, `runToFrame`, and `runToLast` methods are available to advance the clock. See the
|
||||
API Reference for more details.
|
||||
@@ -67,7 +77,9 @@ clock instance, not the browser's internals.
|
||||
|
||||
Calling `install` with no arguments achieves this. You can call `uninstall`
|
||||
later to restore things as they were again.
|
||||
Note that in NodeJS also the [timers](https://nodejs.org/api/timers.html) module will receive fake timers when using global scope.
|
||||
Note that in NodeJS the [timers](https://nodejs.org/api/timers.html)
|
||||
and [timers/promises](https://nodejs.org/api/timers.html#timers-promises-api) modules will also receive fake timers when
|
||||
using global scope.
|
||||
|
||||
```js
|
||||
// In the browser distribution, a global `FakeTimers` is already available
|
||||
@@ -143,22 +155,26 @@ Creates a clock. The default
|
||||
|
||||
The `now` argument may be a number (in milliseconds) or a Date object.
|
||||
|
||||
The `loopLimit` argument sets the maximum number of timers that will be run when calling `runAll()` before assuming that we have an infinite loop and throwing an error. The default is `1000`.
|
||||
The `loopLimit` argument sets the maximum number of timers that will be run when calling `runAll()` before assuming that
|
||||
we have an infinite loop and throwing an error. The default is `1000`.
|
||||
|
||||
### `var clock = FakeTimers.install([config])`
|
||||
|
||||
Installs FakeTimers using the specified config (otherwise with epoch `0` on the global scope).
|
||||
Note that in NodeJS also the [timers](https://nodejs.org/api/timers.html) module will receive fake timers when using global scope.
|
||||
Note that in NodeJS the [timers](https://nodejs.org/api/timers.html)
|
||||
and [timers/promises](https://nodejs.org/api/timers.html#timers-promises-api) modules will also receive fake timers when
|
||||
using global scope.
|
||||
The following configuration options are available
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
| -------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `config.now` | Number/Date | 0 | installs FakeTimers with the specified unix epoch |
|
||||
| `config.toFake` | String[] | ["setTimeout", "clearTimeout", "setImmediate", "clearImmediate","setInterval", "clearInterval", "Date", "requestAnimationFrame", "cancelAnimationFrame", "requestIdleCallback", "cancelIdleCallback", "hrtime", "performance"] | an array with explicit function names (or objects, in the case of "performance") to hijack. _When not set, FakeTimers will automatically fake all methods **except** `nextTick`_ e.g., `FakeTimers.install({ toFake: ["setTimeout","nextTick"]})` will fake only `setTimeout` and `nextTick` |
|
||||
| `config.toFake` | String[] | ["setTimeout", "clearTimeout", "setImmediate", "clearImmediate","setInterval", "clearInterval", "Date", "requestAnimationFrame", "cancelAnimationFrame", "requestIdleCallback", "cancelIdleCallback", "hrtime", "performance"] | an array with explicit function names (or objects, in the case of "performance") to hijack. \_When not set, FakeTimers will automatically fake all methods e.g., `FakeTimers.install({ toFake: ["setTimeout","nextTick"]})` will fake only `setTimeout` and `nextTick` |
|
||||
| `config.loopLimit` | Number | 1000 | the maximum number of timers that will be run when calling runAll() |
|
||||
| `config.shouldAdvanceTime` | Boolean | false | tells FakeTimers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by 20ms for every 20ms change in the real system time) |
|
||||
| `config.advanceTimeDelta` | Number | 20 | relevant only when using with `shouldAdvanceTime: true`. increment mocked time by `advanceTimeDelta` ms every `advanceTimeDelta` ms change in the real system time. |
|
||||
| `config.shouldClearNativeTimers` | Boolean | false | tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers. These are not cleared by default, leading to potentially unexpected behavior if timers existed prior to installing FakeTimers. |
|
||||
| `config.ignoreMissingTimers` | Boolean | false | tells FakeTimers to ignore missing timers that might not exist in the given environment |
|
||||
|
||||
### `var id = clock.setTimeout(callback, timeout)`
|
||||
|
||||
@@ -218,7 +234,9 @@ Cancels the callback scheduled by the provided id.
|
||||
|
||||
### `clock.requestIdleCallback(callback[, timeout])`
|
||||
|
||||
Queued the callback to be fired during idle periods to perform background and low priority work on the main event loop. Callbacks which have a timeout option will be fired no later than time in milliseconds. Returns an `id` which can be used to cancel the callback.
|
||||
Queued the callback to be fired during idle periods to perform background and low priority work on the main event loop.
|
||||
Callbacks which have a timeout option will be fired no later than time in milliseconds. Returns an `id` which can be
|
||||
used to cancel the callback.
|
||||
|
||||
### `clock.cancelIdleCallback(id)`
|
||||
|
||||
@@ -263,7 +281,8 @@ callbacks to execute _before_ running the timers.
|
||||
Advance the clock by jumping forward in time, firing callbacks at most once.
|
||||
`time` takes the same formats as [`clock.tick`](#clockticktime--await-clocktickasynctime).
|
||||
|
||||
This can be used to simulate the JS engine (such as a browser) being put to sleep and resumed later, skipping intermediary timers.
|
||||
This can be used to simulate the JS engine (such as a browser) being put to sleep and resumed later, skipping
|
||||
intermediary timers.
|
||||
|
||||
### `clock.reset()`
|
||||
|
||||
@@ -273,9 +292,11 @@ Useful to reset the state of the clock without having to `uninstall` and `instal
|
||||
|
||||
### `clock.runAll()` / `await clock.runAllAsync()`
|
||||
|
||||
This runs all pending timers until there are none remaining. If new timers are added while it is executing they will be run as well.
|
||||
This runs all pending timers until there are none remaining. If new timers are added while it is executing they will be
|
||||
run as well.
|
||||
|
||||
This makes it easier to run asynchronous tests to completion without worrying about the number of timers they use, or the delays in those timers.
|
||||
This makes it easier to run asynchronous tests to completion without worrying about the number of timers they use, or
|
||||
the delays in those timers.
|
||||
|
||||
It runs a maximum of `loopLimit` times after which it assumes there is an infinite loop of timers and throws an error.
|
||||
|
||||
@@ -284,7 +305,8 @@ callbacks to execute _before_ running the timers.
|
||||
|
||||
### `clock.runMicrotasks()`
|
||||
|
||||
This runs all pending microtasks scheduled with `nextTick` but none of the timers and is mostly useful for libraries using FakeTimers underneath and for running `nextTick` items without any timers.
|
||||
This runs all pending microtasks scheduled with `nextTick` but none of the timers and is mostly useful for libraries
|
||||
using FakeTimers underneath and for running `nextTick` items without any timers.
|
||||
|
||||
### `clock.runToFrame()`
|
||||
|
||||
@@ -323,11 +345,22 @@ Implements the `Date` object but using the clock to provide the correct time.
|
||||
|
||||
### `Performance`
|
||||
|
||||
Implements the `now` method of the [`Performance`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) object but using the clock to provide the correct time. Only available in environments that support the Performance object (browsers mostly).
|
||||
Implements the `now` method of the [`Performance`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now)
|
||||
object but using the clock to provide the correct time. Only available in environments that support the Performance
|
||||
object (browsers mostly).
|
||||
|
||||
### `FakeTimers.withGlobal`
|
||||
|
||||
In order to support creating clocks based on separate or sandboxed environments (such as JSDOM), FakeTimers exports a factory method which takes single argument `global`, which it inspects to figure out what to mock and what features to support. When invoking this function with a global, you will get back an object with `timers`, `createClock` and `install` - same as the regular FakeTimers exports only based on the passed in global instead of the global environment.
|
||||
In order to support creating clocks based on separate or sandboxed environments (such as JSDOM), FakeTimers exports a
|
||||
factory method which takes single argument `global`, which it inspects to figure out what to mock and what features to
|
||||
support. When invoking this function with a global, you will get back an object with `timers`, `createClock`
|
||||
and `install` - same as the regular FakeTimers exports only based on the passed in global instead of the global
|
||||
environment.
|
||||
|
||||
## Promises and fake time
|
||||
|
||||
If you use a Promise library like Bluebird, note that you should either call `clock.runMicrotasks()` or make sure to
|
||||
_not_ mock `nextTick`.
|
||||
|
||||
## Running tests
|
||||
|
||||
@@ -349,8 +382,8 @@ $(npm bin)/mocha ./test/fake-timers-test.js
|
||||
|
||||
### In the browser
|
||||
|
||||
[Mochify](https://github.com/mantoni/mochify.js) is used to run the tests in
|
||||
PhantomJS. Make sure you have `phantomjs` installed. Then:
|
||||
[Mochify](https://github.com/mochify-js) is used to run the tests in headless
|
||||
Chrome.
|
||||
|
||||
```sh
|
||||
npm test-headless
|
||||
|
||||
45
node_modules/@sinonjs/fake-timers/package.json
generated
vendored
45
node_modules/@sinonjs/fake-timers/package.json
generated
vendored
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@sinonjs/fake-timers",
|
||||
"description": "Fake JavaScript timers",
|
||||
"version": "11.2.2",
|
||||
"version": "13.0.2",
|
||||
"homepage": "https://github.com/sinonjs/fake-timers",
|
||||
"author": "Christian Johansen",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sinonjs/fake-timers.git"
|
||||
"url": "git+https://github.com/sinonjs/fake-timers.git"
|
||||
},
|
||||
"bugs": {
|
||||
"mail": "christian@cjohansen.no",
|
||||
@@ -16,39 +16,52 @@
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test-node": "mocha --timeout 200 test/ integration-test/ -R dot --check-leaks",
|
||||
"test-headless": "mochify --no-detect-globals --timeout=10000",
|
||||
"test-headless": "mochify --driver puppeteer",
|
||||
"test-check-coverage": "npm run test-coverage && nyc check-coverage",
|
||||
"test-cloud": "mochify --wd --no-detect-globals --timeout=10000",
|
||||
"test-coverage": "nyc --all --reporter text --reporter html --reporter lcovonly npm run test-node",
|
||||
"test-cloud": "npm run test-edge && npm run test-firefox && npm run test-safari",
|
||||
"test-edge": "BROWSER_NAME=MicrosoftEdge mochify --config mochify.webdriver.js",
|
||||
"test-firefox": "BROWSER_NAME=firefox mochify --config mochify.webdriver.js",
|
||||
"test-safari": "BROWSER_NAME=safari mochify --config mochify.webdriver.js",
|
||||
"test-coverage": "nyc -x mochify.webdriver.js -x coverage --all --reporter text --reporter html --reporter lcovonly npm run test-node",
|
||||
"test": "npm run test-node && npm run test-headless",
|
||||
"prettier:check": "prettier --check '**/*.{js,css,md}'",
|
||||
"prettier:write": "prettier --write '**/*.{js,css,md}'",
|
||||
"preversion": "./scripts/preversion.sh",
|
||||
"version": "./scripts/version.sh",
|
||||
"postversion": "./scripts/postversion.sh",
|
||||
"prepare": "husky install"
|
||||
"prepare": "husky"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,css,md}": "prettier --check",
|
||||
"*.js": "eslint"
|
||||
},
|
||||
"mochify": {
|
||||
"reporter": "dot",
|
||||
"timeout": 10000,
|
||||
"bundle": "esbuild --bundle --sourcemap=inline --define:process.env.NODE_DEBUG=\"\"",
|
||||
"bundle_stdin": "require",
|
||||
"spec": "test/**/*-test.js"
|
||||
},
|
||||
"files": [
|
||||
"src/"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@sinonjs/eslint-config": "^4.1.0",
|
||||
"@sinonjs/referee-sinon": "11.0.0",
|
||||
"husky": "^8.0.3",
|
||||
"jsdom": "22.1.0",
|
||||
"lint-staged": "15.0.1",
|
||||
"mocha": "10.2.0",
|
||||
"mochify": "9.2.0",
|
||||
"nyc": "15.1.0",
|
||||
"prettier": "3.0.3"
|
||||
"@mochify/cli": "^0.4.1",
|
||||
"@mochify/driver-puppeteer": "^0.4.0",
|
||||
"@mochify/driver-webdriver": "^0.2.1",
|
||||
"@sinonjs/eslint-config": "^5.0.3",
|
||||
"@sinonjs/referee-sinon": "12.0.0",
|
||||
"esbuild": "^0.23.1",
|
||||
"husky": "^9.1.5",
|
||||
"jsdom": "24.1.1",
|
||||
"lint-staged": "15.2.9",
|
||||
"mocha": "10.7.3",
|
||||
"nyc": "17.0.0",
|
||||
"prettier": "3.3.3"
|
||||
},
|
||||
"main": "./src/fake-timers-src.js",
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^3.0.0"
|
||||
"@sinonjs/commons": "^3.0.1"
|
||||
},
|
||||
"nyc": {
|
||||
"branches": 85,
|
||||
|
||||
554
node_modules/@sinonjs/fake-timers/src/fake-timers-src.js
generated
vendored
554
node_modules/@sinonjs/fake-timers/src/fake-timers-src.js
generated
vendored
@@ -1,13 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
const globalObject = require("@sinonjs/commons").global;
|
||||
let timersModule;
|
||||
let timersModule, timersPromisesModule;
|
||||
if (typeof require === "function" && typeof module === "object") {
|
||||
try {
|
||||
timersModule = require("timers");
|
||||
} catch (e) {
|
||||
// ignored
|
||||
}
|
||||
try {
|
||||
timersPromisesModule = require("timers/promises");
|
||||
} catch (e) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,6 +99,8 @@ if (typeof require === "function" && typeof module === "object") {
|
||||
* @property {Function[]} methods - the methods that are faked
|
||||
* @property {boolean} [shouldClearNativeTimers] inherited from config
|
||||
* @property {{methodName:string, original:any}[] | undefined} timersModuleMethods
|
||||
* @property {{methodName:string, original:any}[] | undefined} timersPromisesModuleMethods
|
||||
* @property {Map<function(): void, AbortSignal>} abortListenerMap
|
||||
*/
|
||||
/* eslint-enable jsdoc/require-property-description */
|
||||
|
||||
@@ -107,6 +114,7 @@ if (typeof require === "function" && typeof module === "object") {
|
||||
* @property {boolean} [shouldAdvanceTime] tells FakeTimers to increment mocked time automatically (default false)
|
||||
* @property {number} [advanceTimeDelta] increment mocked time every <<advanceTimeDelta>> ms (default: 20ms)
|
||||
* @property {boolean} [shouldClearNativeTimers] forwards clear timer calls to native functions if they are not fakes (default: false)
|
||||
* @property {boolean} [ignoreMissingTimers] default is false, meaning asking to fake timers that are not present will throw an error
|
||||
*/
|
||||
|
||||
/* eslint-disable jsdoc/require-property-description */
|
||||
@@ -151,16 +159,26 @@ function withGlobal(_global) {
|
||||
const NOOP_ARRAY = function () {
|
||||
return [];
|
||||
};
|
||||
const timeoutResult = _global.setTimeout(NOOP, 0);
|
||||
const addTimerReturnsObject = typeof timeoutResult === "object";
|
||||
const hrtimePresent =
|
||||
const isPresent = {};
|
||||
let timeoutResult,
|
||||
addTimerReturnsObject = false;
|
||||
|
||||
if (_global.setTimeout) {
|
||||
isPresent.setTimeout = true;
|
||||
timeoutResult = _global.setTimeout(NOOP, 0);
|
||||
addTimerReturnsObject = typeof timeoutResult === "object";
|
||||
}
|
||||
isPresent.clearTimeout = Boolean(_global.clearTimeout);
|
||||
isPresent.setInterval = Boolean(_global.setInterval);
|
||||
isPresent.clearInterval = Boolean(_global.clearInterval);
|
||||
isPresent.hrtime =
|
||||
_global.process && typeof _global.process.hrtime === "function";
|
||||
const hrtimeBigintPresent =
|
||||
hrtimePresent && typeof _global.process.hrtime.bigint === "function";
|
||||
const nextTickPresent =
|
||||
isPresent.hrtimeBigint =
|
||||
isPresent.hrtime && typeof _global.process.hrtime.bigint === "function";
|
||||
isPresent.nextTick =
|
||||
_global.process && typeof _global.process.nextTick === "function";
|
||||
const utilPromisify = _global.process && require("util").promisify;
|
||||
const performancePresent =
|
||||
isPresent.performance =
|
||||
_global.performance && typeof _global.performance.now === "function";
|
||||
const hasPerformancePrototype =
|
||||
_global.Performance &&
|
||||
@@ -169,29 +187,60 @@ function withGlobal(_global) {
|
||||
_global.performance &&
|
||||
_global.performance.constructor &&
|
||||
_global.performance.constructor.prototype;
|
||||
const queueMicrotaskPresent = _global.hasOwnProperty("queueMicrotask");
|
||||
const requestAnimationFramePresent =
|
||||
isPresent.queueMicrotask = _global.hasOwnProperty("queueMicrotask");
|
||||
isPresent.requestAnimationFrame =
|
||||
_global.requestAnimationFrame &&
|
||||
typeof _global.requestAnimationFrame === "function";
|
||||
const cancelAnimationFramePresent =
|
||||
isPresent.cancelAnimationFrame =
|
||||
_global.cancelAnimationFrame &&
|
||||
typeof _global.cancelAnimationFrame === "function";
|
||||
const requestIdleCallbackPresent =
|
||||
isPresent.requestIdleCallback =
|
||||
_global.requestIdleCallback &&
|
||||
typeof _global.requestIdleCallback === "function";
|
||||
const cancelIdleCallbackPresent =
|
||||
isPresent.cancelIdleCallbackPresent =
|
||||
_global.cancelIdleCallback &&
|
||||
typeof _global.cancelIdleCallback === "function";
|
||||
const setImmediatePresent =
|
||||
isPresent.setImmediate =
|
||||
_global.setImmediate && typeof _global.setImmediate === "function";
|
||||
const intlPresent = _global.Intl && typeof _global.Intl === "object";
|
||||
isPresent.clearImmediate =
|
||||
_global.clearImmediate && typeof _global.clearImmediate === "function";
|
||||
isPresent.Intl = _global.Intl && typeof _global.Intl === "object";
|
||||
|
||||
if (_global.clearTimeout) {
|
||||
_global.clearTimeout(timeoutResult);
|
||||
}
|
||||
|
||||
const NativeDate = _global.Date;
|
||||
const NativeIntl = _global.Intl;
|
||||
let uniqueTimerId = idCounterStart;
|
||||
|
||||
if (NativeDate === undefined) {
|
||||
throw new Error(
|
||||
"The global scope doesn't have a `Date` object" +
|
||||
" (see https://github.com/sinonjs/sinon/issues/1852#issuecomment-419622780)",
|
||||
);
|
||||
}
|
||||
isPresent.Date = true;
|
||||
|
||||
/**
|
||||
* The PerformanceEntry object encapsulates a single performance metric
|
||||
* that is part of the browser's performance timeline.
|
||||
*
|
||||
* This is an object returned by the `mark` and `measure` methods on the Performance prototype
|
||||
*/
|
||||
class FakePerformanceEntry {
|
||||
constructor(name, entryType, startTime, duration) {
|
||||
this.name = name;
|
||||
this.entryType = entryType;
|
||||
this.startTime = startTime;
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return JSON.stringify({ ...this });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} num
|
||||
* @returns {boolean}
|
||||
@@ -376,53 +425,9 @@ function withGlobal(_global) {
|
||||
return infiniteLoopError;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Date} target
|
||||
* @param {Date} source
|
||||
* @returns {Date} the target after modifications
|
||||
*/
|
||||
function mirrorDateProperties(target, source) {
|
||||
let prop;
|
||||
for (prop in source) {
|
||||
if (source.hasOwnProperty(prop)) {
|
||||
target[prop] = source[prop];
|
||||
}
|
||||
}
|
||||
|
||||
// set special now implementation
|
||||
if (source.now) {
|
||||
target.now = function now() {
|
||||
return target.clock.now;
|
||||
};
|
||||
} else {
|
||||
delete target.now;
|
||||
}
|
||||
|
||||
// set special toSource implementation
|
||||
if (source.toSource) {
|
||||
target.toSource = function toSource() {
|
||||
return source.toSource();
|
||||
};
|
||||
} else {
|
||||
delete target.toSource;
|
||||
}
|
||||
|
||||
// set special toString implementation
|
||||
target.toString = function toString() {
|
||||
return source.toString();
|
||||
};
|
||||
|
||||
target.prototype = source.prototype;
|
||||
target.parse = source.parse;
|
||||
target.UTC = source.UTC;
|
||||
target.prototype.toUTCString = source.prototype.toUTCString;
|
||||
target.isFake = true;
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
//eslint-disable-next-line jsdoc/require-jsdoc
|
||||
function createDate() {
|
||||
class ClockDate extends NativeDate {
|
||||
/**
|
||||
* @param {number} year
|
||||
* @param {number} month
|
||||
@@ -431,54 +436,65 @@ function withGlobal(_global) {
|
||||
* @param {number} minute
|
||||
* @param {number} second
|
||||
* @param {number} ms
|
||||
* @returns {Date}
|
||||
* @returns void
|
||||
*/
|
||||
function ClockDate(year, month, date, hour, minute, second, ms) {
|
||||
// the Date constructor called as a function, ref Ecma-262 Edition 5.1, section 15.9.2.
|
||||
// This remains so in the 10th edition of 2019 as well.
|
||||
if (!(this instanceof ClockDate)) {
|
||||
return new NativeDate(ClockDate.clock.now).toString();
|
||||
}
|
||||
|
||||
// if Date is called as a constructor with 'new' keyword
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
constructor(year, month, date, hour, minute, second, ms) {
|
||||
// Defensive and verbose to avoid potential harm in passing
|
||||
// explicit undefined when user does not pass argument
|
||||
switch (arguments.length) {
|
||||
case 0:
|
||||
return new NativeDate(ClockDate.clock.now);
|
||||
case 1:
|
||||
return new NativeDate(year);
|
||||
case 2:
|
||||
return new NativeDate(year, month);
|
||||
case 3:
|
||||
return new NativeDate(year, month, date);
|
||||
case 4:
|
||||
return new NativeDate(year, month, date, hour);
|
||||
case 5:
|
||||
return new NativeDate(year, month, date, hour, minute);
|
||||
case 6:
|
||||
return new NativeDate(
|
||||
year,
|
||||
month,
|
||||
date,
|
||||
hour,
|
||||
minute,
|
||||
second,
|
||||
);
|
||||
default:
|
||||
return new NativeDate(
|
||||
year,
|
||||
month,
|
||||
date,
|
||||
hour,
|
||||
minute,
|
||||
second,
|
||||
ms,
|
||||
);
|
||||
if (arguments.length === 0) {
|
||||
super(ClockDate.clock.now);
|
||||
} else {
|
||||
super(...arguments);
|
||||
}
|
||||
}
|
||||
|
||||
return mirrorDateProperties(ClockDate, NativeDate);
|
||||
static [Symbol.hasInstance](instance) {
|
||||
return instance instanceof NativeDate;
|
||||
}
|
||||
}
|
||||
|
||||
ClockDate.isFake = true;
|
||||
|
||||
if (NativeDate.now) {
|
||||
ClockDate.now = function now() {
|
||||
return ClockDate.clock.now;
|
||||
};
|
||||
}
|
||||
|
||||
if (NativeDate.toSource) {
|
||||
ClockDate.toSource = function toSource() {
|
||||
return NativeDate.toSource();
|
||||
};
|
||||
}
|
||||
|
||||
ClockDate.toString = function toString() {
|
||||
return NativeDate.toString();
|
||||
};
|
||||
|
||||
// noinspection UnnecessaryLocalVariableJS
|
||||
/**
|
||||
* A normal Class constructor cannot be called without `new`, but Date can, so we need
|
||||
* to wrap it in a Proxy in order to ensure this functionality of Date is kept intact
|
||||
*
|
||||
* @type {ClockDate}
|
||||
*/
|
||||
const ClockDateProxy = new Proxy(ClockDate, {
|
||||
// handler for [[Call]] invocations (i.e. not using `new`)
|
||||
apply() {
|
||||
// the Date constructor called as a function, ref Ecma-262 Edition 5.1, section 15.9.2.
|
||||
// This remains so in the 10th edition of 2019 as well.
|
||||
if (this instanceof ClockDate) {
|
||||
throw new TypeError(
|
||||
"A Proxy should only capture `new` calls with the `construct` handler. This is not supposed to be possible, so check the logic.",
|
||||
);
|
||||
}
|
||||
|
||||
return new NativeDate(ClockDate.clock.now).toString();
|
||||
},
|
||||
});
|
||||
|
||||
return ClockDateProxy;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -931,6 +947,16 @@ function withGlobal(_global) {
|
||||
timersModule[entry.methodName] = entry.original;
|
||||
}
|
||||
}
|
||||
if (clock.timersPromisesModuleMethods !== undefined) {
|
||||
for (
|
||||
let j = 0;
|
||||
j < clock.timersPromisesModuleMethods.length;
|
||||
j++
|
||||
) {
|
||||
const entry = clock.timersPromisesModuleMethods[j];
|
||||
timersPromisesModule[entry.methodName] = entry.original;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.shouldAdvanceTime === true) {
|
||||
@@ -940,6 +966,11 @@ function withGlobal(_global) {
|
||||
// Prevent multiple executions which will completely remove these props
|
||||
clock.methods = [];
|
||||
|
||||
for (const [listener, signal] of clock.abortListenerMap.entries()) {
|
||||
signal.removeEventListener("abort", listener);
|
||||
clock.abortListenerMap.delete(listener);
|
||||
}
|
||||
|
||||
// return pending timers, to enable checking what timers remained on uninstall
|
||||
if (!clock.timers) {
|
||||
return [];
|
||||
@@ -962,8 +993,7 @@ function withGlobal(_global) {
|
||||
clock[`_${method}`] = target[method];
|
||||
|
||||
if (method === "Date") {
|
||||
const date = mirrorDateProperties(clock[method], target[method]);
|
||||
target[method] = date;
|
||||
target[method] = clock[method];
|
||||
} else if (method === "Intl") {
|
||||
target[method] = clock[method];
|
||||
} else if (method === "performance") {
|
||||
@@ -1042,44 +1072,47 @@ function withGlobal(_global) {
|
||||
Date: _global.Date,
|
||||
};
|
||||
|
||||
if (setImmediatePresent) {
|
||||
if (isPresent.setImmediate) {
|
||||
timers.setImmediate = _global.setImmediate;
|
||||
}
|
||||
|
||||
if (isPresent.clearImmediate) {
|
||||
timers.clearImmediate = _global.clearImmediate;
|
||||
}
|
||||
|
||||
if (hrtimePresent) {
|
||||
if (isPresent.hrtime) {
|
||||
timers.hrtime = _global.process.hrtime;
|
||||
}
|
||||
|
||||
if (nextTickPresent) {
|
||||
if (isPresent.nextTick) {
|
||||
timers.nextTick = _global.process.nextTick;
|
||||
}
|
||||
|
||||
if (performancePresent) {
|
||||
if (isPresent.performance) {
|
||||
timers.performance = _global.performance;
|
||||
}
|
||||
|
||||
if (requestAnimationFramePresent) {
|
||||
if (isPresent.requestAnimationFrame) {
|
||||
timers.requestAnimationFrame = _global.requestAnimationFrame;
|
||||
}
|
||||
|
||||
if (queueMicrotaskPresent) {
|
||||
timers.queueMicrotask = true;
|
||||
if (isPresent.queueMicrotask) {
|
||||
timers.queueMicrotask = _global.queueMicrotask;
|
||||
}
|
||||
|
||||
if (cancelAnimationFramePresent) {
|
||||
if (isPresent.cancelAnimationFrame) {
|
||||
timers.cancelAnimationFrame = _global.cancelAnimationFrame;
|
||||
}
|
||||
|
||||
if (requestIdleCallbackPresent) {
|
||||
if (isPresent.requestIdleCallback) {
|
||||
timers.requestIdleCallback = _global.requestIdleCallback;
|
||||
}
|
||||
|
||||
if (cancelIdleCallbackPresent) {
|
||||
if (isPresent.cancelIdleCallback) {
|
||||
timers.cancelIdleCallback = _global.cancelIdleCallback;
|
||||
}
|
||||
|
||||
if (intlPresent) {
|
||||
if (isPresent.Intl) {
|
||||
timers.Intl = _global.Intl;
|
||||
}
|
||||
|
||||
@@ -1098,13 +1131,6 @@ function withGlobal(_global) {
|
||||
let nanos = 0;
|
||||
const adjustedSystemTime = [0, 0]; // [millis, nanoremainder]
|
||||
|
||||
if (NativeDate === undefined) {
|
||||
throw new Error(
|
||||
"The global scope doesn't have a `Date` object" +
|
||||
" (see https://github.com/sinonjs/sinon/issues/1852#issuecomment-419622780)",
|
||||
);
|
||||
}
|
||||
|
||||
const clock = {
|
||||
now: start,
|
||||
Date: createDate(),
|
||||
@@ -1165,14 +1191,14 @@ function withGlobal(_global) {
|
||||
return millis;
|
||||
}
|
||||
|
||||
if (hrtimeBigintPresent) {
|
||||
if (isPresent.hrtimeBigint) {
|
||||
hrtime.bigint = function () {
|
||||
const parts = hrtime();
|
||||
return BigInt(parts[0]) * BigInt(1e9) + BigInt(parts[1]); // eslint-disable-line
|
||||
};
|
||||
}
|
||||
|
||||
if (intlPresent) {
|
||||
if (isPresent.Intl) {
|
||||
clock.Intl = createIntl();
|
||||
clock.Intl.clock = clock;
|
||||
}
|
||||
@@ -1257,7 +1283,7 @@ function withGlobal(_global) {
|
||||
return clearTimer(clock, timerId, "Interval");
|
||||
};
|
||||
|
||||
if (setImmediatePresent) {
|
||||
if (isPresent.setImmediate) {
|
||||
clock.setImmediate = function setImmediate(func) {
|
||||
return addTimer(clock, {
|
||||
func: func,
|
||||
@@ -1696,12 +1722,12 @@ function withGlobal(_global) {
|
||||
clock.tick(ms);
|
||||
};
|
||||
|
||||
if (performancePresent) {
|
||||
if (isPresent.performance) {
|
||||
clock.performance = Object.create(null);
|
||||
clock.performance.now = fakePerformanceNow;
|
||||
}
|
||||
|
||||
if (hrtimePresent) {
|
||||
if (isPresent.hrtime) {
|
||||
clock.hrtime = hrtime;
|
||||
}
|
||||
|
||||
@@ -1749,6 +1775,20 @@ function withGlobal(_global) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} timer/object the name of the thing that is not present
|
||||
* @param timer
|
||||
*/
|
||||
function handleMissingTimer(timer) {
|
||||
if (config.ignoreMissingTimers) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new ReferenceError(
|
||||
`non-existent timers and/or objects cannot be faked: '${timer}'`,
|
||||
);
|
||||
}
|
||||
|
||||
let i, l;
|
||||
const clock = createClock(config.now, config.loopLimit);
|
||||
clock.shouldClearNativeTimers = config.shouldClearNativeTimers;
|
||||
@@ -1757,13 +1797,12 @@ function withGlobal(_global) {
|
||||
return uninstall(clock, config);
|
||||
};
|
||||
|
||||
clock.abortListenerMap = new Map();
|
||||
|
||||
clock.methods = config.toFake || [];
|
||||
|
||||
if (clock.methods.length === 0) {
|
||||
// do not fake nextTick by default - GitHub#126
|
||||
clock.methods = Object.keys(timers).filter(function (key) {
|
||||
return key !== "nextTick" && key !== "queueMicrotask";
|
||||
});
|
||||
clock.methods = Object.keys(timers);
|
||||
}
|
||||
|
||||
if (config.shouldAdvanceTime === true) {
|
||||
@@ -1797,18 +1836,30 @@ function withGlobal(_global) {
|
||||
: NOOP;
|
||||
}
|
||||
});
|
||||
// ensure `mark` returns a value that is valid
|
||||
clock.performance.mark = (name) =>
|
||||
new FakePerformanceEntry(name, "mark", 0, 0);
|
||||
clock.performance.measure = (name) =>
|
||||
new FakePerformanceEntry(name, "measure", 0, 100);
|
||||
} else if ((config.toFake || []).includes("performance")) {
|
||||
// user explicitly tried to fake performance when not present
|
||||
throw new ReferenceError(
|
||||
"non-existent performance object cannot be faked",
|
||||
);
|
||||
return handleMissingTimer("performance");
|
||||
}
|
||||
}
|
||||
if (_global === globalObject && timersModule) {
|
||||
clock.timersModuleMethods = [];
|
||||
}
|
||||
if (_global === globalObject && timersPromisesModule) {
|
||||
clock.timersPromisesModuleMethods = [];
|
||||
}
|
||||
for (i = 0, l = clock.methods.length; i < l; i++) {
|
||||
const nameOfMethodToReplace = clock.methods[i];
|
||||
|
||||
if (!isPresent[nameOfMethodToReplace]) {
|
||||
handleMissingTimer(nameOfMethodToReplace);
|
||||
// eslint-disable-next-line
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nameOfMethodToReplace === "hrtime") {
|
||||
if (
|
||||
_global.process &&
|
||||
@@ -1838,6 +1889,239 @@ function withGlobal(_global) {
|
||||
timersModule[nameOfMethodToReplace] =
|
||||
_global[nameOfMethodToReplace];
|
||||
}
|
||||
if (clock.timersPromisesModuleMethods !== undefined) {
|
||||
if (nameOfMethodToReplace === "setTimeout") {
|
||||
clock.timersPromisesModuleMethods.push({
|
||||
methodName: "setTimeout",
|
||||
original: timersPromisesModule.setTimeout,
|
||||
});
|
||||
|
||||
timersPromisesModule.setTimeout = (
|
||||
delay,
|
||||
value,
|
||||
options = {},
|
||||
) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const abort = () => {
|
||||
options.signal.removeEventListener(
|
||||
"abort",
|
||||
abort,
|
||||
);
|
||||
clock.abortListenerMap.delete(abort);
|
||||
|
||||
// This is safe, there is no code path that leads to this function
|
||||
// being invoked before handle has been assigned.
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
clock.clearTimeout(handle);
|
||||
reject(options.signal.reason);
|
||||
};
|
||||
|
||||
const handle = clock.setTimeout(() => {
|
||||
if (options.signal) {
|
||||
options.signal.removeEventListener(
|
||||
"abort",
|
||||
abort,
|
||||
);
|
||||
clock.abortListenerMap.delete(abort);
|
||||
}
|
||||
|
||||
resolve(value);
|
||||
}, delay);
|
||||
|
||||
if (options.signal) {
|
||||
if (options.signal.aborted) {
|
||||
abort();
|
||||
} else {
|
||||
options.signal.addEventListener(
|
||||
"abort",
|
||||
abort,
|
||||
);
|
||||
clock.abortListenerMap.set(
|
||||
abort,
|
||||
options.signal,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (nameOfMethodToReplace === "setImmediate") {
|
||||
clock.timersPromisesModuleMethods.push({
|
||||
methodName: "setImmediate",
|
||||
original: timersPromisesModule.setImmediate,
|
||||
});
|
||||
|
||||
timersPromisesModule.setImmediate = (value, options = {}) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const abort = () => {
|
||||
options.signal.removeEventListener(
|
||||
"abort",
|
||||
abort,
|
||||
);
|
||||
clock.abortListenerMap.delete(abort);
|
||||
|
||||
// This is safe, there is no code path that leads to this function
|
||||
// being invoked before handle has been assigned.
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
clock.clearImmediate(handle);
|
||||
reject(options.signal.reason);
|
||||
};
|
||||
|
||||
const handle = clock.setImmediate(() => {
|
||||
if (options.signal) {
|
||||
options.signal.removeEventListener(
|
||||
"abort",
|
||||
abort,
|
||||
);
|
||||
clock.abortListenerMap.delete(abort);
|
||||
}
|
||||
|
||||
resolve(value);
|
||||
});
|
||||
|
||||
if (options.signal) {
|
||||
if (options.signal.aborted) {
|
||||
abort();
|
||||
} else {
|
||||
options.signal.addEventListener(
|
||||
"abort",
|
||||
abort,
|
||||
);
|
||||
clock.abortListenerMap.set(
|
||||
abort,
|
||||
options.signal,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (nameOfMethodToReplace === "setInterval") {
|
||||
clock.timersPromisesModuleMethods.push({
|
||||
methodName: "setInterval",
|
||||
original: timersPromisesModule.setInterval,
|
||||
});
|
||||
|
||||
timersPromisesModule.setInterval = (
|
||||
delay,
|
||||
value,
|
||||
options = {},
|
||||
) => ({
|
||||
[Symbol.asyncIterator]: () => {
|
||||
const createResolvable = () => {
|
||||
let resolve, reject;
|
||||
const promise = new Promise((res, rej) => {
|
||||
resolve = res;
|
||||
reject = rej;
|
||||
});
|
||||
promise.resolve = resolve;
|
||||
promise.reject = reject;
|
||||
return promise;
|
||||
};
|
||||
|
||||
let done = false;
|
||||
let hasThrown = false;
|
||||
let returnCall;
|
||||
let nextAvailable = 0;
|
||||
const nextQueue = [];
|
||||
|
||||
const handle = clock.setInterval(() => {
|
||||
if (nextQueue.length > 0) {
|
||||
nextQueue.shift().resolve();
|
||||
} else {
|
||||
nextAvailable++;
|
||||
}
|
||||
}, delay);
|
||||
|
||||
const abort = () => {
|
||||
options.signal.removeEventListener(
|
||||
"abort",
|
||||
abort,
|
||||
);
|
||||
clock.abortListenerMap.delete(abort);
|
||||
|
||||
clock.clearInterval(handle);
|
||||
done = true;
|
||||
for (const resolvable of nextQueue) {
|
||||
resolvable.resolve();
|
||||
}
|
||||
};
|
||||
|
||||
if (options.signal) {
|
||||
if (options.signal.aborted) {
|
||||
done = true;
|
||||
} else {
|
||||
options.signal.addEventListener(
|
||||
"abort",
|
||||
abort,
|
||||
);
|
||||
clock.abortListenerMap.set(
|
||||
abort,
|
||||
options.signal,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
next: async () => {
|
||||
if (options.signal?.aborted && !hasThrown) {
|
||||
hasThrown = true;
|
||||
throw options.signal.reason;
|
||||
}
|
||||
|
||||
if (done) {
|
||||
return { done: true, value: undefined };
|
||||
}
|
||||
|
||||
if (nextAvailable > 0) {
|
||||
nextAvailable--;
|
||||
return { done: false, value: value };
|
||||
}
|
||||
|
||||
const resolvable = createResolvable();
|
||||
nextQueue.push(resolvable);
|
||||
|
||||
await resolvable;
|
||||
|
||||
if (returnCall && nextQueue.length === 0) {
|
||||
returnCall.resolve();
|
||||
}
|
||||
|
||||
if (options.signal?.aborted && !hasThrown) {
|
||||
hasThrown = true;
|
||||
throw options.signal.reason;
|
||||
}
|
||||
|
||||
if (done) {
|
||||
return { done: true, value: undefined };
|
||||
}
|
||||
|
||||
return { done: false, value: value };
|
||||
},
|
||||
return: async () => {
|
||||
if (done) {
|
||||
return { done: true, value: undefined };
|
||||
}
|
||||
|
||||
if (nextQueue.length > 0) {
|
||||
returnCall = createResolvable();
|
||||
await returnCall;
|
||||
}
|
||||
|
||||
clock.clearInterval(handle);
|
||||
done = true;
|
||||
|
||||
if (options.signal) {
|
||||
options.signal.removeEventListener(
|
||||
"abort",
|
||||
abort,
|
||||
);
|
||||
clock.abortListenerMap.delete(abort);
|
||||
}
|
||||
|
||||
return { done: true, value: undefined };
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return clock;
|
||||
|
||||
10
node_modules/@sinonjs/samsam/docs/index.md
generated
vendored
10
node_modules/@sinonjs/samsam/docs/index.md
generated
vendored
@@ -249,7 +249,7 @@ samsam.match(
|
||||
return "yeah";
|
||||
},
|
||||
},
|
||||
"Yeah!"
|
||||
"Yeah!",
|
||||
); // true
|
||||
```
|
||||
|
||||
@@ -278,7 +278,7 @@ samsam.match(
|
||||
return "yeah!";
|
||||
},
|
||||
},
|
||||
/yeah/
|
||||
/yeah/,
|
||||
); // true
|
||||
samsam.match(234, /[a-z]/); // false
|
||||
```
|
||||
@@ -296,7 +296,7 @@ samsam.match(
|
||||
return "42";
|
||||
},
|
||||
},
|
||||
42
|
||||
42,
|
||||
); // true
|
||||
samsam.match(234, 1234); // false
|
||||
```
|
||||
@@ -328,7 +328,7 @@ samsam.match(
|
||||
},
|
||||
function () {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// false
|
||||
@@ -367,7 +367,7 @@ samsam.match(
|
||||
},
|
||||
{
|
||||
name: "Chris",
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// false
|
||||
|
||||
85
node_modules/@sinonjs/samsam/lib/create-matcher.js
generated
vendored
85
node_modules/@sinonjs/samsam/lib/create-matcher.js
generated
vendored
@@ -44,7 +44,7 @@ function createMatcher(expectation, message) {
|
||||
|
||||
if (arguments.length > 2) {
|
||||
throw new TypeError(
|
||||
`Expected 1 or 2 arguments, received ${arguments.length}`
|
||||
`Expected 1 or 2 arguments, received ${arguments.length}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,9 +89,12 @@ createMatcher.falsy = createMatcher(function (actual) {
|
||||
}, "falsy");
|
||||
|
||||
createMatcher.same = function (expectation) {
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
return expectation === actual;
|
||||
}, `same(${valueToString(expectation)})`);
|
||||
},
|
||||
`same(${valueToString(expectation)})`,
|
||||
);
|
||||
};
|
||||
|
||||
createMatcher.in = function (arrayOfExpectations) {
|
||||
@@ -99,11 +102,14 @@ createMatcher.in = function (arrayOfExpectations) {
|
||||
throw new TypeError("array expected");
|
||||
}
|
||||
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
return some(arrayOfExpectations, function (expectation) {
|
||||
return expectation === actual;
|
||||
});
|
||||
}, `in(${valueToString(arrayOfExpectations)})`);
|
||||
},
|
||||
`in(${valueToString(arrayOfExpectations)})`,
|
||||
);
|
||||
};
|
||||
|
||||
createMatcher.typeOf = function (type) {
|
||||
@@ -125,12 +131,15 @@ createMatcher.instanceOf = function (type) {
|
||||
type,
|
||||
Symbol.hasInstance,
|
||||
"type",
|
||||
"[Symbol.hasInstance]"
|
||||
"[Symbol.hasInstance]",
|
||||
);
|
||||
}
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
return actual instanceof type;
|
||||
}, `instanceOf(${functionName(type) || objectToString(type)})`);
|
||||
},
|
||||
`instanceOf(${functionName(type) || objectToString(type)})`,
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -259,7 +268,8 @@ createMatcher.some = function (predicate) {
|
||||
createMatcher.array = createMatcher.typeOf("array");
|
||||
|
||||
createMatcher.array.deepEquals = function (expectation) {
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
// Comparing lengths is the fastest way to spot a difference before iterating through every item
|
||||
var sameLength = actual.length === expectation.length;
|
||||
return (
|
||||
@@ -273,22 +283,28 @@ createMatcher.array.deepEquals = function (expectation) {
|
||||
: deepEqual(expected, element);
|
||||
})
|
||||
);
|
||||
}, `deepEquals([${iterableToString(expectation)}])`);
|
||||
},
|
||||
`deepEquals([${iterableToString(expectation)}])`,
|
||||
);
|
||||
};
|
||||
|
||||
createMatcher.array.startsWith = function (expectation) {
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
return (
|
||||
typeOf(actual) === "array" &&
|
||||
every(expectation, function (expectedElement, index) {
|
||||
return actual[index] === expectedElement;
|
||||
})
|
||||
);
|
||||
}, `startsWith([${iterableToString(expectation)}])`);
|
||||
},
|
||||
`startsWith([${iterableToString(expectation)}])`,
|
||||
);
|
||||
};
|
||||
|
||||
createMatcher.array.endsWith = function (expectation) {
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
// This indicates the index in which we should start matching
|
||||
var offset = actual.length - expectation.length;
|
||||
|
||||
@@ -298,51 +314,65 @@ createMatcher.array.endsWith = function (expectation) {
|
||||
return actual[offset + index] === expectedElement;
|
||||
})
|
||||
);
|
||||
}, `endsWith([${iterableToString(expectation)}])`);
|
||||
},
|
||||
`endsWith([${iterableToString(expectation)}])`,
|
||||
);
|
||||
};
|
||||
|
||||
createMatcher.array.contains = function (expectation) {
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
return (
|
||||
typeOf(actual) === "array" &&
|
||||
every(expectation, function (expectedElement) {
|
||||
return arrayIndexOf(actual, expectedElement) !== -1;
|
||||
})
|
||||
);
|
||||
}, `contains([${iterableToString(expectation)}])`);
|
||||
},
|
||||
`contains([${iterableToString(expectation)}])`,
|
||||
);
|
||||
};
|
||||
|
||||
createMatcher.map = createMatcher.typeOf("map");
|
||||
|
||||
createMatcher.map.deepEquals = function mapDeepEquals(expectation) {
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
// Comparing lengths is the fastest way to spot a difference before iterating through every item
|
||||
var sameLength = actual.size === expectation.size;
|
||||
return (
|
||||
typeOf(actual) === "map" &&
|
||||
sameLength &&
|
||||
every(actual, function (element, key) {
|
||||
return expectation.has(key) && expectation.get(key) === element;
|
||||
return (
|
||||
expectation.has(key) && expectation.get(key) === element
|
||||
);
|
||||
})
|
||||
);
|
||||
}, `deepEquals(Map[${iterableToString(expectation)}])`);
|
||||
},
|
||||
`deepEquals(Map[${iterableToString(expectation)}])`,
|
||||
);
|
||||
};
|
||||
|
||||
createMatcher.map.contains = function mapContains(expectation) {
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
return (
|
||||
typeOf(actual) === "map" &&
|
||||
every(expectation, function (element, key) {
|
||||
return actual.has(key) && actual.get(key) === element;
|
||||
})
|
||||
);
|
||||
}, `contains(Map[${iterableToString(expectation)}])`);
|
||||
},
|
||||
`contains(Map[${iterableToString(expectation)}])`,
|
||||
);
|
||||
};
|
||||
|
||||
createMatcher.set = createMatcher.typeOf("set");
|
||||
|
||||
createMatcher.set.deepEquals = function setDeepEquals(expectation) {
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
// Comparing lengths is the fastest way to spot a difference before iterating through every item
|
||||
var sameLength = actual.size === expectation.size;
|
||||
return (
|
||||
@@ -352,18 +382,23 @@ createMatcher.set.deepEquals = function setDeepEquals(expectation) {
|
||||
return expectation.has(element);
|
||||
})
|
||||
);
|
||||
}, `deepEquals(Set[${iterableToString(expectation)}])`);
|
||||
},
|
||||
`deepEquals(Set[${iterableToString(expectation)}])`,
|
||||
);
|
||||
};
|
||||
|
||||
createMatcher.set.contains = function setContains(expectation) {
|
||||
return createMatcher(function (actual) {
|
||||
return createMatcher(
|
||||
function (actual) {
|
||||
return (
|
||||
typeOf(actual) === "set" &&
|
||||
every(expectation, function (element) {
|
||||
return actual.has(element);
|
||||
})
|
||||
);
|
||||
}, `contains(Set[${iterableToString(expectation)}])`);
|
||||
},
|
||||
`contains(Set[${iterableToString(expectation)}])`,
|
||||
);
|
||||
};
|
||||
|
||||
createMatcher.bool = createMatcher.typeOf("boolean");
|
||||
|
||||
2
node_modules/@sinonjs/samsam/lib/create-matcher/assert-type.js
generated
vendored
2
node_modules/@sinonjs/samsam/lib/create-matcher/assert-type.js
generated
vendored
@@ -16,7 +16,7 @@ function assertType(value, type, name) {
|
||||
var actual = typeOf(value);
|
||||
if (actual !== type) {
|
||||
throw new TypeError(
|
||||
`Expected type of ${name} to be ${type}, but was ${actual}`
|
||||
`Expected type of ${name} to be ${type}, but was ${actual}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
4
node_modules/@sinonjs/samsam/lib/create-matcher/match-object.js
generated
vendored
4
node_modules/@sinonjs/samsam/lib/create-matcher/match-object.js
generated
vendored
@@ -6,6 +6,7 @@ var typeOf = require("@sinonjs/commons").typeOf;
|
||||
|
||||
var deepEqualFactory = require("../deep-equal").use;
|
||||
|
||||
var identical = require("../identical");
|
||||
var isMatcher = require("./is-matcher");
|
||||
|
||||
var keys = Object.keys;
|
||||
@@ -41,6 +42,9 @@ function matchObject(actual, expectation, matcher) {
|
||||
return false;
|
||||
}
|
||||
} else if (typeOf(exp) === "object") {
|
||||
if (identical(exp, act)) {
|
||||
return true;
|
||||
}
|
||||
if (!matchObject(act, exp, matcher)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
2
node_modules/@sinonjs/samsam/lib/create-set.js
generated
vendored
2
node_modules/@sinonjs/samsam/lib/create-set.js
generated
vendored
@@ -17,7 +17,7 @@ var forEach = require("@sinonjs/commons").prototypes.array.forEach;
|
||||
function createSet(array) {
|
||||
if (arguments.length > 0 && !Array.isArray(array)) {
|
||||
throw new TypeError(
|
||||
"createSet can be called with either no arguments or an Array"
|
||||
"createSet can be called with either no arguments or an Array",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
6
node_modules/@sinonjs/samsam/lib/deep-equal.js
generated
vendored
6
node_modules/@sinonjs/samsam/lib/deep-equal.js
generated
vendored
@@ -67,7 +67,7 @@ function deepEqualCyclic(actual, expectation, match) {
|
||||
actualObj,
|
||||
expectationObj,
|
||||
actualPath,
|
||||
expectationPath
|
||||
expectationPath,
|
||||
) {
|
||||
// If both are matchers they must be the same instance in order to be
|
||||
// considered equal If we didn't do that we would end up running one
|
||||
@@ -140,7 +140,7 @@ function deepEqualCyclic(actual, expectation, match) {
|
||||
[];
|
||||
var expectationKeysAndSymbols = concat(
|
||||
expectationKeys,
|
||||
expectationSymbols
|
||||
expectationSymbols,
|
||||
);
|
||||
|
||||
if (isArguments(actualObj) || isArguments(expectationObj)) {
|
||||
@@ -289,7 +289,7 @@ function deepEqualCyclic(actual, expectation, match) {
|
||||
actualValue,
|
||||
expectationValue,
|
||||
newActualPath,
|
||||
newExpectationPath
|
||||
newExpectationPath,
|
||||
);
|
||||
});
|
||||
})(actual, expectation, "$1", "$2");
|
||||
|
||||
6
node_modules/@sinonjs/samsam/lib/match.js
generated
vendored
6
node_modules/@sinonjs/samsam/lib/match.js
generated
vendored
@@ -70,7 +70,7 @@ function match(object, matcherOrValue) {
|
||||
notNull &&
|
||||
indexOf(
|
||||
valueToString(object).toLowerCase(),
|
||||
matcherOrValue.toLowerCase()
|
||||
matcherOrValue.toLowerCase(),
|
||||
) >= 0
|
||||
);
|
||||
case "null":
|
||||
@@ -102,7 +102,7 @@ function match(object, matcherOrValue) {
|
||||
/* istanbul ignore next: this is covered by a test, that is only run in IE, but we collect coverage information in node*/
|
||||
if (!engineCanCompareMaps) {
|
||||
throw new Error(
|
||||
"The JavaScript engine does not support Array.from and cannot reliably do value comparison of Map instances"
|
||||
"The JavaScript engine does not support Array.from and cannot reliably do value comparison of Map instances",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ function match(object, matcherOrValue) {
|
||||
arrayContains(
|
||||
Array.from(object),
|
||||
Array.from(matcherOrValue),
|
||||
match
|
||||
match,
|
||||
)
|
||||
);
|
||||
default:
|
||||
|
||||
29
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/LICENSE
generated
vendored
29
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/LICENSE
generated
vendored
@@ -1,29 +0,0 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2018, Sinon.JS
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
16
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/README.md
generated
vendored
16
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/README.md
generated
vendored
@@ -1,16 +0,0 @@
|
||||
# commons
|
||||
|
||||
[](https://circleci.com/gh/sinonjs/commons)
|
||||
[](https://codecov.io/gh/sinonjs/commons)
|
||||
<a href="CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
|
||||
|
||||
Simple functions shared among the sinon end user libraries
|
||||
|
||||
## Rules
|
||||
|
||||
- Follows the [Sinon.JS compatibility](https://github.com/sinonjs/sinon/blob/master/CONTRIBUTING.md#compatibility)
|
||||
- 100% test coverage
|
||||
- Code formatted using [Prettier](https://prettier.io)
|
||||
- No side effects welcome! (only pure functions)
|
||||
- No platform specific functions
|
||||
- One export per file (any bundler can do tree shaking)
|
||||
57
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/called-in-order.js
generated
vendored
57
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/called-in-order.js
generated
vendored
@@ -1,57 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var every = require("./prototypes/array").every;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function hasCallsLeft(callMap, spy) {
|
||||
if (callMap[spy.id] === undefined) {
|
||||
callMap[spy.id] = 0;
|
||||
}
|
||||
|
||||
return callMap[spy.id] < spy.callCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function checkAdjacentCalls(callMap, spy, index, spies) {
|
||||
var calledBeforeNext = true;
|
||||
|
||||
if (index !== spies.length - 1) {
|
||||
calledBeforeNext = spy.calledBefore(spies[index + 1]);
|
||||
}
|
||||
|
||||
if (hasCallsLeft(callMap, spy) && calledBeforeNext) {
|
||||
callMap[spy.id] += 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Sinon proxy object (fake, spy, stub)
|
||||
*
|
||||
* @typedef {object} SinonProxy
|
||||
* @property {Function} calledBefore - A method that determines if this proxy was called before another one
|
||||
* @property {string} id - Some id
|
||||
* @property {number} callCount - Number of times this proxy has been called
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns true when the spies have been called in the order they were supplied in
|
||||
*
|
||||
* @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments
|
||||
* @returns {boolean} true when spies are called in order, false otherwise
|
||||
*/
|
||||
function calledInOrder(spies) {
|
||||
var callMap = {};
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
var _spies = arguments.length > 1 ? arguments : spies;
|
||||
|
||||
return every(_spies, checkAdjacentCalls.bind(null, callMap));
|
||||
}
|
||||
|
||||
module.exports = calledInOrder;
|
||||
121
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/called-in-order.test.js
generated
vendored
121
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/called-in-order.test.js
generated
vendored
@@ -1,121 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var calledInOrder = require("./called-in-order");
|
||||
var sinon = require("@sinonjs/referee-sinon").sinon;
|
||||
|
||||
var testObject1 = {
|
||||
someFunction: function () {
|
||||
return;
|
||||
},
|
||||
};
|
||||
var testObject2 = {
|
||||
otherFunction: function () {
|
||||
return;
|
||||
},
|
||||
};
|
||||
var testObject3 = {
|
||||
thirdFunction: function () {
|
||||
return;
|
||||
},
|
||||
};
|
||||
|
||||
function testMethod() {
|
||||
testObject1.someFunction();
|
||||
testObject2.otherFunction();
|
||||
testObject2.otherFunction();
|
||||
testObject2.otherFunction();
|
||||
testObject3.thirdFunction();
|
||||
}
|
||||
|
||||
describe("calledInOrder", function () {
|
||||
beforeEach(function () {
|
||||
sinon.stub(testObject1, "someFunction");
|
||||
sinon.stub(testObject2, "otherFunction");
|
||||
sinon.stub(testObject3, "thirdFunction");
|
||||
testMethod();
|
||||
});
|
||||
afterEach(function () {
|
||||
testObject1.someFunction.restore();
|
||||
testObject2.otherFunction.restore();
|
||||
testObject3.thirdFunction.restore();
|
||||
});
|
||||
|
||||
describe("given single array argument", function () {
|
||||
describe("when stubs were called in expected order", function () {
|
||||
it("returns true", function () {
|
||||
assert.isTrue(
|
||||
calledInOrder([
|
||||
testObject1.someFunction,
|
||||
testObject2.otherFunction,
|
||||
])
|
||||
);
|
||||
assert.isTrue(
|
||||
calledInOrder([
|
||||
testObject1.someFunction,
|
||||
testObject2.otherFunction,
|
||||
testObject2.otherFunction,
|
||||
testObject3.thirdFunction,
|
||||
])
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when stubs were called in unexpected order", function () {
|
||||
it("returns false", function () {
|
||||
assert.isFalse(
|
||||
calledInOrder([
|
||||
testObject2.otherFunction,
|
||||
testObject1.someFunction,
|
||||
])
|
||||
);
|
||||
assert.isFalse(
|
||||
calledInOrder([
|
||||
testObject2.otherFunction,
|
||||
testObject1.someFunction,
|
||||
testObject1.someFunction,
|
||||
testObject3.thirdFunction,
|
||||
])
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("given multiple arguments", function () {
|
||||
describe("when stubs were called in expected order", function () {
|
||||
it("returns true", function () {
|
||||
assert.isTrue(
|
||||
calledInOrder(
|
||||
testObject1.someFunction,
|
||||
testObject2.otherFunction
|
||||
)
|
||||
);
|
||||
assert.isTrue(
|
||||
calledInOrder(
|
||||
testObject1.someFunction,
|
||||
testObject2.otherFunction,
|
||||
testObject3.thirdFunction
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when stubs were called in unexpected order", function () {
|
||||
it("returns false", function () {
|
||||
assert.isFalse(
|
||||
calledInOrder(
|
||||
testObject2.otherFunction,
|
||||
testObject1.someFunction
|
||||
)
|
||||
);
|
||||
assert.isFalse(
|
||||
calledInOrder(
|
||||
testObject2.otherFunction,
|
||||
testObject1.someFunction,
|
||||
testObject3.thirdFunction
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
27
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/class-name.js
generated
vendored
27
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/class-name.js
generated
vendored
@@ -1,27 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var functionName = require("./function-name");
|
||||
|
||||
/**
|
||||
* Returns a display name for a value from a constructor
|
||||
*
|
||||
* @param {object} value A value to examine
|
||||
* @returns {(string|null)} A string or null
|
||||
*/
|
||||
function className(value) {
|
||||
return (
|
||||
(value.constructor && value.constructor.name) ||
|
||||
// The next branch is for IE11 support only:
|
||||
// Because the name property is not set on the prototype
|
||||
// of the Function object, we finally try to grab the
|
||||
// name from its definition. This will never be reached
|
||||
// in node, so we are not able to test this properly.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
|
||||
(typeof value.constructor === "function" &&
|
||||
/* istanbul ignore next */
|
||||
functionName(value.constructor)) ||
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = className;
|
||||
37
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/class-name.test.js
generated
vendored
37
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/class-name.test.js
generated
vendored
@@ -1,37 +0,0 @@
|
||||
"use strict";
|
||||
/* eslint-disable no-empty-function */
|
||||
|
||||
var assert = require("@sinonjs/referee").assert;
|
||||
var className = require("./class-name");
|
||||
|
||||
describe("className", function () {
|
||||
it("returns the class name of an instance", function () {
|
||||
// Because eslint-config-sinon disables es6, we can't
|
||||
// use a class definition here
|
||||
// https://github.com/sinonjs/eslint-config-sinon/blob/master/index.js
|
||||
// var instance = new (class TestClass {})();
|
||||
var instance = new (function TestClass() {})();
|
||||
var name = className(instance);
|
||||
assert.equals(name, "TestClass");
|
||||
});
|
||||
|
||||
it("returns 'Object' for {}", function () {
|
||||
var name = className({});
|
||||
assert.equals(name, "Object");
|
||||
});
|
||||
|
||||
it("returns null for an object that has no prototype", function () {
|
||||
var obj = Object.create(null);
|
||||
var name = className(obj);
|
||||
assert.equals(name, null);
|
||||
});
|
||||
|
||||
it("returns null for an object whose prototype was mangled", function () {
|
||||
// This is what Node v6 and v7 do for objects returned by querystring.parse()
|
||||
function MangledObject() {}
|
||||
MangledObject.prototype = Object.create(null);
|
||||
var obj = new MangledObject();
|
||||
var name = className(obj);
|
||||
assert.equals(name, null);
|
||||
});
|
||||
});
|
||||
51
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/deprecated.js
generated
vendored
51
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/deprecated.js
generated
vendored
@@ -1,51 +0,0 @@
|
||||
/* eslint-disable no-console */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns a function that will invoke the supplied function and print a
|
||||
* deprecation warning to the console each time it is called.
|
||||
*
|
||||
* @param {Function} func
|
||||
* @param {string} msg
|
||||
* @returns {Function}
|
||||
*/
|
||||
exports.wrap = function (func, msg) {
|
||||
var wrapped = function () {
|
||||
exports.printWarning(msg);
|
||||
return func.apply(this, arguments);
|
||||
};
|
||||
if (func.prototype) {
|
||||
wrapped.prototype = func.prototype;
|
||||
}
|
||||
return wrapped;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a string which can be supplied to `wrap()` to notify the user that a
|
||||
* particular part of the sinon API has been deprecated.
|
||||
*
|
||||
* @param {string} packageName
|
||||
* @param {string} funcName
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.defaultMsg = function (packageName, funcName) {
|
||||
return `${packageName}.${funcName} is deprecated and will be removed from the public API in a future version of ${packageName}.`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Prints a warning on the console, when it exists
|
||||
*
|
||||
* @param {string} msg
|
||||
* @returns {undefined}
|
||||
*/
|
||||
exports.printWarning = function (msg) {
|
||||
/* istanbul ignore next */
|
||||
if (typeof process === "object" && process.emitWarning) {
|
||||
// Emit Warnings in Node
|
||||
process.emitWarning(msg);
|
||||
} else if (console.info) {
|
||||
console.info(msg);
|
||||
} else {
|
||||
console.log(msg);
|
||||
}
|
||||
};
|
||||
101
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/deprecated.test.js
generated
vendored
101
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/deprecated.test.js
generated
vendored
@@ -1,101 +0,0 @@
|
||||
/* eslint-disable no-console */
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var sinon = require("@sinonjs/referee-sinon").sinon;
|
||||
|
||||
var deprecated = require("./deprecated");
|
||||
|
||||
var msg = "test";
|
||||
|
||||
describe("deprecated", function () {
|
||||
describe("defaultMsg", function () {
|
||||
it("should return a string", function () {
|
||||
assert.equals(
|
||||
deprecated.defaultMsg("sinon", "someFunc"),
|
||||
"sinon.someFunc is deprecated and will be removed from the public API in a future version of sinon."
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("printWarning", function () {
|
||||
beforeEach(function () {
|
||||
sinon.replace(process, "emitWarning", sinon.fake());
|
||||
});
|
||||
|
||||
afterEach(sinon.restore);
|
||||
|
||||
describe("when `process.emitWarning` is defined", function () {
|
||||
it("should call process.emitWarning with a msg", function () {
|
||||
deprecated.printWarning(msg);
|
||||
assert.calledOnceWith(process.emitWarning, msg);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when `process.emitWarning` is undefined", function () {
|
||||
beforeEach(function () {
|
||||
sinon.replace(console, "info", sinon.fake());
|
||||
sinon.replace(console, "log", sinon.fake());
|
||||
process.emitWarning = undefined;
|
||||
});
|
||||
|
||||
afterEach(sinon.restore);
|
||||
|
||||
describe("when `console.info` is defined", function () {
|
||||
it("should call `console.info` with a message", function () {
|
||||
deprecated.printWarning(msg);
|
||||
assert.calledOnceWith(console.info, msg);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when `console.info` is undefined", function () {
|
||||
it("should call `console.log` with a message", function () {
|
||||
console.info = undefined;
|
||||
deprecated.printWarning(msg);
|
||||
assert.calledOnceWith(console.log, msg);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("wrap", function () {
|
||||
// eslint-disable-next-line mocha/no-setup-in-describe
|
||||
var method = sinon.fake();
|
||||
var wrapped;
|
||||
|
||||
beforeEach(function () {
|
||||
wrapped = deprecated.wrap(method, msg);
|
||||
});
|
||||
|
||||
it("should return a wrapper function", function () {
|
||||
assert.match(wrapped, sinon.match.func);
|
||||
});
|
||||
|
||||
it("should assign the prototype of the passed method", function () {
|
||||
assert.equals(method.prototype, wrapped.prototype);
|
||||
});
|
||||
|
||||
context("when the passed method has falsy prototype", function () {
|
||||
it("should not be assigned to the wrapped method", function () {
|
||||
method.prototype = null;
|
||||
wrapped = deprecated.wrap(method, msg);
|
||||
assert.match(wrapped.prototype, sinon.match.object);
|
||||
});
|
||||
});
|
||||
|
||||
context("when invoking the wrapped function", function () {
|
||||
before(function () {
|
||||
sinon.replace(deprecated, "printWarning", sinon.fake());
|
||||
wrapped({});
|
||||
});
|
||||
|
||||
it("should call `printWarning` before invoking", function () {
|
||||
assert.calledOnceWith(deprecated.printWarning, msg);
|
||||
});
|
||||
|
||||
it("should invoke the passed method with the given arguments", function () {
|
||||
assert.calledOnceWith(method, {});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
27
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/every.js
generated
vendored
27
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/every.js
generated
vendored
@@ -1,27 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns true when fn returns true for all members of obj.
|
||||
* This is an every implementation that works for all iterables
|
||||
*
|
||||
* @param {object} obj
|
||||
* @param {Function} fn
|
||||
* @returns {boolean}
|
||||
*/
|
||||
module.exports = function every(obj, fn) {
|
||||
var pass = true;
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
|
||||
obj.forEach(function () {
|
||||
if (!fn.apply(this, arguments)) {
|
||||
// Throwing an error is the only way to break `forEach`
|
||||
throw new Error();
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
pass = false;
|
||||
}
|
||||
|
||||
return pass;
|
||||
};
|
||||
41
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/every.test.js
generated
vendored
41
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/every.test.js
generated
vendored
@@ -1,41 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var sinon = require("@sinonjs/referee-sinon").sinon;
|
||||
var every = require("./every");
|
||||
|
||||
describe("util/core/every", function () {
|
||||
it("returns true when the callback function returns true for every element in an iterable", function () {
|
||||
var obj = [true, true, true, true];
|
||||
var allTrue = every(obj, function (val) {
|
||||
return val;
|
||||
});
|
||||
|
||||
assert(allTrue);
|
||||
});
|
||||
|
||||
it("returns false when the callback function returns false for any element in an iterable", function () {
|
||||
var obj = [true, true, true, false];
|
||||
var result = every(obj, function (val) {
|
||||
return val;
|
||||
});
|
||||
|
||||
assert.isFalse(result);
|
||||
});
|
||||
|
||||
it("calls the given callback once for each item in an iterable until it returns false", function () {
|
||||
var iterableOne = [true, true, true, true];
|
||||
var iterableTwo = [true, true, false, true];
|
||||
var callback = sinon.spy(function (val) {
|
||||
return val;
|
||||
});
|
||||
|
||||
every(iterableOne, callback);
|
||||
assert.equals(callback.callCount, 4);
|
||||
|
||||
callback.resetHistory();
|
||||
|
||||
every(iterableTwo, callback);
|
||||
assert.equals(callback.callCount, 3);
|
||||
});
|
||||
});
|
||||
29
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/function-name.js
generated
vendored
29
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/function-name.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns a display name for a function
|
||||
*
|
||||
* @param {Function} func
|
||||
* @returns {string}
|
||||
*/
|
||||
module.exports = function functionName(func) {
|
||||
if (!func) {
|
||||
return "";
|
||||
}
|
||||
|
||||
try {
|
||||
return (
|
||||
func.displayName ||
|
||||
func.name ||
|
||||
// Use function decomposition as a last resort to get function
|
||||
// name. Does not rely on function decomposition to work - if it
|
||||
// doesn't debugging will be slightly less informative
|
||||
// (i.e. toString will say 'spy' rather than 'myFunc').
|
||||
(String(func).match(/function ([^\s(]+)/) || [])[1]
|
||||
);
|
||||
} catch (e) {
|
||||
// Stringify may fail and we might get an exception, as a last-last
|
||||
// resort fall back to empty string.
|
||||
return "";
|
||||
}
|
||||
};
|
||||
76
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/function-name.test.js
generated
vendored
76
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/function-name.test.js
generated
vendored
@@ -1,76 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var jsc = require("jsverify");
|
||||
var refute = require("@sinonjs/referee-sinon").refute;
|
||||
|
||||
var functionName = require("./function-name");
|
||||
|
||||
describe("function-name", function () {
|
||||
it("should return empty string if func is falsy", function () {
|
||||
jsc.assertForall("falsy", function (fn) {
|
||||
return functionName(fn) === "";
|
||||
});
|
||||
});
|
||||
|
||||
it("should use displayName by default", function () {
|
||||
jsc.assertForall("nestring", function (displayName) {
|
||||
var fn = { displayName: displayName };
|
||||
|
||||
return functionName(fn) === fn.displayName;
|
||||
});
|
||||
});
|
||||
|
||||
it("should use name if displayName is not available", function () {
|
||||
jsc.assertForall("nestring", function (name) {
|
||||
var fn = { name: name };
|
||||
|
||||
return functionName(fn) === fn.name;
|
||||
});
|
||||
});
|
||||
|
||||
it("should fallback to string parsing", function () {
|
||||
jsc.assertForall("nat", function (naturalNumber) {
|
||||
var name = `fn${naturalNumber}`;
|
||||
var fn = {
|
||||
toString: function () {
|
||||
return `\nfunction ${name}`;
|
||||
},
|
||||
};
|
||||
|
||||
return functionName(fn) === name;
|
||||
});
|
||||
});
|
||||
|
||||
it("should not fail when a name cannot be found", function () {
|
||||
refute.exception(function () {
|
||||
var fn = {
|
||||
toString: function () {
|
||||
return "\nfunction (";
|
||||
},
|
||||
};
|
||||
|
||||
functionName(fn);
|
||||
});
|
||||
});
|
||||
|
||||
it("should not fail when toString is undefined", function () {
|
||||
refute.exception(function () {
|
||||
functionName(Object.create(null));
|
||||
});
|
||||
});
|
||||
|
||||
it("should not fail when toString throws", function () {
|
||||
refute.exception(function () {
|
||||
var fn;
|
||||
try {
|
||||
// eslint-disable-next-line no-eval
|
||||
fn = eval("(function*() {})")().constructor;
|
||||
} catch (e) {
|
||||
// env doesn't support generators
|
||||
return;
|
||||
}
|
||||
|
||||
functionName(fn);
|
||||
});
|
||||
});
|
||||
});
|
||||
22
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/global.js
generated
vendored
22
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/global.js
generated
vendored
@@ -1,22 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* A reference to the global object
|
||||
*
|
||||
* @type {object} globalObject
|
||||
*/
|
||||
var globalObject;
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (typeof global !== "undefined") {
|
||||
// Node
|
||||
globalObject = global;
|
||||
} else if (typeof window !== "undefined") {
|
||||
// Browser
|
||||
globalObject = window;
|
||||
} else {
|
||||
// WebWorker
|
||||
globalObject = self;
|
||||
}
|
||||
|
||||
module.exports = globalObject;
|
||||
16
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/global.test.js
generated
vendored
16
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/global.test.js
generated
vendored
@@ -1,16 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var globalObject = require("./global");
|
||||
|
||||
describe("global", function () {
|
||||
before(function () {
|
||||
if (typeof global === "undefined") {
|
||||
this.skip();
|
||||
}
|
||||
});
|
||||
|
||||
it("is same as global", function () {
|
||||
assert.same(globalObject, global);
|
||||
});
|
||||
});
|
||||
14
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/index.js
generated
vendored
14
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/index.js
generated
vendored
@@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
global: require("./global"),
|
||||
calledInOrder: require("./called-in-order"),
|
||||
className: require("./class-name"),
|
||||
deprecated: require("./deprecated"),
|
||||
every: require("./every"),
|
||||
functionName: require("./function-name"),
|
||||
orderByFirstCall: require("./order-by-first-call"),
|
||||
prototypes: require("./prototypes"),
|
||||
typeOf: require("./type-of"),
|
||||
valueToString: require("./value-to-string"),
|
||||
};
|
||||
31
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/index.test.js
generated
vendored
31
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/index.test.js
generated
vendored
@@ -1,31 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var index = require("./index");
|
||||
|
||||
var expectedMethods = [
|
||||
"calledInOrder",
|
||||
"className",
|
||||
"every",
|
||||
"functionName",
|
||||
"orderByFirstCall",
|
||||
"typeOf",
|
||||
"valueToString",
|
||||
];
|
||||
var expectedObjectProperties = ["deprecated", "prototypes"];
|
||||
|
||||
describe("package", function () {
|
||||
// eslint-disable-next-line mocha/no-setup-in-describe
|
||||
expectedMethods.forEach(function (name) {
|
||||
it(`should export a method named ${name}`, function () {
|
||||
assert.isFunction(index[name]);
|
||||
});
|
||||
});
|
||||
|
||||
// eslint-disable-next-line mocha/no-setup-in-describe
|
||||
expectedObjectProperties.forEach(function (name) {
|
||||
it(`should export an object property named ${name}`, function () {
|
||||
assert.isObject(index[name]);
|
||||
});
|
||||
});
|
||||
});
|
||||
36
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/order-by-first-call.js
generated
vendored
36
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/order-by-first-call.js
generated
vendored
@@ -1,36 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var sort = require("./prototypes/array").sort;
|
||||
var slice = require("./prototypes/array").slice;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function comparator(a, b) {
|
||||
// uuid, won't ever be equal
|
||||
var aCall = a.getCall(0);
|
||||
var bCall = b.getCall(0);
|
||||
var aId = (aCall && aCall.callId) || -1;
|
||||
var bId = (bCall && bCall.callId) || -1;
|
||||
|
||||
return aId < bId ? -1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Sinon proxy object (fake, spy, stub)
|
||||
*
|
||||
* @typedef {object} SinonProxy
|
||||
* @property {Function} getCall - A method that can return the first call
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sorts an array of SinonProxy instances (fake, spy, stub) by their first call
|
||||
*
|
||||
* @param {SinonProxy[] | SinonProxy} spies
|
||||
* @returns {SinonProxy[]}
|
||||
*/
|
||||
function orderByFirstCall(spies) {
|
||||
return sort(slice(spies), comparator);
|
||||
}
|
||||
|
||||
module.exports = orderByFirstCall;
|
||||
@@ -1,52 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var knuthShuffle = require("knuth-shuffle").knuthShuffle;
|
||||
var sinon = require("@sinonjs/referee-sinon").sinon;
|
||||
var orderByFirstCall = require("./order-by-first-call");
|
||||
|
||||
describe("orderByFirstCall", function () {
|
||||
it("should order an Array of spies by the callId of the first call, ascending", function () {
|
||||
// create an array of spies
|
||||
var spies = [
|
||||
sinon.spy(),
|
||||
sinon.spy(),
|
||||
sinon.spy(),
|
||||
sinon.spy(),
|
||||
sinon.spy(),
|
||||
sinon.spy(),
|
||||
];
|
||||
|
||||
// call all the spies
|
||||
spies.forEach(function (spy) {
|
||||
spy();
|
||||
});
|
||||
|
||||
// add a few uncalled spies
|
||||
spies.push(sinon.spy());
|
||||
spies.push(sinon.spy());
|
||||
|
||||
// randomise the order of the spies
|
||||
knuthShuffle(spies);
|
||||
|
||||
var sortedSpies = orderByFirstCall(spies);
|
||||
|
||||
assert.equals(sortedSpies.length, spies.length);
|
||||
|
||||
var orderedByFirstCall = sortedSpies.every(function (spy, index) {
|
||||
if (index + 1 === sortedSpies.length) {
|
||||
return true;
|
||||
}
|
||||
var nextSpy = sortedSpies[index + 1];
|
||||
|
||||
// uncalled spies should be ordered first
|
||||
if (!spy.called) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return spy.calledImmediatelyBefore(nextSpy);
|
||||
});
|
||||
|
||||
assert.isTrue(orderedByFirstCall);
|
||||
});
|
||||
});
|
||||
43
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/prototypes/README.md
generated
vendored
43
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/prototypes/README.md
generated
vendored
@@ -1,43 +0,0 @@
|
||||
# Prototypes
|
||||
|
||||
The functions in this folder are to be use for keeping cached references to the built-in prototypes, so that people can't inadvertently break the library by making mistakes in userland.
|
||||
|
||||
See https://github.com/sinonjs/sinon/pull/1523
|
||||
|
||||
## Without cached references
|
||||
|
||||
```js
|
||||
// in userland, the library user needs to replace the filter method on
|
||||
// Array.prototype
|
||||
var array = [1, 2, 3];
|
||||
sinon.replace(array, "filter", sinon.fake.returns(2));
|
||||
|
||||
// in a sinon module, the library author needs to use the filter method
|
||||
var someArray = ["a", "b", 42, "c"];
|
||||
var answer = filter(someArray, function (v) {
|
||||
return v === 42;
|
||||
});
|
||||
|
||||
console.log(answer);
|
||||
// => 2
|
||||
```
|
||||
|
||||
## With cached references
|
||||
|
||||
```js
|
||||
// in userland, the library user needs to replace the filter method on
|
||||
// Array.prototype
|
||||
var array = [1, 2, 3];
|
||||
sinon.replace(array, "filter", sinon.fake.returns(2));
|
||||
|
||||
// in a sinon module, the library author needs to use the filter method
|
||||
// get a reference to the original Array.prototype.filter
|
||||
var filter = require("@sinonjs/commons").prototypes.array.filter;
|
||||
var someArray = ["a", "b", 42, "c"];
|
||||
var answer = filter(someArray, function (v) {
|
||||
return v === 42;
|
||||
});
|
||||
|
||||
console.log(answer);
|
||||
// => 42
|
||||
```
|
||||
5
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/prototypes/array.js
generated
vendored
5
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/prototypes/array.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var copyPrototype = require("./copy-prototype-methods");
|
||||
|
||||
module.exports = copyPrototype(Array.prototype);
|
||||
@@ -1,40 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var call = Function.call;
|
||||
var throwsOnProto = require("./throws-on-proto");
|
||||
|
||||
var disallowedProperties = [
|
||||
// ignore size because it throws from Map
|
||||
"size",
|
||||
"caller",
|
||||
"callee",
|
||||
"arguments",
|
||||
];
|
||||
|
||||
// This branch is covered when tests are run with `--disable-proto=throw`,
|
||||
// however we can test both branches at the same time, so this is ignored
|
||||
/* istanbul ignore next */
|
||||
if (throwsOnProto) {
|
||||
disallowedProperties.push("__proto__");
|
||||
}
|
||||
|
||||
module.exports = function copyPrototypeMethods(prototype) {
|
||||
// eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
|
||||
return Object.getOwnPropertyNames(prototype).reduce(function (
|
||||
result,
|
||||
name
|
||||
) {
|
||||
if (disallowedProperties.includes(name)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (typeof prototype[name] !== "function") {
|
||||
return result;
|
||||
}
|
||||
|
||||
result[name] = call.bind(prototype[name]);
|
||||
|
||||
return result;
|
||||
},
|
||||
Object.create(null));
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var refute = require("@sinonjs/referee-sinon").refute;
|
||||
var copyPrototypeMethods = require("./copy-prototype-methods");
|
||||
|
||||
describe("copyPrototypeMethods", function () {
|
||||
it("does not throw for Map", function () {
|
||||
refute.exception(function () {
|
||||
copyPrototypeMethods(Map.prototype);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var copyPrototype = require("./copy-prototype-methods");
|
||||
|
||||
module.exports = copyPrototype(Function.prototype);
|
||||
10
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/prototypes/index.js
generated
vendored
10
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/prototypes/index.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
array: require("./array"),
|
||||
function: require("./function"),
|
||||
map: require("./map"),
|
||||
object: require("./object"),
|
||||
set: require("./set"),
|
||||
string: require("./string"),
|
||||
};
|
||||
61
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/prototypes/index.test.js
generated
vendored
61
node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons/lib/prototypes/index.test.js
generated
vendored
@@ -1,61 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
|
||||
var arrayProto = require("./index").array;
|
||||
var functionProto = require("./index").function;
|
||||
var mapProto = require("./index").map;
|
||||
var objectProto = require("./index").object;
|
||||
var setProto = require("./index").set;
|
||||
var stringProto = require("./index").string;
|
||||
var throwsOnProto = require("./throws-on-proto");
|
||||
|
||||
describe("prototypes", function () {
|
||||
describe(".array", function () {
|
||||
// eslint-disable-next-line mocha/no-setup-in-describe
|
||||
verifyProperties(arrayProto, Array);
|
||||
});
|
||||
describe(".function", function () {
|
||||
// eslint-disable-next-line mocha/no-setup-in-describe
|
||||
verifyProperties(functionProto, Function);
|
||||
});
|
||||
describe(".map", function () {
|
||||
// eslint-disable-next-line mocha/no-setup-in-describe
|
||||
verifyProperties(mapProto, Map);
|
||||
});
|
||||
describe(".object", function () {
|
||||
// eslint-disable-next-line mocha/no-setup-in-describe
|
||||
verifyProperties(objectProto, Object);
|
||||
});
|
||||
describe(".set", function () {
|
||||
// eslint-disable-next-line mocha/no-setup-in-describe
|
||||
verifyProperties(setProto, Set);
|
||||
});
|
||||
describe(".string", function () {
|
||||
// eslint-disable-next-line mocha/no-setup-in-describe
|
||||
verifyProperties(stringProto, String);
|
||||
});
|
||||
});
|
||||
|
||||
function verifyProperties(p, origin) {
|
||||
var disallowedProperties = ["size", "caller", "callee", "arguments"];
|
||||
if (throwsOnProto) {
|
||||
disallowedProperties.push("__proto__");
|
||||
}
|
||||
|
||||
it("should have all the methods of the origin prototype", function () {
|
||||
var methodNames = Object.getOwnPropertyNames(origin.prototype).filter(
|
||||
function (name) {
|
||||
if (disallowedProperties.includes(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return typeof origin.prototype[name] === "function";
|
||||
}
|
||||
);
|
||||
|
||||
methodNames.forEach(function (name) {
|
||||
assert.isTrue(Object.prototype.hasOwnProperty.call(p, name), name);
|
||||
});
|
||||
});
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user