@rophy123/helmtest 2.1.2 → 2.1.4

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 CHANGED
@@ -80,9 +80,10 @@ helmtest currently only expose one method: `helmtest.renderTemplate(options)`.
80
80
  | releaseName | Release name, the `NAME` arg in helm CLI: `helm template [NAME] [CHART] [flags]`. | `'release-name'` |
81
81
  | values | Map of chart values to set. | `{}` |
82
82
  | valuesFiles | Paths to additional values.yaml. | `[]` |
83
+ | templateFiles | Render only listed template files, e.g. `['templates/hpa.yaml']` | `[]` |
83
84
  | extraHelmArgs | Extra args to pass to helm CLI, e.g. `--timeout=5s` | `[]` |
84
85
  | helmBinary | Path to helm binary. | `process.env.HELM_BINARY \|\| 'helm'` |
85
86
  | loadYaml | if `false`, will return rendered template as raw string instead of js object. | `true` |
86
87
  | kubeconformEnabled | if `true`, will pass rendered template to kubeconform CLI to validate schema. | `process.env.KUBECONFORM_ENABLED \|\| false` |
87
88
  | kubeconformBinary | Path to kubeconform binary. | `process.env.KUBECONFORM_BINARY \|\| 'kubeconform'` |
88
- | kubeconformArgs | Args to pass to kubeconform CLI. Will append `process.env.KUBECONFORM_EXTRA_ARGS`. | `['-strict','-ignore-missing-schemas','-summary']` |
89
+ | kubeconformArgs | Args to pass to kubeconform CLI. Will append `process.env.KUBECONFORM_EXTRA_ARGS`. | `['-strict','-summary']` |
package/lib/helmtest.js CHANGED
@@ -21,9 +21,10 @@ async function renderTemplate(options = {}) {
21
21
  options.templateFiles = options.templateFiles || [];
22
22
  options.extraHelmArgs = options.extraHelmArgs || [];
23
23
  options.helmBinary = options.helmBinary || process.env.HELM_BINARY || 'helm';
24
- options.loadYaml = options.loadYaml || true;
25
- options.kubeconformEnabled = options.kubeconformEnabled ||
26
- process.env.KUBECONFORM_ENABLED || false;
24
+ if (options.loadYaml === undefined) options.loadYaml = true;
25
+ if (options.kubeconformEnabled === undefined) {
26
+ options.kubeconformEnabled = process.env.KUBECONFORM_ENABLED || false;
27
+ }
27
28
  options.kubeconformBinary = options.kubeconformBinary ||
28
29
  process.env.KUBECONFORM_BINARY || 'kubeconform';
29
30
  options.kubeconformArgs = options.kubeconformArgs ||
@@ -67,7 +68,7 @@ async function renderTemplate(options = {}) {
67
68
  options.templateFiles.split(',') :
68
69
  options.templateFiles;
69
70
  templateFiles.forEach((templateFile) => {
70
- const filePath = path.join(chartDir, templateFile);
71
+ const filePath = path.join(options.chartDir, templateFile);
71
72
  fs.statSync(filePath);
72
73
  // Note: get the abs template file path to chek it actually exists,
73
74
  // `helm template` command expects relative path from chartDir.
@@ -103,7 +104,7 @@ async function renderTemplate(options = {}) {
103
104
  if (options.loadYaml) {
104
105
  return yaml.loadAll(helmOutput.stdout);
105
106
  } else {
106
- return helmOutput;
107
+ return helmOutput.stdout;
107
108
  }
108
109
  }
109
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rophy123/helmtest",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Write unit tests against your helm charts using JavaScript.",
5
5
  "main": "index.js",
6
6
  "bin": {