@datadog/datadog-ci 2.40.2 → 2.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/commands/deployment/cli.js +2 -1
- package/dist/commands/deployment/cli.js.map +1 -1
- package/dist/commands/deployment/correlate.d.ts +18 -0
- package/dist/commands/deployment/correlate.js +154 -0
- package/dist/commands/deployment/correlate.js.map +1 -0
- package/dist/commands/dsyms/upload.js +3 -3
- package/dist/commands/dsyms/upload.js.map +1 -1
- package/dist/commands/dsyms/utils.js +2 -4
- package/dist/commands/dsyms/utils.js.map +1 -1
- package/dist/commands/elf-symbols/upload.js +3 -2
- package/dist/commands/elf-symbols/upload.js.map +1 -1
- package/dist/commands/flutter-symbols/upload.js +2 -2
- package/dist/commands/flutter-symbols/upload.js.map +1 -1
- package/dist/commands/junit/upload.js +3 -5
- package/dist/commands/junit/upload.js.map +1 -1
- package/dist/commands/sarif/upload.js +2 -2
- package/dist/commands/sarif/upload.js.map +1 -1
- package/dist/commands/sourcemaps/upload.js +2 -2
- package/dist/commands/sourcemaps/upload.js.map +1 -1
- package/dist/commands/synthetics/utils/public.js +2 -2
- package/dist/commands/synthetics/utils/public.js.map +1 -1
- package/dist/commands/unity-symbols/upload.js +2 -2
- package/dist/commands/unity-symbols/upload.js.map +1 -1
- package/dist/helpers/git/get-git-data.d.ts +2 -0
- package/dist/helpers/git/get-git-data.js +11 -1
- package/dist/helpers/git/get-git-data.js.map +1 -1
- package/package.json +5 -4
- package/dist/__tests__/cli.test.d.ts +0 -1
- package/dist/__tests__/cli.test.js +0 -41
- package/dist/__tests__/cli.test.js.map +0 -1
- package/dist/commands/cloud-run/__tests__/fixtures.d.ts +0 -2
- package/dist/commands/cloud-run/__tests__/fixtures.js +0 -12
- package/dist/commands/cloud-run/__tests__/fixtures.js.map +0 -1
- package/dist/commands/cloud-run/__tests__/flare.test.d.ts +0 -1
- package/dist/commands/cloud-run/__tests__/flare.test.js +0 -557
- package/dist/commands/cloud-run/__tests__/flare.test.js.map +0 -1
- package/dist/commands/deployment/__tests__/mark.test.d.ts +0 -1
- package/dist/commands/deployment/__tests__/mark.test.js +0 -47
- package/dist/commands/deployment/__tests__/mark.test.js.map +0 -1
- package/dist/commands/dora/__tests__/deployment.test.d.ts +0 -1
- package/dist/commands/dora/__tests__/deployment.test.js +0 -201
- package/dist/commands/dora/__tests__/deployment.test.js.map +0 -1
- package/dist/commands/dsyms/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/dsyms/__tests__/upload.test.js +0 -346
- package/dist/commands/dsyms/__tests__/upload.test.js.map +0 -1
- package/dist/commands/dsyms/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/dsyms/__tests__/utils.test.js +0 -100
- package/dist/commands/dsyms/__tests__/utils.test.js.map +0 -1
- package/dist/commands/elf-symbols/__tests__/elf.test.d.ts +0 -1
- package/dist/commands/elf-symbols/__tests__/elf.test.js +0 -813
- package/dist/commands/elf-symbols/__tests__/elf.test.js.map +0 -1
- package/dist/commands/elf-symbols/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/elf-symbols/__tests__/upload.test.js +0 -249
- package/dist/commands/elf-symbols/__tests__/upload.test.js.map +0 -1
- package/dist/commands/flutter-symbols/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/flutter-symbols/__tests__/upload.test.js +0 -617
- package/dist/commands/flutter-symbols/__tests__/upload.test.js.map +0 -1
- package/dist/commands/gate/__tests__/evaluate.test.d.ts +0 -1
- package/dist/commands/gate/__tests__/evaluate.test.js +0 -398
- package/dist/commands/gate/__tests__/evaluate.test.js.map +0 -1
- package/dist/commands/gate/__tests__/scope.test.d.ts +0 -1
- package/dist/commands/gate/__tests__/scope.test.js +0 -29
- package/dist/commands/gate/__tests__/scope.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/git.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/git.test.js +0 -132
- package/dist/commands/git-metadata/__tests__/git.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/gitdb.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/gitdb.test.js +0 -1386
- package/dist/commands/git-metadata/__tests__/gitdb.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/library.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/library.test.js +0 -118
- package/dist/commands/git-metadata/__tests__/library.test.js.map +0 -1
- package/dist/commands/git-metadata/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/git-metadata/__tests__/upload.test.js +0 -52
- package/dist/commands/git-metadata/__tests__/upload.test.js.map +0 -1
- package/dist/commands/junit/__tests__/id.test.d.ts +0 -1
- package/dist/commands/junit/__tests__/id.test.js +0 -24
- package/dist/commands/junit/__tests__/id.test.js.map +0 -1
- package/dist/commands/junit/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/junit/__tests__/upload.test.js +0 -495
- package/dist/commands/junit/__tests__/upload.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/fixtures.d.ts +0 -51
- package/dist/commands/lambda/__tests__/fixtures.js +0 -146
- package/dist/commands/lambda/__tests__/fixtures.js.map +0 -1
- package/dist/commands/lambda/__tests__/flare.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/flare.test.js +0 -730
- package/dist/commands/lambda/__tests__/flare.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/commons.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/commons.test.js +0 -791
- package/dist/commands/lambda/__tests__/functions/commons.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part1.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js +0 -386
- package/dist/commands/lambda/__tests__/functions/instrument.part1.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part2.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js +0 -721
- package/dist/commands/lambda/__tests__/functions/instrument.part2.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/uninstrument.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +0 -513
- package/dist/commands/lambda/__tests__/functions/uninstrument.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/functions/versionChecker.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/functions/versionChecker.test.js +0 -33
- package/dist/commands/lambda/__tests__/functions/versionChecker.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/instrument.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/instrument.test.js +0 -1511
- package/dist/commands/lambda/__tests__/instrument.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/loggroup.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/loggroup.test.js +0 -340
- package/dist/commands/lambda/__tests__/loggroup.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/prompt.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/prompt.test.js +0 -206
- package/dist/commands/lambda/__tests__/prompt.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/tags.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/tags.test.js +0 -305
- package/dist/commands/lambda/__tests__/tags.test.js.map +0 -1
- package/dist/commands/lambda/__tests__/uninstrument.test.d.ts +0 -1
- package/dist/commands/lambda/__tests__/uninstrument.test.js +0 -722
- package/dist/commands/lambda/__tests__/uninstrument.test.js.map +0 -1
- package/dist/commands/measure/__tests__/measure.test.d.ts +0 -1
- package/dist/commands/measure/__tests__/measure.test.js +0 -110
- package/dist/commands/measure/__tests__/measure.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/codepush.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/codepush.test.js +0 -161
- package/dist/commands/react-native/__tests__/codepush.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/interfaces.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/interfaces.test.js +0 -33
- package/dist/commands/react-native/__tests__/interfaces.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/upload.test.js +0 -238
- package/dist/commands/react-native/__tests__/upload.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/utils.test.js +0 -27
- package/dist/commands/react-native/__tests__/utils.test.js.map +0 -1
- package/dist/commands/react-native/__tests__/xcode.test.d.ts +0 -1
- package/dist/commands/react-native/__tests__/xcode.test.js +0 -465
- package/dist/commands/react-native/__tests__/xcode.test.js.map +0 -1
- package/dist/commands/sarif/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/sarif/__tests__/upload.test.js +0 -228
- package/dist/commands/sarif/__tests__/upload.test.js.map +0 -1
- package/dist/commands/sbom/__tests__/payload.test.d.ts +0 -1
- package/dist/commands/sbom/__tests__/payload.test.js +0 -262
- package/dist/commands/sbom/__tests__/payload.test.js.map +0 -1
- package/dist/commands/sbom/__tests__/validation.test.d.ts +0 -1
- package/dist/commands/sbom/__tests__/validation.test.js +0 -41
- package/dist/commands/sbom/__tests__/validation.test.js.map +0 -1
- package/dist/commands/sourcemaps/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/sourcemaps/__tests__/upload.test.js +0 -270
- package/dist/commands/sourcemaps/__tests__/upload.test.js.map +0 -1
- package/dist/commands/sourcemaps/__tests__/utils.test.d.ts +0 -1
- package/dist/commands/sourcemaps/__tests__/utils.test.js +0 -31
- package/dist/commands/sourcemaps/__tests__/utils.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/awsCommands.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/awsCommands.test.js +0 -192
- package/dist/commands/stepfunctions/__tests__/awsCommands.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.d.ts +0 -6
- package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js +0 -45
- package/dist/commands/stepfunctions/__tests__/fixtures/aws-resources.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/fixtures/cli.d.ts +0 -5
- package/dist/commands/stepfunctions/__tests__/fixtures/cli.js +0 -19
- package/dist/commands/stepfunctions/__tests__/fixtures/cli.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/helpers.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/helpers.test.js +0 -205
- package/dist/commands/stepfunctions/__tests__/helpers.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/instrument.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/instrument.test.js +0 -431
- package/dist/commands/stepfunctions/__tests__/instrument.test.js.map +0 -1
- package/dist/commands/stepfunctions/__tests__/uninstrument.test.d.ts +0 -1
- package/dist/commands/stepfunctions/__tests__/uninstrument.test.js +0 -166
- package/dist/commands/stepfunctions/__tests__/uninstrument.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/api.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/api.test.js +0 -422
- package/dist/commands/synthetics/__tests__/api.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/cli.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/cli.test.js +0 -1325
- package/dist/commands/synthetics/__tests__/cli.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/fixtures.d.ts +0 -149
- package/dist/commands/synthetics/__tests__/fixtures.js +0 -507
- package/dist/commands/synthetics/__tests__/fixtures.js.map +0 -1
- package/dist/commands/synthetics/__tests__/mobile.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/mobile.test.js +0 -376
- package/dist/commands/synthetics/__tests__/mobile.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/reporters/default.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/reporters/default.test.js +0 -354
- package/dist/commands/synthetics/__tests__/reporters/default.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/reporters/junit.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/reporters/junit.test.js +0 -353
- package/dist/commands/synthetics/__tests__/reporters/junit.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js +0 -232
- package/dist/commands/synthetics/__tests__/reporters/mobile/app-upload.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/run-tests-lib.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/run-tests-lib.test.js +0 -735
- package/dist/commands/synthetics/__tests__/run-tests-lib.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/test.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/test.test.js +0 -33
- package/dist/commands/synthetics/__tests__/test.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/crypto.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js +0 -21
- package/dist/commands/synthetics/__tests__/tunnel/crypto.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js +0 -80
- package/dist/commands/synthetics/__tests__/tunnel/tunnel.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js +0 -109
- package/dist/commands/synthetics/__tests__/tunnel/websocket.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/utils/internal.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/utils/internal.test.js +0 -186
- package/dist/commands/synthetics/__tests__/utils/internal.test.js.map +0 -1
- package/dist/commands/synthetics/__tests__/utils/public.test.d.ts +0 -1
- package/dist/commands/synthetics/__tests__/utils/public.test.js +0 -1526
- package/dist/commands/synthetics/__tests__/utils/public.test.js.map +0 -1
- package/dist/commands/tag/__tests__/tag.test.d.ts +0 -1
- package/dist/commands/tag/__tests__/tag.test.js +0 -75
- package/dist/commands/tag/__tests__/tag.test.js.map +0 -1
- package/dist/commands/trace/__tests__/trace.test.d.ts +0 -1
- package/dist/commands/trace/__tests__/trace.test.js +0 -145
- package/dist/commands/trace/__tests__/trace.test.js.map +0 -1
- package/dist/commands/unity-symbols/__tests__/upload.test.d.ts +0 -1
- package/dist/commands/unity-symbols/__tests__/upload.test.js +0 -369
- package/dist/commands/unity-symbols/__tests__/upload.test.js.map +0 -1
- package/dist/helpers/__tests__/app.test.d.ts +0 -1
- package/dist/helpers/__tests__/app.test.js +0 -31
- package/dist/helpers/__tests__/app.test.js.map +0 -1
- package/dist/helpers/__tests__/ci.test.d.ts +0 -1
- package/dist/helpers/__tests__/ci.test.js +0 -252
- package/dist/helpers/__tests__/ci.test.js.map +0 -1
- package/dist/helpers/__tests__/fixtures.d.ts +0 -33
- package/dist/helpers/__tests__/fixtures.js +0 -71
- package/dist/helpers/__tests__/fixtures.js.map +0 -1
- package/dist/helpers/__tests__/flare.test.d.ts +0 -1
- package/dist/helpers/__tests__/flare.test.js +0 -226
- package/dist/helpers/__tests__/flare.test.js.map +0 -1
- package/dist/helpers/__tests__/fs.test.d.ts +0 -1
- package/dist/helpers/__tests__/fs.test.js +0 -189
- package/dist/helpers/__tests__/fs.test.js.map +0 -1
- package/dist/helpers/__tests__/plist.test.d.ts +0 -1
- package/dist/helpers/__tests__/plist.test.js +0 -43
- package/dist/helpers/__tests__/plist.test.js.map +0 -1
- package/dist/helpers/__tests__/prompt.test.d.ts +0 -1
- package/dist/helpers/__tests__/prompt.test.js +0 -71
- package/dist/helpers/__tests__/prompt.test.js.map +0 -1
- package/dist/helpers/__tests__/retry.test.d.ts +0 -1
- package/dist/helpers/__tests__/retry.test.js +0 -99
- package/dist/helpers/__tests__/retry.test.js.map +0 -1
- package/dist/helpers/__tests__/tags.test.d.ts +0 -1
- package/dist/helpers/__tests__/tags.test.js +0 -71
- package/dist/helpers/__tests__/tags.test.js.map +0 -1
- package/dist/helpers/__tests__/upload.test.d.ts +0 -1
- package/dist/helpers/__tests__/upload.test.js +0 -231
- package/dist/helpers/__tests__/upload.test.js.map +0 -1
- package/dist/helpers/__tests__/user-provided-git.test.d.ts +0 -1
- package/dist/helpers/__tests__/user-provided-git.test.js +0 -119
- package/dist/helpers/__tests__/user-provided-git.test.js.map +0 -1
- package/dist/helpers/__tests__/utils.test.d.ts +0 -1
- package/dist/helpers/__tests__/utils.test.js +0 -429
- package/dist/helpers/__tests__/utils.test.js.map +0 -1
- package/dist/helpers/__tests__/validation.test.d.ts +0 -1
- package/dist/helpers/__tests__/validation.test.js +0 -25
- package/dist/helpers/__tests__/validation.test.js.map +0 -1
- package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.d.ts +0 -1
- package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js +0 -103
- package/dist/helpers/git/__tests__/format-git-sourcemaps-data.test.js.map +0 -1
- package/dist/helpers/git/__tests__/format-git-span-data.test.d.ts +0 -1
- package/dist/helpers/git/__tests__/format-git-span-data.test.js +0 -121
- package/dist/helpers/git/__tests__/format-git-span-data.test.js.map +0 -1
- package/dist/helpers/git/__tests__/get-git-data.test.d.ts +0 -1
- package/dist/helpers/git/__tests__/get-git-data.test.js +0 -72
- package/dist/helpers/git/__tests__/get-git-data.test.js.map +0 -1
|
@@ -1,617 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const os_1 = __importDefault(require("os"));
|
|
39
|
-
const fixtures_1 = require("../../../helpers/__tests__/fixtures");
|
|
40
|
-
const format_git_sourcemaps_data_1 = require("../../../helpers/git/format-git-sourcemaps-data");
|
|
41
|
-
const utils_1 = require("../../../helpers/utils");
|
|
42
|
-
const version_1 = require("../../../helpers/version");
|
|
43
|
-
const dsyms = __importStar(require("../../dsyms/upload"));
|
|
44
|
-
const sourcemaps = __importStar(require("../../sourcemaps/upload"));
|
|
45
|
-
const helpers_1 = require("../helpers");
|
|
46
|
-
const renderer_1 = require("../renderer");
|
|
47
|
-
const upload_1 = require("../upload");
|
|
48
|
-
jest.mock('../../../helpers/utils', () => (Object.assign(Object.assign({}, jest.requireActual('../../../helpers/utils')), { performSubCommand: jest.fn() })));
|
|
49
|
-
jest.mock('../helpers', () => (Object.assign(Object.assign({}, jest.requireActual('../helpers')), { uploadMultipartHelper: jest.fn() })));
|
|
50
|
-
jest.mock('../../../helpers/git/format-git-sourcemaps-data', () => (Object.assign(Object.assign({}, jest.requireActual('../../../helpers/git/format-git-sourcemaps-data')), { getRepositoryData: jest.fn() })));
|
|
51
|
-
const cliVersion = version_1.version;
|
|
52
|
-
const fixtureDir = './src/commands/flutter-symbols/__tests__/fixtures';
|
|
53
|
-
describe('flutter-symbol upload', () => {
|
|
54
|
-
const runCommand = (prepFunction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
56
|
-
prepFunction(command);
|
|
57
|
-
const exitCode = yield command.execute();
|
|
58
|
-
return { exitCode, context: command.context };
|
|
59
|
-
});
|
|
60
|
-
describe('parameter validation', () => {
|
|
61
|
-
test('fails if no service name given', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
-
const { exitCode, context } = yield runCommand((_) => { });
|
|
63
|
-
const errorOutput = context.stderr.toString();
|
|
64
|
-
expect(exitCode).not.toBe(0);
|
|
65
|
-
expect(errorOutput).toContain('Error');
|
|
66
|
-
expect(errorOutput).toContain('"service-name" is required');
|
|
67
|
-
}));
|
|
68
|
-
test('requires valid pubspec', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
-
const { exitCode, context } = yield runCommand((cmd) => {
|
|
70
|
-
cmd['serviceName'] = 'fake.service';
|
|
71
|
-
});
|
|
72
|
-
const errorOutput = context.stderr.toString();
|
|
73
|
-
expect(exitCode).not.toBe(0);
|
|
74
|
-
expect(errorOutput).toBe((0, renderer_1.renderMissingPubspecError)('./pubspec.yaml'));
|
|
75
|
-
}));
|
|
76
|
-
test('uses API Key from env over config from JSON file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
-
const { exitCode, context } = yield runCommand((cmd) => {
|
|
78
|
-
cmd['configPath'] = 'src/commands/flutter-symbols/__tests__/fixtures/config/datadog-ci.json';
|
|
79
|
-
cmd['serviceName'] = 'fake.service';
|
|
80
|
-
cmd['version'] = '1.0.0+114';
|
|
81
|
-
process.env.DATADOG_API_KEY = 'fake_api_key';
|
|
82
|
-
});
|
|
83
|
-
const output = context.stdout.toString().split(os_1.default.EOL);
|
|
84
|
-
expect(exitCode).toBe(0);
|
|
85
|
-
expect(output).toContain('API keys were specified both in a configuration file and in the environment.');
|
|
86
|
-
expect(output).toContain('The environment API key ending in _key will be used.');
|
|
87
|
-
}));
|
|
88
|
-
test('version bypasses pubspec check', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
89
|
-
const { exitCode, context } = yield runCommand((cmd) => {
|
|
90
|
-
cmd['serviceName'] = 'fake.service';
|
|
91
|
-
cmd['version'] = '1.0.0+114';
|
|
92
|
-
});
|
|
93
|
-
const errorOutput = context.stderr.toString();
|
|
94
|
-
expect(exitCode).toBe(0);
|
|
95
|
-
expect(errorOutput).toBe('');
|
|
96
|
-
}));
|
|
97
|
-
test('minified-path-prefix required if web-sourcemaps is specified', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
-
const { exitCode, context } = yield runCommand((cmd) => {
|
|
99
|
-
cmd['serviceName'] = 'fake.service';
|
|
100
|
-
cmd['version'] = '1.0.0+114';
|
|
101
|
-
cmd['webSourceMaps'] = true;
|
|
102
|
-
});
|
|
103
|
-
const errorOutput = context.stderr.toString();
|
|
104
|
-
expect(exitCode).toBe(1);
|
|
105
|
-
expect(errorOutput).toBe((0, renderer_1.renderMinifiedPathPrefixRequired)());
|
|
106
|
-
}));
|
|
107
|
-
test('minified-path-prefix required if web-sourcemaps-location is specified', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
-
const { exitCode, context } = yield runCommand((cmd) => {
|
|
109
|
-
cmd['serviceName'] = 'fake.service';
|
|
110
|
-
cmd['version'] = '1.0.0+114';
|
|
111
|
-
cmd['webSourceMapsLocation'] = './fake/location';
|
|
112
|
-
});
|
|
113
|
-
const errorOutput = context.stderr.toString();
|
|
114
|
-
expect(exitCode).toBe(1);
|
|
115
|
-
expect(errorOutput).toBe((0, renderer_1.renderMinifiedPathPrefixRequired)());
|
|
116
|
-
}));
|
|
117
|
-
});
|
|
118
|
-
describe('getFlutterSymbolFiles', () => {
|
|
119
|
-
test('should read all symbol files', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
-
const command = new upload_1.UploadCommand();
|
|
121
|
-
const searchDir = `${fixtureDir}/dart-symbols`;
|
|
122
|
-
const files = command['getFlutterSymbolFiles'](searchDir);
|
|
123
|
-
expect(files).toEqual([
|
|
124
|
-
`${searchDir}/app.ios-arm64.symbols`,
|
|
125
|
-
`${searchDir}/app.android-x64.symbols`,
|
|
126
|
-
`${searchDir}/app.android-arm64.symbols`,
|
|
127
|
-
`${searchDir}/app.android-arm.symbols`,
|
|
128
|
-
]);
|
|
129
|
-
}));
|
|
130
|
-
});
|
|
131
|
-
describe('parsePubspec', () => {
|
|
132
|
-
test('writes error on missing pubspec', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
134
|
-
const context = command.context;
|
|
135
|
-
const exitCode = yield command['parsePubspecVersion']('./pubspec.yaml');
|
|
136
|
-
const errorOutput = context.stderr.toString();
|
|
137
|
-
expect(exitCode).toBe(1);
|
|
138
|
-
expect(errorOutput).toBe((0, renderer_1.renderMissingPubspecError)('./pubspec.yaml'));
|
|
139
|
-
}));
|
|
140
|
-
test('writes error on invalid pubspec', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
141
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
142
|
-
const context = command.context;
|
|
143
|
-
const exitCode = yield command['parsePubspecVersion'](`${fixtureDir}/pubspecs/invalidPubspec.yaml`);
|
|
144
|
-
const errorOutput = context.stderr.toString();
|
|
145
|
-
expect(exitCode).toBe(1);
|
|
146
|
-
expect(errorOutput).toBe((0, renderer_1.renderInvalidPubspecError)(`${fixtureDir}/pubspecs/invalidPubspec.yaml`));
|
|
147
|
-
}));
|
|
148
|
-
test('writes error on missing version in pubspec', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
149
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
150
|
-
const context = command.context;
|
|
151
|
-
const exitCode = yield command['parsePubspecVersion'](`${fixtureDir}/pubspecs/missingVersionPubspec.yaml`);
|
|
152
|
-
const errorOutput = context.stderr.toString();
|
|
153
|
-
expect(exitCode).toBe(1);
|
|
154
|
-
expect(errorOutput).toBe((0, renderer_1.renderPubspecMissingVersionError)(`${fixtureDir}/pubspecs/missingVersionPubspec.yaml`));
|
|
155
|
-
}));
|
|
156
|
-
test('populates version from valid pubspec', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
157
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
158
|
-
const context = command.context;
|
|
159
|
-
const exitCode = yield command['parsePubspecVersion'](`${fixtureDir}/pubspecs/validPubspec.yaml`);
|
|
160
|
-
const errorOutput = context.stderr.toString();
|
|
161
|
-
expect(exitCode).toBe(0);
|
|
162
|
-
expect(errorOutput).toBe('');
|
|
163
|
-
expect(command['version']).toBe('1.2.3');
|
|
164
|
-
}));
|
|
165
|
-
test('strips pre-release from pre-release pubspec and shows warning', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
166
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
167
|
-
const context = command.context;
|
|
168
|
-
const exitCode = yield command['parsePubspecVersion'](`${fixtureDir}/pubspecs/prereleasePubspec.yaml`);
|
|
169
|
-
const errorOutput = context.stderr.toString();
|
|
170
|
-
expect(exitCode).toBe(0);
|
|
171
|
-
expect(errorOutput).toBe((0, renderer_1.renderVersionBuildNumberWarning)(`${fixtureDir}/pubspecs/prereleasePubspec.yaml`));
|
|
172
|
-
expect(command['version']).toBe('1.2.3');
|
|
173
|
-
}));
|
|
174
|
-
test('strips build from build pubspec and shows warning', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
175
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
176
|
-
const context = command.context;
|
|
177
|
-
const exitCode = yield command['parsePubspecVersion'](`${fixtureDir}/pubspecs/buildPubspec.yaml`);
|
|
178
|
-
const errorOutput = context.stderr.toString();
|
|
179
|
-
expect(exitCode).toBe(0);
|
|
180
|
-
expect(errorOutput).toBe((0, renderer_1.renderVersionBuildNumberWarning)(`${fixtureDir}/pubspecs/buildPubspec.yaml`));
|
|
181
|
-
expect(command['version']).toBe('1.2.3');
|
|
182
|
-
}));
|
|
183
|
-
});
|
|
184
|
-
describe('dsyms upload', () => {
|
|
185
|
-
test('calls dsyms sub-command with proper default parameters', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
186
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
187
|
-
cmd['serviceName'] = 'fake.service';
|
|
188
|
-
cmd['version'] = '1.0.0';
|
|
189
|
-
cmd['iosDsyms'] = true;
|
|
190
|
-
});
|
|
191
|
-
expect(exitCode).toBe(0);
|
|
192
|
-
expect(utils_1.performSubCommand).toHaveBeenCalledWith(dsyms.UploadCommand, ['dsyms', 'upload', './build/ios/archive/Runner.xcarchive/dSYMs'], expect.anything());
|
|
193
|
-
}));
|
|
194
|
-
test('calls dsyms sub-command with dry-run on dry-run', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
195
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
196
|
-
cmd['serviceName'] = 'fake.service';
|
|
197
|
-
cmd['version'] = '1.0.0';
|
|
198
|
-
cmd['iosDsyms'] = true;
|
|
199
|
-
cmd['dryRun'] = true;
|
|
200
|
-
});
|
|
201
|
-
expect(exitCode).toBe(0);
|
|
202
|
-
expect(utils_1.performSubCommand).toHaveBeenCalledWith(dsyms.UploadCommand, ['dsyms', 'upload', './build/ios/archive/Runner.xcarchive/dSYMs', '--dry-run'], expect.anything());
|
|
203
|
-
}));
|
|
204
|
-
test('calls dsyms sub-command passing through dsymLocation', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
205
|
-
const { exitCode, context } = yield runCommand((cmd) => {
|
|
206
|
-
cmd['serviceName'] = 'fake.service';
|
|
207
|
-
cmd['version'] = '1.0.0';
|
|
208
|
-
cmd['iosDsymsLocation'] = './dsym-location';
|
|
209
|
-
});
|
|
210
|
-
const errorOutput = context.stderr.toString();
|
|
211
|
-
expect(exitCode).toBe(0);
|
|
212
|
-
expect(utils_1.performSubCommand).toHaveBeenCalledWith(dsyms.UploadCommand, ['dsyms', 'upload', './dsym-location'], expect.anything());
|
|
213
|
-
expect(errorOutput).toBe('');
|
|
214
|
-
}));
|
|
215
|
-
});
|
|
216
|
-
describe('android mapping upload', () => {
|
|
217
|
-
const addDefaultCommandParameters = (command) => {
|
|
218
|
-
command['serviceName'] = 'fake.service';
|
|
219
|
-
command['version'] = '1.0.0';
|
|
220
|
-
};
|
|
221
|
-
const mockGitRepoParameters = (command) => {
|
|
222
|
-
command['gitData'] = {
|
|
223
|
-
hash: 'fake-git-hash',
|
|
224
|
-
remote: 'fake-git-remote',
|
|
225
|
-
trackedFilesMatcher: new format_git_sourcemaps_data_1.TrackedFilesMatcher([
|
|
226
|
-
'./lib/main.dart',
|
|
227
|
-
'./android/app/src/main/kotlin/com/datadoghq/example/flutter/MainActivity.kt',
|
|
228
|
-
'./ios/Runner/AppDelegate.swift',
|
|
229
|
-
]),
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
test('errors if mapping file does not exist', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
233
|
-
const { exitCode, context } = yield runCommand((cmd) => {
|
|
234
|
-
addDefaultCommandParameters(cmd);
|
|
235
|
-
cmd['androidMappingLocation'] = `${fixtureDir}/android/missing.txt`;
|
|
236
|
-
});
|
|
237
|
-
const errorOutput = context.stderr.toString();
|
|
238
|
-
expect(exitCode).not.toBe(0);
|
|
239
|
-
expect(errorOutput).toBe((0, renderer_1.renderMissingAndroidMappingFile)(`${fixtureDir}/android/missing.txt`));
|
|
240
|
-
}));
|
|
241
|
-
test('errors if default mapping file does not exist', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
242
|
-
const { exitCode, context } = yield runCommand((cmd) => {
|
|
243
|
-
addDefaultCommandParameters(cmd);
|
|
244
|
-
cmd['androidMapping'] = true;
|
|
245
|
-
});
|
|
246
|
-
const errorOutput = context.stderr.toString();
|
|
247
|
-
expect(exitCode).not.toBe(0);
|
|
248
|
-
expect(errorOutput).toBe((0, renderer_1.renderMissingAndroidMappingFile)('./build/app/outputs/mapping/release/mapping.txt'));
|
|
249
|
-
}));
|
|
250
|
-
test('creates correct metadata payload', () => {
|
|
251
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
252
|
-
addDefaultCommandParameters(command);
|
|
253
|
-
mockGitRepoParameters(command);
|
|
254
|
-
const metadata = command['getAndroidMetadata']();
|
|
255
|
-
expect(metadata).toEqual({
|
|
256
|
-
cli_version: cliVersion,
|
|
257
|
-
git_commit_sha: 'fake-git-hash',
|
|
258
|
-
git_repository_url: 'fake-git-remote',
|
|
259
|
-
service: 'fake.service',
|
|
260
|
-
type: 'jvm_mapping_file',
|
|
261
|
-
variant: 'release',
|
|
262
|
-
version: '1.0.0',
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
test('build in version is sanitized in metadata payload', () => {
|
|
266
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
267
|
-
addDefaultCommandParameters(command);
|
|
268
|
-
mockGitRepoParameters(command);
|
|
269
|
-
command['version'] = '1.2.4+987';
|
|
270
|
-
const metadata = command['getAndroidMetadata']();
|
|
271
|
-
expect(metadata).toEqual({
|
|
272
|
-
cli_version: cliVersion,
|
|
273
|
-
git_commit_sha: 'fake-git-hash',
|
|
274
|
-
git_repository_url: 'fake-git-remote',
|
|
275
|
-
service: 'fake.service',
|
|
276
|
-
type: 'jvm_mapping_file',
|
|
277
|
-
variant: 'release',
|
|
278
|
-
version: '1.2.4-987',
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
test('uploads correct multipart payload without repository', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
282
|
-
;
|
|
283
|
-
helpers_1.uploadMultipartHelper.mockResolvedValueOnce('');
|
|
284
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
285
|
-
addDefaultCommandParameters(cmd);
|
|
286
|
-
cmd['androidMappingLocation'] = `${fixtureDir}/android/fake-mapping.txt`;
|
|
287
|
-
});
|
|
288
|
-
const expectedMetadata = {
|
|
289
|
-
cli_version: cliVersion,
|
|
290
|
-
service: 'fake.service',
|
|
291
|
-
type: 'jvm_mapping_file',
|
|
292
|
-
variant: 'release',
|
|
293
|
-
version: '1.0.0',
|
|
294
|
-
};
|
|
295
|
-
expect(helpers_1.uploadMultipartHelper).toHaveBeenCalled();
|
|
296
|
-
const payload = helpers_1.uploadMultipartHelper.mock.calls[0][1];
|
|
297
|
-
expect(JSON.parse(payload.content.get('event').value)).toStrictEqual(expectedMetadata);
|
|
298
|
-
const mappingFileItem = payload.content.get('jvm_mapping_file');
|
|
299
|
-
expect(mappingFileItem).toBeTruthy();
|
|
300
|
-
expect(mappingFileItem.options.filename).toBe('jvm_mapping');
|
|
301
|
-
expect(mappingFileItem.path).toBe(`${fixtureDir}/android/fake-mapping.txt`);
|
|
302
|
-
expect(exitCode).toBe(0);
|
|
303
|
-
}));
|
|
304
|
-
test('uploads correct multipart payload with repository', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
305
|
-
;
|
|
306
|
-
helpers_1.uploadMultipartHelper.mockResolvedValueOnce('');
|
|
307
|
-
format_git_sourcemaps_data_1.getRepositoryData.mockResolvedValueOnce({
|
|
308
|
-
hash: 'fake-git-hash',
|
|
309
|
-
remote: 'fake-git-remote',
|
|
310
|
-
trackedFilesMatcher: new format_git_sourcemaps_data_1.TrackedFilesMatcher([
|
|
311
|
-
'./lib/main.dart',
|
|
312
|
-
'./android/app/src/main/kotlin/com/datadoghq/example/flutter/MainActivity.kt',
|
|
313
|
-
'./ios/Runner/AppDelegate.swift',
|
|
314
|
-
]),
|
|
315
|
-
});
|
|
316
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
317
|
-
addDefaultCommandParameters(cmd);
|
|
318
|
-
cmd['androidMappingLocation'] = `${fixtureDir}/android/fake-mapping.txt`;
|
|
319
|
-
});
|
|
320
|
-
const expectedMetadata = {
|
|
321
|
-
cli_version: cliVersion,
|
|
322
|
-
git_commit_sha: 'fake-git-hash',
|
|
323
|
-
git_repository_url: 'fake-git-remote',
|
|
324
|
-
service: 'fake.service',
|
|
325
|
-
type: 'jvm_mapping_file',
|
|
326
|
-
variant: 'release',
|
|
327
|
-
version: '1.0.0',
|
|
328
|
-
};
|
|
329
|
-
const expectedRepository = {
|
|
330
|
-
data: [
|
|
331
|
-
{
|
|
332
|
-
files: [
|
|
333
|
-
'./lib/main.dart',
|
|
334
|
-
'./android/app/src/main/kotlin/com/datadoghq/example/flutter/MainActivity.kt',
|
|
335
|
-
'./ios/Runner/AppDelegate.swift',
|
|
336
|
-
],
|
|
337
|
-
hash: 'fake-git-hash',
|
|
338
|
-
repository_url: 'fake-git-remote',
|
|
339
|
-
},
|
|
340
|
-
],
|
|
341
|
-
version: 1,
|
|
342
|
-
};
|
|
343
|
-
expect(helpers_1.uploadMultipartHelper).toHaveBeenCalled();
|
|
344
|
-
const payload = helpers_1.uploadMultipartHelper.mock.calls[0][1];
|
|
345
|
-
expect(JSON.parse(payload.content.get('event').value)).toStrictEqual(expectedMetadata);
|
|
346
|
-
const repoValue = payload.content.get('repository');
|
|
347
|
-
expect(JSON.parse(repoValue.value)).toStrictEqual(expectedRepository);
|
|
348
|
-
expect((repoValue === null || repoValue === void 0 ? void 0 : repoValue.options).filename).toBe('repository');
|
|
349
|
-
expect((repoValue === null || repoValue === void 0 ? void 0 : repoValue.options).contentType).toBe('application/json');
|
|
350
|
-
expect(exitCode).toBe(0);
|
|
351
|
-
}));
|
|
352
|
-
test('skips upload on dry run', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
353
|
-
;
|
|
354
|
-
helpers_1.uploadMultipartHelper.mockResolvedValueOnce('');
|
|
355
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
356
|
-
addDefaultCommandParameters(cmd);
|
|
357
|
-
cmd['androidMappingLocation'] = `${fixtureDir}/android/fake-mapping.txt`;
|
|
358
|
-
cmd['dryRun'] = true;
|
|
359
|
-
});
|
|
360
|
-
expect(helpers_1.uploadMultipartHelper).not.toHaveBeenCalled();
|
|
361
|
-
expect(exitCode).toBe(0);
|
|
362
|
-
}));
|
|
363
|
-
});
|
|
364
|
-
describe('web symbols upload', () => {
|
|
365
|
-
test('calls sourcemap sub-command with proper default parameters', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
366
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
367
|
-
cmd['serviceName'] = 'fake.service';
|
|
368
|
-
cmd['version'] = '1.2.3';
|
|
369
|
-
cmd['webSourceMaps'] = true;
|
|
370
|
-
cmd['minifiedPathPrefix'] = 'https://localhost';
|
|
371
|
-
});
|
|
372
|
-
expect(exitCode).toBe(0);
|
|
373
|
-
expect(utils_1.performSubCommand).toHaveBeenCalledWith(sourcemaps.UploadCommand, [
|
|
374
|
-
'sourcemaps',
|
|
375
|
-
'upload',
|
|
376
|
-
'./build/web',
|
|
377
|
-
'--service=fake.service',
|
|
378
|
-
'--release-version=1.2.3',
|
|
379
|
-
'--minified-path-prefix=https://localhost',
|
|
380
|
-
], expect.anything());
|
|
381
|
-
}));
|
|
382
|
-
test('calls sourcemap sub-command with overridden location', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
383
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
384
|
-
cmd['serviceName'] = 'fake.service';
|
|
385
|
-
cmd['version'] = '1.2.3';
|
|
386
|
-
cmd['webSourceMaps'] = true;
|
|
387
|
-
cmd['webSourceMapsLocation'] = './other/location';
|
|
388
|
-
cmd['minifiedPathPrefix'] = 'https://localhost';
|
|
389
|
-
});
|
|
390
|
-
expect(exitCode).toBe(0);
|
|
391
|
-
expect(utils_1.performSubCommand).toHaveBeenCalledWith(sourcemaps.UploadCommand, [
|
|
392
|
-
'sourcemaps',
|
|
393
|
-
'upload',
|
|
394
|
-
'./other/location',
|
|
395
|
-
'--service=fake.service',
|
|
396
|
-
'--release-version=1.2.3',
|
|
397
|
-
'--minified-path-prefix=https://localhost',
|
|
398
|
-
], expect.anything());
|
|
399
|
-
}));
|
|
400
|
-
test('calls sourcemap sub-command with location only', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
401
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
402
|
-
cmd['serviceName'] = 'fake.service';
|
|
403
|
-
cmd['version'] = '1.2.3';
|
|
404
|
-
cmd['webSourceMapsLocation'] = './other/location';
|
|
405
|
-
cmd['minifiedPathPrefix'] = 'https://localhost';
|
|
406
|
-
});
|
|
407
|
-
expect(exitCode).toBe(0);
|
|
408
|
-
expect(utils_1.performSubCommand).toHaveBeenCalledWith(sourcemaps.UploadCommand, [
|
|
409
|
-
'sourcemaps',
|
|
410
|
-
'upload',
|
|
411
|
-
'./other/location',
|
|
412
|
-
'--service=fake.service',
|
|
413
|
-
'--release-version=1.2.3',
|
|
414
|
-
'--minified-path-prefix=https://localhost',
|
|
415
|
-
], expect.anything());
|
|
416
|
-
}));
|
|
417
|
-
test('calls sourcemap sub-command with dry-run', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
418
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
419
|
-
cmd['serviceName'] = 'fake.service';
|
|
420
|
-
cmd['version'] = '1.2.3';
|
|
421
|
-
cmd['webSourceMaps'] = true;
|
|
422
|
-
cmd['minifiedPathPrefix'] = 'https://localhost';
|
|
423
|
-
cmd['dryRun'] = true;
|
|
424
|
-
});
|
|
425
|
-
expect(exitCode).toBe(0);
|
|
426
|
-
expect(utils_1.performSubCommand).toHaveBeenCalledWith(sourcemaps.UploadCommand, [
|
|
427
|
-
'sourcemaps',
|
|
428
|
-
'upload',
|
|
429
|
-
'./build/web',
|
|
430
|
-
'--service=fake.service',
|
|
431
|
-
'--release-version=1.2.3',
|
|
432
|
-
'--minified-path-prefix=https://localhost',
|
|
433
|
-
'--dry-run',
|
|
434
|
-
], expect.anything());
|
|
435
|
-
}));
|
|
436
|
-
});
|
|
437
|
-
describe('flutter symbol upload', () => {
|
|
438
|
-
const addDefaultCommandParameters = (command) => {
|
|
439
|
-
command['serviceName'] = 'fake.service';
|
|
440
|
-
command['version'] = '1.0.0';
|
|
441
|
-
};
|
|
442
|
-
const mockGitRepoParameters = (command) => {
|
|
443
|
-
command['gitData'] = {
|
|
444
|
-
hash: 'fake-git-hash',
|
|
445
|
-
remote: 'fake-git-remote',
|
|
446
|
-
trackedFilesMatcher: new format_git_sourcemaps_data_1.TrackedFilesMatcher([
|
|
447
|
-
'./lib/main.dart',
|
|
448
|
-
'./android/app/src/main/kotlin/com/datadoghq/example/flutter/MainActivity.kt',
|
|
449
|
-
'./ios/Runner/AppDelegate.swift',
|
|
450
|
-
]),
|
|
451
|
-
};
|
|
452
|
-
};
|
|
453
|
-
test('errors if symbol directory is missing', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
454
|
-
const { exitCode, context } = yield runCommand((cmd) => {
|
|
455
|
-
addDefaultCommandParameters(cmd);
|
|
456
|
-
cmd['dartSymbolsLocation'] = `${fixtureDir}/missing-dir`;
|
|
457
|
-
});
|
|
458
|
-
const errorOutput = context.stderr.toString();
|
|
459
|
-
expect(exitCode).not.toBe(0);
|
|
460
|
-
expect(errorOutput).toBe((0, renderer_1.renderMissingDartSymbolsDir)(`${fixtureDir}/missing-dir`));
|
|
461
|
-
}));
|
|
462
|
-
test('errors if symbol directory is a file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
463
|
-
const { exitCode, context } = yield runCommand((cmd) => {
|
|
464
|
-
addDefaultCommandParameters(cmd);
|
|
465
|
-
cmd['dartSymbolsLocation'] = `${fixtureDir}/dart-symbols/app.android-arm.symbols`;
|
|
466
|
-
});
|
|
467
|
-
const errorOutput = context.stderr.toString();
|
|
468
|
-
expect(exitCode).not.toBe(0);
|
|
469
|
-
expect(errorOutput).toBe((0, renderer_1.renderInvalidSymbolsDir)(`${fixtureDir}/dart-symbols/app.android-arm.symbols`));
|
|
470
|
-
}));
|
|
471
|
-
test('creates correct metadata payloads', () => {
|
|
472
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
473
|
-
addDefaultCommandParameters(command);
|
|
474
|
-
mockGitRepoParameters(command);
|
|
475
|
-
const metadata = command['getFlutterMetadata']('ios', 'arm64');
|
|
476
|
-
expect(metadata).toEqual({
|
|
477
|
-
arch: 'arm64',
|
|
478
|
-
cli_version: cliVersion,
|
|
479
|
-
git_commit_sha: 'fake-git-hash',
|
|
480
|
-
git_repository_url: 'fake-git-remote',
|
|
481
|
-
platform: 'ios',
|
|
482
|
-
service: 'fake.service',
|
|
483
|
-
type: 'flutter_symbol_file',
|
|
484
|
-
variant: 'release',
|
|
485
|
-
version: '1.0.0',
|
|
486
|
-
});
|
|
487
|
-
});
|
|
488
|
-
test('sanitizes build in version number payload', () => {
|
|
489
|
-
const command = (0, fixtures_1.createCommand)(upload_1.UploadCommand);
|
|
490
|
-
addDefaultCommandParameters(command);
|
|
491
|
-
mockGitRepoParameters(command);
|
|
492
|
-
command['version'] = '1.2.4+567';
|
|
493
|
-
const metadata = command['getFlutterMetadata']('ios', 'arm64');
|
|
494
|
-
expect(metadata).toEqual({
|
|
495
|
-
arch: 'arm64',
|
|
496
|
-
cli_version: cliVersion,
|
|
497
|
-
git_commit_sha: 'fake-git-hash',
|
|
498
|
-
git_repository_url: 'fake-git-remote',
|
|
499
|
-
platform: 'ios',
|
|
500
|
-
service: 'fake.service',
|
|
501
|
-
type: 'flutter_symbol_file',
|
|
502
|
-
variant: 'release',
|
|
503
|
-
version: '1.2.4-567',
|
|
504
|
-
});
|
|
505
|
-
});
|
|
506
|
-
test('parses symbol filenames into platform / arch', () => {
|
|
507
|
-
const info1 = (0, helpers_1.getArchInfoFromFilename)('app.android-arm.symbols');
|
|
508
|
-
const info2 = (0, helpers_1.getArchInfoFromFilename)('./a/directory/app.android-x64.symbols');
|
|
509
|
-
const info3 = (0, helpers_1.getArchInfoFromFilename)('./a/directory/app.confusing-.ios-arm64.symbols');
|
|
510
|
-
const info4 = (0, helpers_1.getArchInfoFromFilename)('app.bad.symbols');
|
|
511
|
-
expect(info1).toEqual({ platform: 'android', arch: 'arm' });
|
|
512
|
-
expect(info2).toEqual({ platform: 'android', arch: 'x64' });
|
|
513
|
-
expect(info3).toEqual({ platform: 'ios', arch: 'arm64' });
|
|
514
|
-
expect(info4).toBeUndefined();
|
|
515
|
-
});
|
|
516
|
-
const getExpectedMetadata = (platform, arch, gitCommitSha, gitRespositoryUrl) => (Object.assign(Object.assign(Object.assign({ arch, cli_version: cliVersion }, (gitCommitSha && { git_commit_sha: gitCommitSha })), (gitRespositoryUrl && { git_repository_url: gitRespositoryUrl })), { platform, service: 'fake.service', type: 'flutter_symbol_file', variant: 'release', version: '1.0.0' }));
|
|
517
|
-
test('uploads correct multipart payloads without repository', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
518
|
-
;
|
|
519
|
-
helpers_1.uploadMultipartHelper.mockResolvedValue('');
|
|
520
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
521
|
-
addDefaultCommandParameters(cmd);
|
|
522
|
-
cmd['dartSymbolsLocation'] = `${fixtureDir}/dart-symbols`;
|
|
523
|
-
});
|
|
524
|
-
const expectedMetadatas = [
|
|
525
|
-
getExpectedMetadata('android', 'arm'),
|
|
526
|
-
getExpectedMetadata('android', 'arm64'),
|
|
527
|
-
getExpectedMetadata('android', 'x64'),
|
|
528
|
-
getExpectedMetadata('ios', 'arm64'),
|
|
529
|
-
];
|
|
530
|
-
expect(helpers_1.uploadMultipartHelper).toHaveBeenCalledTimes(4);
|
|
531
|
-
expectedMetadatas.forEach((expectedMetadata) => {
|
|
532
|
-
const mockCalls = helpers_1.uploadMultipartHelper.mock.calls;
|
|
533
|
-
const index = mockCalls.findIndex((call) => {
|
|
534
|
-
const checkPayload = call[1];
|
|
535
|
-
const eventPayload = checkPayload.content.get('event').value;
|
|
536
|
-
return eventPayload === JSON.stringify(expectedMetadata);
|
|
537
|
-
});
|
|
538
|
-
// Ensure the metadata matches at least one call
|
|
539
|
-
expect(index).not.toBe(-1);
|
|
540
|
-
const payload = mockCalls[index][1];
|
|
541
|
-
const mappingFileItem = payload.content.get('flutter_symbol_file');
|
|
542
|
-
expect(mappingFileItem).toBeTruthy();
|
|
543
|
-
expect(mappingFileItem.options.filename).toBe('flutter_symbol_file');
|
|
544
|
-
const expectedPath = `${fixtureDir}/dart-symbols/app.${expectedMetadata.platform}-${expectedMetadata.arch}.symbols`;
|
|
545
|
-
expect(mappingFileItem.path).toBe(expectedPath);
|
|
546
|
-
});
|
|
547
|
-
expect(exitCode).toBe(0);
|
|
548
|
-
}));
|
|
549
|
-
test('uploads correct multipart payloads with repository', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
550
|
-
;
|
|
551
|
-
helpers_1.uploadMultipartHelper.mockResolvedValue('');
|
|
552
|
-
format_git_sourcemaps_data_1.getRepositoryData.mockResolvedValueOnce({
|
|
553
|
-
hash: 'fake-git-hash',
|
|
554
|
-
remote: 'fake-git-remote',
|
|
555
|
-
trackedFilesMatcher: new format_git_sourcemaps_data_1.TrackedFilesMatcher([
|
|
556
|
-
'./lib/main.dart',
|
|
557
|
-
'./android/app/src/main/kotlin/com/datadoghq/example/flutter/MainActivity.kt',
|
|
558
|
-
'./ios/Runner/AppDelegate.swift',
|
|
559
|
-
]),
|
|
560
|
-
});
|
|
561
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
562
|
-
addDefaultCommandParameters(cmd);
|
|
563
|
-
cmd['dartSymbolsLocation'] = `${fixtureDir}/dart-symbols`;
|
|
564
|
-
});
|
|
565
|
-
const expectedMetadatas = [
|
|
566
|
-
getExpectedMetadata('android', 'arm', 'fake-git-hash', 'fake-git-remote'),
|
|
567
|
-
getExpectedMetadata('android', 'arm64', 'fake-git-hash', 'fake-git-remote'),
|
|
568
|
-
getExpectedMetadata('android', 'x64', 'fake-git-hash', 'fake-git-remote'),
|
|
569
|
-
getExpectedMetadata('ios', 'arm64', 'fake-git-hash', 'fake-git-remote'),
|
|
570
|
-
];
|
|
571
|
-
const expectedRepository = {
|
|
572
|
-
data: [
|
|
573
|
-
{
|
|
574
|
-
files: [
|
|
575
|
-
'./lib/main.dart',
|
|
576
|
-
'./android/app/src/main/kotlin/com/datadoghq/example/flutter/MainActivity.kt',
|
|
577
|
-
'./ios/Runner/AppDelegate.swift',
|
|
578
|
-
],
|
|
579
|
-
hash: 'fake-git-hash',
|
|
580
|
-
repository_url: 'fake-git-remote',
|
|
581
|
-
},
|
|
582
|
-
],
|
|
583
|
-
version: 1,
|
|
584
|
-
};
|
|
585
|
-
expect(helpers_1.uploadMultipartHelper).toHaveBeenCalledTimes(4);
|
|
586
|
-
expectedMetadatas.forEach((expectedMetadata) => {
|
|
587
|
-
const mockCalls = helpers_1.uploadMultipartHelper.mock.calls;
|
|
588
|
-
const index = mockCalls.findIndex((call) => {
|
|
589
|
-
const checkPayload = call[1];
|
|
590
|
-
const eventPayload = checkPayload.content.get('event').value;
|
|
591
|
-
return eventPayload === JSON.stringify(expectedMetadata);
|
|
592
|
-
});
|
|
593
|
-
// Ensure the metadata matches at least one call
|
|
594
|
-
expect(index).not.toBe(-1);
|
|
595
|
-
const payload = mockCalls[index][1];
|
|
596
|
-
const repoValue = payload.content.get('repository');
|
|
597
|
-
expect(JSON.parse(repoValue.value)).toStrictEqual(expectedRepository);
|
|
598
|
-
expect(repoValue.options.filename).toBe('repository');
|
|
599
|
-
expect(repoValue.options.contentType).toBe('application/json');
|
|
600
|
-
expect(exitCode).toBe(0);
|
|
601
|
-
});
|
|
602
|
-
expect(exitCode).toBe(0);
|
|
603
|
-
}));
|
|
604
|
-
test('skips upload on dry run', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
605
|
-
;
|
|
606
|
-
helpers_1.uploadMultipartHelper.mockResolvedValueOnce('');
|
|
607
|
-
const { exitCode } = yield runCommand((cmd) => {
|
|
608
|
-
addDefaultCommandParameters(cmd);
|
|
609
|
-
cmd['dartSymbolsLocation'] = `${fixtureDir}/dart-symbols`;
|
|
610
|
-
cmd['dryRun'] = true;
|
|
611
|
-
});
|
|
612
|
-
expect(helpers_1.uploadMultipartHelper).not.toHaveBeenCalled();
|
|
613
|
-
expect(exitCode).toBe(0);
|
|
614
|
-
}));
|
|
615
|
-
});
|
|
616
|
-
});
|
|
617
|
-
//# sourceMappingURL=upload.test.js.map
|