powerbi-visuals-tools 4.0.5 → 4.0.7

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.
Files changed (51) hide show
  1. package/Changelog.md +11 -0
  2. package/bin/pbiviz-start.js +3 -1
  3. package/certs/PowerBICustomVisualTest_private.key +28 -0
  4. package/certs/PowerBICustomVisualTest_public.crt +19 -0
  5. package/config.json +35 -1
  6. package/lib/VisualGenerator.js +0 -95
  7. package/package.json +19 -16
  8. package/spec/.jshintrc +5 -0
  9. package/spec/clean-tests.js +31 -0
  10. package/spec/e2e/pbivizCertSpec.js +56 -0
  11. package/spec/e2e/pbivizInfoSpec.js +82 -0
  12. package/spec/e2e/pbivizNewSpec.js +265 -0
  13. package/spec/e2e/pbivizPackageSpec.js +670 -0
  14. package/spec/e2e/pbivizStartSpec.js +380 -0
  15. package/spec/e2e/pbivizWebpackVerSpec.js +102 -0
  16. package/spec/e2e/utils.js +63 -0
  17. package/spec/helpers/FileSystem.js +173 -0
  18. package/spec/jasmine-runner.js +36 -0
  19. package/spec/support/jasmine.json +11 -0
  20. package/templates/visuals/default/capabilities.json +2 -7
  21. package/templates/visuals/default/package.json +2 -2
  22. package/templates/visuals/default/pbiviz.json +1 -1
  23. package/templates/visuals/default/src/settings.ts +54 -3
  24. package/templates/visuals/default/src/visual.ts +14 -17
  25. package/templates/visuals/rhtml/capabilities.json +2 -1
  26. package/templates/visuals/rhtml/package.json +2 -2
  27. package/templates/visuals/rhtml/pbiviz.json +1 -1
  28. package/templates/visuals/rhtml/src/settings.ts +28 -3
  29. package/templates/visuals/rhtml/src/visual.ts +29 -23
  30. package/templates/visuals/rvisual/capabilities.json +2 -1
  31. package/templates/visuals/rvisual/package.json +2 -2
  32. package/templates/visuals/rvisual/pbiviz.json +1 -1
  33. package/templates/visuals/rvisual/src/settings.ts +28 -3
  34. package/templates/visuals/rvisual/src/visual.ts +13 -15
  35. package/templates/visuals/slicer/capabilities.json +2 -1
  36. package/templates/visuals/slicer/package.json +2 -2
  37. package/templates/visuals/slicer/pbiviz.json +1 -1
  38. package/templates/visuals/slicer/src/settings.ts +29 -3
  39. package/templates/visuals/slicer/src/visual.ts +14 -17
  40. package/templates/visuals/table/capabilities.json +2 -1
  41. package/templates/visuals/table/package.json +2 -2
  42. package/templates/visuals/table/pbiviz.json +1 -1
  43. package/templates/visuals/table/src/settings.ts +23 -3
  44. package/templates/visuals/table/src/visual.ts +18 -16
  45. package/.eslintrc.json +0 -313
  46. package/.gitattributes +0 -4
  47. package/.github/workflows/build.yml +0 -32
  48. package/.github/workflows/codeql-analysis.yml +0 -54
  49. package/.snyk +0 -4
  50. package/.vscode/launch.json +0 -74
  51. package/.vscode/settings.json +0 -3
package/Changelog.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  This page contains information about changes to the PowerBI Visual Tools (pbiviz).
4
4
 
5
+ ## 4.0.7
6
+ * StringResources (Localizations) are supported in Developer Mode.
7
+ * Update `powerbi-visuals-webpack-plugin` to 3.1.0
8
+ * Fixed vulnerabilities
9
+
10
+ ## 4.0.6
11
+ Update templates visuals to:
12
+ * Support new visuals-api version 5.1.0
13
+ * Replace `enumerateObjectInstances` by `getFormattingModel` API
14
+ * Import and use `powerbi-visuals-utils-formattingmodel`
15
+
5
16
  ## 4.0.5
6
17
  * Updated dependencies, fixed npm audit issues
7
18
  ## 4.0.3 - 4.0.4
@@ -78,7 +78,7 @@ VisualPackage.loadVisualPackage(cwd).then((visualPackage) => {
78
78
  ConsoleWriter.info('Starting server...');
79
79
  // webpack dev server serves bundle from disk instead memory
80
80
  if (program.drop) {
81
- webpackConfig.devServer.onBeforeSetupMiddleware = (devServer) => {
81
+ webpackConfig.devServer.setupMiddlewares = (middlewares, devServer) => {
82
82
  let setHeaders = (res) => {
83
83
  Object.getOwnPropertyNames(webpackConfig.devServer.headers)
84
84
  .forEach(property => res.header(property, webpackConfig.devServer.headers[property]));
@@ -99,6 +99,8 @@ VisualPackage.loadVisualPackage(cwd).then((visualPackage) => {
99
99
  readFile(path.join(webpackConfig.devServer.static.directory, asset), res);
100
100
  });
101
101
  });
102
+
103
+ return middlewares;
102
104
  };
103
105
  }
104
106
 
@@ -0,0 +1,28 @@
1
+ -----BEGIN PRIVATE KEY-----
2
+ MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDKYpom5Gvkxmwa
3
+ d6vvrjY1QazSlp9cuao3Ajml68yKoNg9C5L86VPKIRYqgHB/OBdkngQgEOCzdSgg
4
+ aqSVSATHrYYuhTatzHbxmqx1XYkFbPpedhkrjA4esyJGrsmsg+J4Px3E3F6QyfJz
5
+ yCA2xlpArFkLB/alRvwCISGkis5tX39BRdxMEFz2h9g7NjfcYZh4IaEJZMHqp9XP
6
+ 2KKLC+jJ8SrneCWhD0zXfsxZsWhfHx6t7FLo4DfJOiC7RXunXONxlE4rpor9MMcG
7
+ R2nogUOeHzcGX80Q42QRKPzjnJ/NzS/kHod1kPXmCh3HoGJR0IycvMZHU8owavpK
8
+ WYMmGljHAgMBAAECggEBAKjs8FoyItSLwkO9S6f9M4X0UXpc+pt85VSQ6OlTDiFP
9
+ 6+3YMVIktylpwIStPDkT6oKzWiIhtExWJ64XFVT9DfBVKEDANEmQ9l7nibdU4T/E
10
+ HJ6n2I5+knKRdrSkw/TZCDjyBbkBb3VO+q4lhq3xlfeRY6lPdlGyFDr6yIf8zByB
11
+ Mqpfbq1FTlema6diRYJdOuVfwAwLYfWcPtzKgGiWaxxw28JxdeiGYYWeSelZEayL
12
+ ZTi/Mkq3lYRVSmzs6bnPFuoYWxlQZiZKQVjHFgoEv2Q52Dw9srjmi07Gfh1USfZD
13
+ A29+7jJCrkWmV+UQEjG4ZDBecNQCsWDyi+SIiPCTNJECgYEA8S5A3Y1QV2QXA4E4
14
+ ixpDjKGIFVtfm9GtRipQ3G49cCu5stxUr4wFL7ZFABqgAAFKRfwAtcTQJjVgliqF
15
+ 2FHSdS4qgFtbye/GTEoHLhj7FQWHdd0lN95+RDy6Nsl6nCPvf3EyRLiTP5A3rmkK
16
+ +nX04rFMjsmBFZQM/CERiEf2i10CgYEA1tIZdceh81WsXzcQ+tzkbkXDXjEsH36I
17
+ G3L7JYVx/QSOkgBjQ/EYtJveQHWaXWrYjdWp2zmQFOQr/PzuqwF8Yztga3soVzL7
18
+ +rKgg50nxb40PSsvcxF2F7o3gmdIqgzZxzzXGYCzUWqR34yr5DRtWXpcDzudMshb
19
+ zHcKWR2i1nMCgYEAgccSzmTZI31PSOqCw48pZAYTlPJrGwyTwZrJkiOb2b0dmpom
20
+ 06Nzsv3QWUL6b6ZCEjCNLUIvgy/bvlI5XXKB3d4uroz6ckocmTaIcIyuptwnzQtn
21
+ mI2Xwh4vUYXO/S/1Es2VcBcl3OE8pRQO/UD1ufoPqRHS7QqShiVBKuUWTF0CgYAB
22
+ 80hd5GEZB3cYKjTSQj0kryd17HZdFtX/gcy763k8ddUhiDVegYra4OtkpGyxWm36
23
+ 46y2G9CuD+BCXL2B+fJ6KCjY8PZNzF2zSfnhGAUra22n/INixQ7QalVkrrFfMdys
24
+ TWYaiiuWmqQWZn2NBdjUTiMV1FG6C02iDpaedoFq9wKBgAM1195FTP/XDNzwyUg1
25
+ UjMKKRwrckoCtrDt9kkBjJeU8tTyhmgxRZT1FnAyiY9ZQwsIL2wZkbkf1vmH6D6C
26
+ nzcAb1NyLqXHY1BGOOnfnreJr5U5eocgf9UXESG4hrrXgx93AgXZxrGLAnkVWWk2
27
+ Im9LGWq/aiMpQaIRdmkC2VU1
28
+ -----END PRIVATE KEY-----
@@ -0,0 +1,19 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDCTCCAfGgAwIBAgIUXKpBGZWc/1u4QmAuAvXiCSE8iRMwDQYJKoZIhvcNAQEL
3
+ BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTIyMTEyMzExMTcwMloXDTIzMTEy
4
+ MzExMTcwMlowFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF
5
+ AAOCAQ8AMIIBCgKCAQEAymKaJuRr5MZsGner7642NUGs0pafXLmqNwI5pevMiqDY
6
+ PQuS/OlTyiEWKoBwfzgXZJ4EIBDgs3UoIGqklUgEx62GLoU2rcx28ZqsdV2JBWz6
7
+ XnYZK4wOHrMiRq7JrIPieD8dxNxekMnyc8ggNsZaQKxZCwf2pUb8AiEhpIrObV9/
8
+ QUXcTBBc9ofYOzY33GGYeCGhCWTB6qfVz9iiiwvoyfEq53gloQ9M137MWbFoXx8e
9
+ rexS6OA3yTogu0V7p1zjcZROK6aK/TDHBkdp6IFDnh83Bl/NEONkESj845yfzc0v
10
+ 5B6HdZD15godx6BiUdCMnLzGR1PKMGr6SlmDJhpYxwIDAQABo1MwUTAdBgNVHQ4E
11
+ FgQUk0TXTSBQFXOi8Mf+6WpBFvmQ4OkwHwYDVR0jBBgwFoAUk0TXTSBQFXOi8Mf+
12
+ 6WpBFvmQ4OkwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAcP1p
13
+ XCef/HfV45eab4yw23RYZC4YRqPjK85ZjHyE+OqlmwQcW77GLEDbWL/yU0B4o0w3
14
+ M5wNarn1C8mwKYnzSUOXv8awZB/Fx1V1Di+/UqDPHe9iVo5ClmSjfl2Hl0UJ5Tim
15
+ Yg/NJhyB3V7Ex4c8aJ7OOslW69Nm8F44BaJKvkjGpY5H0MIsVAccB2tbbm4bS9ql
16
+ KDumoOsDU/5ZjyaSHWACt2/xFYIGqURAwIva/+LaGyg+VbrhpCAloAihmivqG5v+
17
+ QZrNWI+fyBaRLJ3VCOyTX/S4/jaOSPDbnz1A1e+CXKnZDkIZq8R6d70+t7o7QWYW
18
+ jGUdoCIK33ZjtIWOjQ==
19
+ -----END CERTIFICATE-----
package/config.json CHANGED
@@ -1 +1,35 @@
1
- {"templates":{"visuals":"templates/visuals","pbiviz":"templates/pbiviz.json.template","plugin":"templates/plugin.ts.template","package":"templates/package.json.template"},"generate":{"apiVersion":"3.8.0"},"constants":{"minAPIversion":"3.2.0"},"build":{"precompileFolder":".tmp/precompile","dropFolder":".tmp/drop","js":"tmp.visual.js","css":"visual.css","stats":"../../webpack.statistics.html"},"package":{"dropFolder":"dist"},"server":{"root":"webRoot","assetsRoute":"/assets","privateKey":"certs/PowerBICustomVisualTest_private.key","certificate":"certs/PowerBICustomVisualTest_public.crt","pfx":"certs/PowerBICustomVisualTest_public.pfx","port":"8080","passphrase":"8130294030417626"},"visualTemplates":{"circlecard":"https://codeload.github.com/microsoft/powerbi-visuals-circlecard-react/zip/master"}}
1
+ {
2
+ "templates": {
3
+ "visuals": "templates/visuals",
4
+ "pbiviz": "templates/pbiviz.json.template",
5
+ "plugin": "templates/plugin.ts.template",
6
+ "package": "templates/package.json.template"
7
+ },
8
+ "generate": {
9
+ "apiVersion": "3.8.0"
10
+ },
11
+ "constants": {
12
+ "minAPIversion": "3.2.0"
13
+ },
14
+ "build": {
15
+ "precompileFolder": ".tmp/precompile",
16
+ "dropFolder": ".tmp/drop",
17
+ "js": "tmp.visual.js",
18
+ "css": "visual.css",
19
+ "stats": "../../webpack.statistics.html"
20
+ },
21
+ "package": {
22
+ "dropFolder": "dist"
23
+ },
24
+ "server": {
25
+ "root": "webRoot",
26
+ "assetsRoute": "/assets",
27
+ "privateKey": "certs/PowerBICustomVisualTest_private.key",
28
+ "certificate": "certs/PowerBICustomVisualTest_public.crt",
29
+ "pfx": "certs/PowerBICustomVisualTest_public.pfx",
30
+ "port": "8080"
31
+ },
32
+ "visualTemplates": {
33
+ "circlecard": "https://codeload.github.com/microsoft/powerbi-visuals-circlecard-react/zip/master"
34
+ }
35
+ }
@@ -122,101 +122,7 @@ function copyVisualTemplate(targetPath, templateName) {
122
122
  fs.copySync(path.join(VISUAL_TEMPLATES_PATH, '_global'), targetPath);
123
123
  fs.copySync(path.join(VISUAL_TEMPLATES_PATH, templateName), targetPath);
124
124
  }
125
- /**
126
- * Generate settings.ts
127
- *
128
- * @param {string} targetPath - file path to root of visual package
129
- * @param {string} verbose - to verbose output
130
- */
131
- function generateSettings(targetPath, verbose) {
132
- let capabilitiesFileName = targetPath + '/capabilities.json';
133
-
134
- fs.readJson(capabilitiesFileName, (err, packageObj) => {
135
- if (err) {
136
- console.error(err);
137
- return;
138
- }
139
- if (verbose) {
140
- console.log('parse capabilities.json. Searching for settings');
141
- console.log(packageObj.dataRoles[0].displayName);
142
- }
143
- let VisualSettingsMethods = 'export class VisualSettings extends DataViewObjectsParser {\n';
144
- if (packageObj.objects) {
145
- let subClassesDefinitionArray = [];
146
- for (let settingsSubClass in packageObj.objects) {
147
- if (verbose) {
148
- console.log('Settings sub class: ' + settingsSubClass);
149
- }
150
- let subClassProperties = packageObj.objects[settingsSubClass].properties;
151
- VisualSettingsMethods += ' public ' + settingsSubClass + ': ' +
152
- settingsSubClass + 'Settings = new ' + settingsSubClass + 'Settings();\n';
153
-
154
- let settingsSubClassDefinition = '\n export class ' + settingsSubClass + 'Settings {\n';
155
-
156
- if (subClassProperties) {
157
- for (let property in subClassProperties) {
158
- if (verbose) {
159
- console.log('property: ' + subClassProperties[property].displayName);
160
- }
161
- let propertyType = subClassProperties[property].type;
162
- if (verbose) {
163
- console.log('prop type: ' + propertyType);
164
- }
165
- // add some spaghetti to this meals
166
- settingsSubClassDefinition += ' // ' + subClassProperties[property].displayName +
167
- '\n public ' + property;
168
125
 
169
- if (verbose) {
170
- console.log(propertyType.keys);
171
- }
172
- if (propertyType.bool) {
173
- if (verbose) {
174
- console.log('bool');
175
- }
176
- settingsSubClassDefinition += ': boolean = true;\n';
177
- } else if (propertyType.fill) {
178
- if (verbose) {
179
- console.log('fill');
180
- }
181
- settingsSubClassDefinition += ': string = "";\n';
182
- } else if (propertyType.formatting) {
183
- if (verbose) {
184
- console.log('formatting');
185
- }
186
- if (propertyType.formatting.fontSize) {
187
- settingsSubClassDefinition += ': number = 12;\n';
188
- }
189
- }
190
- }
191
- }
192
- settingsSubClassDefinition += ' }\n';
193
- subClassesDefinitionArray.push(settingsSubClassDefinition);
194
- }
195
- VisualSettingsMethods += ' }\n';
196
- // Add properties class per each setting
197
- for (let subDefinitions in subClassesDefinitionArray) {
198
- VisualSettingsMethods += subClassesDefinitionArray[subDefinitions];
199
- }
200
- if (verbose) {
201
- console.log('final text: ' + VisualSettingsMethods);
202
- }
203
-
204
- } else {
205
- if (verbose) {
206
- console.log('Settings not found');
207
- }
208
- VisualSettingsMethods += '// TODO: fill all visual settings here\n ' +
209
- '// public dataPoint: DataPointSettings = new DataPointSettings();\n }\n' +
210
- '// TODO: fill all visual settings here\n// export class DataPointSettings ' +
211
- '{ \n // public fill: string = "#005c55";\n// }';
212
- }
213
- // read file and update
214
- let settingsFileName = targetPath + '/src/settings.ts';
215
- let setingsFileContents = fs.readFileSync(settingsFileName, 'utf8');
216
- setingsFileContents = setingsFileContents.replace('<%= visualSettingsClasses %>', VisualSettingsMethods);
217
- fs.writeFileSync(settingsFileName, setingsFileContents);
218
- });
219
- }
220
126
  /**
221
127
  * Checks if the specified template is valid
222
128
  *
@@ -273,7 +179,6 @@ class VisualGenerator {
273
179
  fs.removeSync(visualPath);
274
180
  }
275
181
  copyVisualTemplate(visualPath, buildOptions.template);
276
- generateSettings(visualPath);
277
182
  createPbiVizJson(visualPath, visualOptions, options.template);
278
183
  resolve(visualPath);
279
184
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerbi-visuals-tools",
3
- "version": "4.0.5",
3
+ "version": "4.0.7",
4
4
  "description": "Command line tool for creating and publishing visuals for Power BI",
5
5
  "main": "./lib/VisualPackage.js",
6
6
  "scripts": {
@@ -27,7 +27,7 @@
27
27
  "homepage": "https://github.com/Microsoft/PowerBI-visuals-tools#readme",
28
28
  "dependencies": {
29
29
  "assert": "^2.0.0",
30
- "async": "^3.2.3",
30
+ "async": "^3.2.4",
31
31
  "base64-inline-loader": "^2.0.1",
32
32
  "browserify-zlib": "^0.2.0",
33
33
  "buffer": "^6.0.3",
@@ -37,49 +37,52 @@
37
37
  "console-browserify": "^1.2.0",
38
38
  "constants-browserify": "^1.0.0",
39
39
  "crypto-browserify": "^3.12.0",
40
- "css-loader": "^5.2.7",
40
+ "css-loader": "^6.7.2",
41
41
  "domain-browser": "^4.22.0",
42
42
  "events": "^3.3.0",
43
43
  "extra-watch-webpack-plugin": "^1.0.3",
44
- "fs-extra": "^9.1.0",
44
+ "fs-extra": "^10.1.0",
45
45
  "https-browserify": "^1.0.0",
46
46
  "json-loader": "0.5.7",
47
47
  "jszip": "^3.7.1",
48
- "less": "^3.11.1",
49
- "less-loader": "^10.0.1",
48
+ "less": "^4.1.3",
49
+ "less-loader": "^11.1.0",
50
50
  "lodash.clonedeep": "4.5.0",
51
51
  "lodash.defaults": "4.2.0",
52
52
  "lodash.isequal": "4.5.0",
53
- "mini-css-extract-plugin": "^1.4.0",
53
+ "mini-css-extract-plugin": "^2.7.0",
54
54
  "os-browserify": "^0.3.0",
55
55
  "path-browserify": "^1.0.1",
56
- "powerbi-visuals-webpack-plugin": "^2.3.1",
56
+ "powerbi-visuals-webpack-plugin": "3.1.1",
57
57
  "process": "^0.11.10",
58
58
  "punycode": "^2.1.1",
59
59
  "querystring-es3": "^0.2.1",
60
- "readable-stream": "^3.6.0",
60
+ "readable-stream": "^4.2.0",
61
61
  "stream-browserify": "^3.0.0",
62
62
  "stream-http": "^3.2.0",
63
63
  "string_decoder": "^1.3.0",
64
64
  "timers-browserify": "^2.0.12",
65
- "ts-loader": "^9.2.5",
65
+ "ts-loader": "^9.4.1",
66
66
  "tty-browserify": "0.0.1",
67
67
  "typescript": "^4.4.3",
68
68
  "url": "^0.11.0",
69
- "util": "^0.12.3",
69
+ "util": "^0.12.5",
70
70
  "uuid": "7.0.2",
71
71
  "vm-browserify": "^1.1.2",
72
- "webpack": "^5.51.1",
73
- "webpack-bundle-analyzer": "4.4.2",
74
- "webpack-dev-server": "^4.8.1"
72
+ "webpack": "^5.75.0",
73
+ "webpack-bundle-analyzer": "4.7.0",
74
+ "webpack-dev-server": "^4.11.1"
75
75
  },
76
76
  "devDependencies": {
77
77
  "eslint": "^7.31.0",
78
- "jasmine": "3.5.0",
79
- "jasmine-spec-reporter": "5.0.1",
78
+ "jasmine": "4.5.0",
79
+ "jasmine-spec-reporter": "7.0.0",
80
80
  "semver": "7.1.3",
81
81
  "tree-kill": "1.2.2"
82
82
  },
83
+ "optionalDependencies": {
84
+ "fsevents": "*"
85
+ },
83
86
  "engines": {
84
87
  "node": ">=12.0.0"
85
88
  }
package/spec/.jshintrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "esversion": 6,
3
+ "node": true,
4
+ "jasmine": true
5
+ }
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Power BI Visual CLI
3
+ *
4
+ * Copyright (c) Microsoft Corporation
5
+ * All rights reserved.
6
+ * MIT License
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the ""Software""), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+
27
+ "use strict";
28
+
29
+ let FileSystem = require('./helpers/FileSystem.js');
30
+
31
+ FileSystem.deleteTempDirectory();
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Power BI Visual CLI
3
+ *
4
+ * Copyright (c) Microsoft Corporation
5
+ * All rights reserved.
6
+ * MIT License
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the ""Software""), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+
27
+ "use strict";
28
+
29
+ let fs = require('fs-extra');
30
+ let path = require('path');
31
+ console.log(__dirname);
32
+ let config = require('./../../config.json');
33
+
34
+ let CertificateTools = require('./../../lib/CertificateTools');
35
+
36
+ describe("E2E - pbiviz --install-cert", () => {
37
+ beforeEach((done) => {
38
+ CertificateTools.createCertFile(config, false).then(done);
39
+ });
40
+
41
+ describe("pbiviz", () => {
42
+ it("pbiviz --install-cert command should generate certificate", (done) => {
43
+ let certPath = path.join(__dirname, "../../", config.server.certificate);
44
+ let keyPath = path.join(__dirname, "../../", config.server.privateKey);
45
+ let pfxPath = path.join(__dirname, "../../", config.server.pfx);
46
+ let certExists = fs.existsSync(certPath);
47
+ let keyExists = fs.existsSync(keyPath);
48
+ let pfxExists = fs.existsSync(pfxPath);
49
+
50
+ let result = (certExists && keyExists) || pfxExists;
51
+
52
+ expect(result).toBeTruthy();
53
+ done();
54
+ });
55
+ });
56
+ });
@@ -0,0 +1,82 @@
1
+ /*
2
+ * Power BI Visual CLI
3
+ *
4
+ * Copyright (c) Microsoft Corporation
5
+ * All rights reserved.
6
+ * MIT License
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the ""Software""), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+
27
+ "use strict";
28
+
29
+ const fs = require('fs-extra');
30
+ const path = require('path');
31
+
32
+ const FileSystem = require('../helpers/FileSystem.js');
33
+
34
+ const tempPath = FileSystem.getTempPath();
35
+ const startPath = process.cwd();
36
+ const writeMetadata = require("./utils").writeMetadata;
37
+
38
+ describe("E2E - pbiviz info", () => {
39
+
40
+ const visualName = 'myuniquevisualnamegoeshere';
41
+ const visualPath = path.join(tempPath, visualName);
42
+
43
+ beforeEach(() => {
44
+ FileSystem.resetTempDirectory();
45
+ process.chdir(tempPath);
46
+ FileSystem.runPbiviz('new', visualName);
47
+ process.chdir(visualPath);
48
+
49
+ writeMetadata(visualPath);
50
+ });
51
+
52
+ afterEach(() => {
53
+ process.chdir(startPath);
54
+ });
55
+
56
+ afterAll(() => {
57
+ process.chdir(startPath);
58
+ FileSystem.deleteTempDirectory();
59
+ });
60
+
61
+ it("Should throw error if not in the visual root", () => {
62
+ let error;
63
+ process.chdir(tempPath);
64
+
65
+ try {
66
+ FileSystem.runPbiviz('info');
67
+ } catch (e) {
68
+ error = e;
69
+ }
70
+
71
+ expect(error).toBeDefined();
72
+ expect(error.status).toBe(1);
73
+ expect(error.message).toContain("Error: pbiviz.json not found. You must be in the root of a visual project to run this command");
74
+ });
75
+
76
+ it("Should output visual info", () => {
77
+ const output = FileSystem.runPbiviz('info').toString();
78
+ const visualConfig = fs.readJsonSync(path.join(visualPath, 'pbiviz.json')).visual;
79
+ expect(output).toContain(visualName);
80
+ expect(output).toContain(visualConfig.guid);
81
+ });
82
+ });