hass-taste-test 0.2.5 → 0.2.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.
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
  });
@@ -131,6 +135,7 @@ class HomeAssistant {
131
135
  /** Write configuration.yaml */
132
136
  async writeYAMLConfiguration(additionalConfig) {
133
137
  const config = [
138
+ 'default_config:',
134
139
  'frontend:',
135
140
  'http:',
136
141
  ` server_host: ${this.options.host}`,
@@ -249,7 +254,7 @@ class HomeAssistant {
249
254
  this.accessCode = login.auth_code;
250
255
  await this.launchWebsocket(this.accessCode);
251
256
  // Step through the onboarding pages
252
- await this.post('/api/onboarding/core_config', undefined, true);
257
+ await this.post('/api/onboarding/core_config', {}, true);
253
258
  await this.post('/api/onboarding/analytics', {}, true);
254
259
  const response = await this.post('/api/onboarding/integration', { redirect_uri: this.url + '/?auth_callback=1' }, true);
255
260
  this.accessCode = response.auth_code;
@@ -276,7 +281,7 @@ class HomeAssistant {
276
281
  'Content-Type': 'application/json',
277
282
  ...(authorize ? { Authorization: 'Bearer ' + this.accessToken } : undefined),
278
283
  },
279
- body: body ? JSON.stringify({ client_id: this.clientId, ...body }) : undefined,
284
+ body: JSON.stringify({ client_id: this.clientId, ...body }),
280
285
  });
281
286
  return (await response.json());
282
287
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hass-taste-test",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Integration testing for Home Assistant cards",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {