hass-taste-test 0.2.4 → 0.2.6

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/lib/bin.js CHANGED
File without changes
package/lib/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export declare class HomeAssistant<E> {
26
26
  private options;
27
27
  private dashboards;
28
28
  private entities;
29
+ private started;
29
30
  ws: hass.Connection;
30
31
  private constructor();
31
32
  private path_confFile;
package/lib/index.js CHANGED
@@ -57,6 +57,7 @@ class HomeAssistant {
57
57
  options;
58
58
  dashboards = 0;
59
59
  entities = {};
60
+ started = false;
60
61
  ws;
61
62
  constructor(options) {
62
63
  this.venvDir = (0, path_1.join)((0, os_1.tmpdir)(), 'hasstest-venv');
@@ -109,8 +110,11 @@ class HomeAssistant {
109
110
  await fs.writeFile(this.path_cache(), JSON.stringify(this.cache));
110
111
  await releaseLock();
111
112
  // Step 3: Start Home Assistant and onboard
112
- this.process = (0, child_process_1.spawn)(this.path_hass(), ['-c', this.configDir, '-v', ...this.options.hassArgs], {
113
- stdio: 'inherit',
113
+ this.process = (0, child_process_1.spawn)(this.path_hass(), ['-c', this.configDir, '-v', ...this.options.hassArgs], { stdio: 'pipe' });
114
+ this.process.stderr.on('data', (d) => {
115
+ if (d.includes('Starting Home Assistant'))
116
+ this.started = true;
117
+ process.stderr.write(d);
114
118
  });
115
119
  this.process.on('error', (e) => {
116
120
  console.error(`----\nHome Assistant is having trouble starting. This is likely due to a problem with your virtual environment; try removing the venv folder at ${this.venvDir} and re-running hass-taste-test\n---`);
@@ -122,7 +126,7 @@ class HomeAssistant {
122
126
  if (code != 0)
123
127
  reject(new Error(`Home Assistant exited with code ${code}`));
124
128
  });
125
- while (!(await this.isUp()))
129
+ while (!this.started || !(await this.isUp()))
126
130
  await sleep();
127
131
  resolve();
128
132
  });
@@ -186,7 +190,7 @@ class HomeAssistant {
186
190
  const installed = await this.hassVersion();
187
191
  if (!installed || installed !== this.cache.latestHass) {
188
192
  await exec(this.path_pip(), ['install', '--upgrade', 'wheel']);
189
- await exec(this.path_pip(), ['install', '--upgrade', 'mutagen', 'homeassistant']);
193
+ await exec(this.path_pip(), ['install', '--upgrade', 'homeassistant']);
190
194
  }
191
195
  }
192
196
  async readCache() {
@@ -249,7 +253,7 @@ class HomeAssistant {
249
253
  this.accessCode = login.auth_code;
250
254
  await this.launchWebsocket(this.accessCode);
251
255
  // Step through the onboarding pages
252
- await this.post('/api/onboarding/core_config', {}, true);
256
+ await this.post('/api/onboarding/core_config', undefined, true);
253
257
  await this.post('/api/onboarding/analytics', {}, true);
254
258
  const response = await this.post('/api/onboarding/integration', { redirect_uri: this.url + '/?auth_callback=1' }, true);
255
259
  this.accessCode = response.auth_code;
@@ -276,7 +280,7 @@ class HomeAssistant {
276
280
  'Content-Type': 'application/json',
277
281
  ...(authorize ? { Authorization: 'Bearer ' + this.accessToken } : undefined),
278
282
  },
279
- body: JSON.stringify({ client_id: this.clientId, ...body }),
283
+ body: body ? JSON.stringify({ client_id: this.clientId, ...body }) : undefined,
280
284
  });
281
285
  return (await response.json());
282
286
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hass-taste-test",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Integration testing for Home Assistant cards",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {