emailengine-app 2.74.2 → 2.76.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.
Files changed (51) hide show
  1. package/.github/workflows/test.yml +0 -10
  2. package/CHANGELOG.md +40 -0
  3. package/config/e2e.toml +1 -1
  4. package/data/google-crawlers.json +1 -1
  5. package/lib/account.js +94 -18
  6. package/lib/api-routes/message-routes.js +3 -1
  7. package/lib/api-routes/route-helpers.js +3 -0
  8. package/lib/api-routes/submit-routes.js +159 -52
  9. package/lib/consts.js +6 -0
  10. package/lib/db.js +4 -1
  11. package/lib/egress-filter.js +220 -0
  12. package/lib/email-client/base-client.js +169 -27
  13. package/lib/email-client/gmail/send-request.js +16 -1
  14. package/lib/email-client/gmail-client.js +91 -10
  15. package/lib/email-client/imap/mailbox.js +3 -9
  16. package/lib/email-client/imap-client.js +103 -1
  17. package/lib/email-client/message-builder.js +24 -7
  18. package/lib/email-client/notification-handler.js +11 -12
  19. package/lib/email-client/outlook/send-request.js +18 -1
  20. package/lib/email-client/outlook-client.js +81 -9
  21. package/lib/imapproxy/imap-core/README.md +69 -0
  22. package/lib/oauth/external-account-config.js +41 -1
  23. package/lib/oauth/external-account-signer.js +7 -2
  24. package/lib/oauth/verify-app.js +18 -3
  25. package/lib/queue-retention.js +56 -0
  26. package/lib/respawn-backoff.js +95 -0
  27. package/lib/schemas.js +9 -2
  28. package/lib/settings.js +4 -1
  29. package/lib/tools.js +20 -0
  30. package/lib/ui-routes/admin-config-routes.js +22 -18
  31. package/lib/utils/network.js +122 -3
  32. package/lib/web-safe-html.js +401 -0
  33. package/lib/webhook-request.js +40 -2
  34. package/lib/webhooks.js +2 -3
  35. package/package.json +17 -20
  36. package/playwright.config.js +1 -1
  37. package/sbom.json +1 -1
  38. package/server.js +45 -8
  39. package/static/js/ee-client.js +55 -6
  40. package/static/js/ui.js +13 -0
  41. package/static/licenses.html +332 -292
  42. package/translations/messages.pot +52 -52
  43. package/views/config/webhooks.hbs +2 -2
  44. package/views/partials/webhooks_editor_functions.hbs +1 -1
  45. package/workers/api.js +32 -17
  46. package/workers/documents.js +6 -0
  47. package/workers/export.js +8 -1
  48. package/workers/imap.js +17 -19
  49. package/workers/submit.js +10 -0
  50. package/workers/webhooks.js +23 -2
  51. package/Gruntfile.js +0 -58
@@ -1,7 +1,7 @@
1
1
  msgid ""
2
2
  msgstr ""
3
3
  "Content-Type: text/plain; charset=ascii\n"
4
- "POT-Creation-Date: 2026-07-26 05:20+0000\n"
4
+ "POT-Creation-Date: 2026-07-29 19:18+0000\n"
5
5
 
6
6
  #: views/error.hbs:6
7
7
  #: workers/api.js:3019
@@ -31,6 +31,30 @@ msgstr[1] ""
31
31
  msgid "Click <a href=\"%s\">here</a> to continue&mldr;"
32
32
  msgstr ""
33
33
 
34
+ #: views/oauth-scope-error.hbs:5
35
+ msgid "Insufficient Permissions"
36
+ msgstr ""
37
+
38
+ #: views/oauth-scope-error.hbs:10
39
+ msgid ""
40
+ "All requested permissions are required for this service to function "
41
+ "properly. Some required permissions were not granted during sign-in."
42
+ msgstr ""
43
+
44
+ #: views/oauth-scope-error.hbs:14
45
+ msgid "The following permissions were not granted:"
46
+ msgstr ""
47
+
48
+ #: views/oauth-scope-error.hbs:23
49
+ msgid ""
50
+ "Please try again and make sure all permission checkboxes are selected on "
51
+ "the Google consent screen."
52
+ msgstr ""
53
+
54
+ #: views/oauth-scope-error.hbs:28
55
+ msgid "Try Again"
56
+ msgstr ""
57
+
34
58
  #: views/unsubscribe.hbs:7
35
59
  #: views/unsubscribe.hbs:60
36
60
  #: views/unsubscribe.hbs:75
@@ -75,56 +99,6 @@ msgstr ""
75
99
  msgid "Email address"
76
100
  msgstr ""
77
101
 
78
- #: views/oauth-scope-error.hbs:5
79
- msgid "Insufficient Permissions"
80
- msgstr ""
81
-
82
- #: views/oauth-scope-error.hbs:10
83
- msgid ""
84
- "All requested permissions are required for this service to function "
85
- "properly. Some required permissions were not granted during sign-in."
86
- msgstr ""
87
-
88
- #: views/oauth-scope-error.hbs:14
89
- msgid "The following permissions were not granted:"
90
- msgstr ""
91
-
92
- #: views/oauth-scope-error.hbs:23
93
- msgid ""
94
- "Please try again and make sure all permission checkboxes are selected on "
95
- "the Google consent screen."
96
- msgstr ""
97
-
98
- #: views/oauth-scope-error.hbs:28
99
- msgid "Try Again"
100
- msgstr ""
101
-
102
- #: views/accounts/register/imap.hbs:13
103
- msgid "Your name"
104
- msgstr ""
105
-
106
- #: views/accounts/register/imap.hbs:19
107
- msgid "Enter your full name"
108
- msgstr ""
109
-
110
- #: views/accounts/register/imap.hbs:29
111
- msgid "Enter your email address"
112
- msgstr ""
113
-
114
- #: views/accounts/register/imap.hbs:33
115
- #: views/accounts/register/imap-server.hbs:39
116
- #: views/accounts/register/imap-server.hbs:146
117
- msgid "Password"
118
- msgstr ""
119
-
120
- #: views/accounts/register/imap.hbs:39
121
- msgid "Enter your account password"
122
- msgstr ""
123
-
124
- #: views/accounts/register/imap.hbs:45
125
- msgid "Continue"
126
- msgstr ""
127
-
128
102
  #: views/accounts/register/index.hbs:6
129
103
  msgid "Choose your email account provider"
130
104
  msgstr ""
@@ -142,6 +116,12 @@ msgstr ""
142
116
  msgid "Username"
143
117
  msgstr ""
144
118
 
119
+ #: views/accounts/register/imap-server.hbs:39
120
+ #: views/accounts/register/imap-server.hbs:146
121
+ #: views/accounts/register/imap.hbs:33
122
+ msgid "Password"
123
+ msgstr ""
124
+
145
125
  #: views/accounts/register/imap-server.hbs:51
146
126
  #: views/accounts/register/imap-server.hbs:158
147
127
  msgid "Important"
@@ -246,6 +226,26 @@ msgstr ""
246
226
  msgid "Request failed."
247
227
  msgstr ""
248
228
 
229
+ #: views/accounts/register/imap.hbs:13
230
+ msgid "Your name"
231
+ msgstr ""
232
+
233
+ #: views/accounts/register/imap.hbs:19
234
+ msgid "Enter your full name"
235
+ msgstr ""
236
+
237
+ #: views/accounts/register/imap.hbs:29
238
+ msgid "Enter your email address"
239
+ msgstr ""
240
+
241
+ #: views/accounts/register/imap.hbs:39
242
+ msgid "Enter your account password"
243
+ msgstr ""
244
+
245
+ #: views/accounts/register/imap.hbs:45
246
+ msgid "Continue"
247
+ msgstr ""
248
+
249
249
  #: lib/autodetect-imap-settings.js:90
250
250
  msgid ""
251
251
  "Microsoft has disabled password-based sign-ins (including app passwords) "
@@ -345,7 +345,7 @@ msgstr ""
345
345
  msgid "Temporary error, please try again"
346
346
  msgstr ""
347
347
 
348
- #: lib/ui-routes/admin-config-routes.js:171
348
+ #: lib/ui-routes/admin-config-routes.js:173
349
349
  msgid "Invalid API key for OpenAI"
350
350
  msgstr ""
351
351
 
@@ -171,7 +171,7 @@ class="mb-1"}}
171
171
  {{> ui/checkbox id="settingsNotifyWebSafeHtml" name="notifyWebSafeHtml"
172
172
  label="Sanitize HTML for web display" class="text-list" checked=values.notifyWebSafeHtml
173
173
  error=errors.notifyWebSafeHtml
174
- hint="Makes HTML safe for direct web page display. Converts plain text emails to HTML when needed."}}
174
+ hint="Makes HTML safe for direct web page display. Converts plain text emails to HTML when needed, and folds quoted thread history into a collapsed block."}}
175
175
  </div>
176
176
 
177
177
  <div>
@@ -285,7 +285,7 @@ class="mb-1"}}
285
285
  document.getElementById('test-payload-btn').addEventListener('click', e => {
286
286
  e.preventDefault()
287
287
  sendTestPayload().then(data => {
288
- showToast(data.error ? data.error : (data.success ? 'Test payload sent' : 'Failed to send payload'), data.success ? 'check-circle' : 'alert-triangle');
288
+ uiToastResult(data, 'Test payload sent', 'Failed to send payload');
289
289
  }).catch(err => {
290
290
  showToast('Request failed\n' + err.message, 'alert-triangle');
291
291
  })
@@ -20,7 +20,7 @@
20
20
  testSendBtn.addEventListener('click', e => {
21
21
  e.preventDefault();
22
22
  sendTestPayload().then(data => {
23
- showToast(data.error ? data.error : (data.success ? 'Test payload sent' : 'Failed to send payload'), data.success ? 'check-circle' : 'alert-triangle');
23
+ uiToastResult(data, 'Test payload sent', 'Failed to send payload');
24
24
  }).catch(err => {
25
25
  showToast('Request failed\n' + err.message, 'alert-triangle');
26
26
  })
package/workers/api.js CHANGED
@@ -30,6 +30,7 @@ const {
30
30
  runPrechecks,
31
31
  matcher,
32
32
  readEnvValue,
33
+ readEnvList,
33
34
  threadStats,
34
35
  hasEnvValue,
35
36
  getBoolean,
@@ -42,7 +43,7 @@ const {
42
43
  releaseFormNonce,
43
44
  setAdminSession
44
45
  } = require('../lib/tools');
45
- const { matchIp, detectAutomatedRequest } = require('../lib/utils/network');
46
+ const { matchIp, resolveClientIp, detectAutomatedRequest } = require('../lib/utils/network');
46
47
 
47
48
  const { initSentry } = require('../lib/sentry');
48
49
  initSentry('api');
@@ -201,12 +202,11 @@ const USE_REUSE_PORT = !!(workerData && workerData.reusePort);
201
202
  // that must execute exactly once across all API workers.
202
203
  const IS_PRIMARY_API_WORKER = WORKER_INDEX === 0;
203
204
 
204
- const ADMIN_ACCESS_ADDRESSES = hasEnvValue('EENGINE_ADMIN_ACCESS_ADDRESSES')
205
- ? readEnvValue('EENGINE_ADMIN_ACCESS_ADDRESSES')
206
- .split(',')
207
- .map(v => v.trim())
208
- .filter(v => v)
209
- : null;
205
+ const ADMIN_ACCESS_ADDRESSES = readEnvList('EENGINE_ADMIN_ACCESS_ADDRESSES');
206
+
207
+ // Peers allowed to set X-Forwarded-For. Unset means the header is honored from any peer whenever
208
+ // the API proxy setting is on, which is the historical behavior; see resolveClientIp().
209
+ const API_PROXY_ADDRESSES = readEnvList('EENGINE_API_PROXY_ADDRESSES');
210
210
 
211
211
  const IMAP_WORKER_COUNT = getWorkerCount(readEnvValue('EENGINE_WORKERS') || (config.workers && config.workers.imap)) || 4;
212
212
 
@@ -778,19 +778,19 @@ const init = async () => {
778
778
  // set default, will be overriden once active language is resolved
779
779
  request.app.gt = gt;
780
780
 
781
+ // Both settings are needed on every request and neither depends on the other, so they are
782
+ // read in a single HMGET rather than two serialized round trips
783
+ let { enableApiProxy, disableTokens } = await settings.getMulti('enableApiProxy', 'disableTokens');
784
+
781
785
  // check if client IP is resolved from X-Forwarded-For or not
782
- let enableApiProxy = (await settings.get('enableApiProxy')) || false;
783
- if (enableApiProxy) {
784
- // check for the IP address from the Forwarded-For header
785
- const xFF = request.headers['x-forwarded-for'];
786
- request.app.ip = xFF ? xFF.split(',')[0] : request.info.remoteAddress;
787
- } else {
788
- // use socket address
789
- request.app.ip = request.info.remoteAddress;
790
- }
786
+ request.app.ip = resolveClientIp({
787
+ remoteAddress: request.info.remoteAddress,
788
+ forwardedFor: request.headers['x-forwarded-for'],
789
+ enableApiProxy: enableApiProxy || false,
790
+ trustedProxies: API_PROXY_ADDRESSES
791
+ });
791
792
 
792
793
  // check if access tokens for api requests are required
793
- let disableTokens = await settings.get('disableTokens');
794
794
  if (disableTokens && !request.url.searchParams.get('access_token') && !request.headers.authorization) {
795
795
  // make sure that we have a access_token value set in query args
796
796
  let url = new URL(request.url.href);
@@ -3151,6 +3151,21 @@ Include your token in requests using one of these methods:
3151
3151
  });
3152
3152
  }
3153
3153
 
3154
+ // An IP allowlist is only as trustworthy as the address it matches against. If the deployment
3155
+ // takes the client address from X-Forwarded-For but does not say which peers may set it, any
3156
+ // client that can reach this port can present whatever address the allowlist expects.
3157
+ // Length-checked, not just null-checked: readEnvList returns [] for a variable that is present
3158
+ // but empty (an unset shell interpolation, an empty secret), which is truthy. resolveClientIp
3159
+ // treats that as no proxies configured, so the warning has to agree or it goes quiet in
3160
+ // exactly the deployment it exists to warn.
3161
+ if (ADMIN_ACCESS_ADDRESSES && ADMIN_ACCESS_ADDRESSES.length && !API_PROXY_ADDRESSES?.length && (await settings.get('enableApiProxy'))) {
3162
+ logger.warn({
3163
+ msg: 'Admin IP allowlist is spoofable because X-Forwarded-For is trusted from any peer. Set EENGINE_API_PROXY_ADDRESSES to the addresses of your proxies, or disable the API proxy setting.',
3164
+ component: 'api',
3165
+ allowedAddresses: ADMIN_ACCESS_ADDRESSES
3166
+ });
3167
+ }
3168
+
3154
3169
  // trigger a request to cache swagger.json
3155
3170
  setImmediate(() => {
3156
3171
  server
@@ -92,6 +92,12 @@ async function onCommand(command) {
92
92
  switch (command.cmd) {
93
93
  case 'resource-usage':
94
94
  return threadStats.usage();
95
+
96
+ // Shutdown drain, forwarded by server.js because signals only reach the main thread
97
+ case 'close':
98
+ await documentsWorker.close();
99
+ return true;
100
+
95
101
  default:
96
102
  logger.debug({ msg: 'Unhandled command', command });
97
103
  return 999;
package/workers/export.js CHANGED
@@ -853,10 +853,17 @@ exportWorker.on('failed', async (job, err) => {
853
853
  });
854
854
  });
855
855
 
856
- function onCommand(command) {
856
+ async function onCommand(command) {
857
857
  if (command.cmd === 'resource-usage') {
858
858
  return threadStats.usage();
859
859
  }
860
+
861
+ // Shutdown drain, forwarded by server.js because signals only reach the main thread
862
+ if (command.cmd === 'close') {
863
+ await exportWorker.close();
864
+ return true;
865
+ }
866
+
860
867
  logger.debug({ msg: 'Unhandled command', command });
861
868
  return 999;
862
869
  }
package/workers/imap.js CHANGED
@@ -826,20 +826,21 @@ class ConnectionHandler {
826
826
  };
827
827
  }
828
828
 
829
- async kill() {
830
- if (this.killed) {
829
+ // Shutdown teardown: closes every account connection this worker owns. The main thread owns
830
+ // the worker's lifetime and terminates it once the drain returns, so this deliberately does
831
+ // not exit the process itself.
832
+ async closeConnections() {
833
+ if (this.connectionsClosed) {
831
834
  return;
832
835
  }
833
- logger.error({ msg: 'Terminating process' });
834
- this.killed = true;
836
+ logger.info({ msg: 'Closing account connections', accounts: this.accounts.size });
837
+ this.connectionsClosed = true;
835
838
 
836
839
  this.accounts.forEach(accountObject => {
837
840
  if (accountObject && accountObject.connection) {
838
841
  accountObject.connection.close();
839
842
  }
840
843
  });
841
-
842
- logger.flush(() => process.exit());
843
844
  }
844
845
 
845
846
  // some general message
@@ -882,6 +883,13 @@ class ConnectionHandler {
882
883
  case 'resource-usage':
883
884
  return threadStats.usage();
884
885
 
886
+ // Shutdown drain. Signals reach the main thread only, so this worker cannot notice
887
+ // SIGTERM itself; server.js forwards it here on the way down so accounts get a chance
888
+ // to close their connections cleanly instead of having the sockets cut.
889
+ case 'close':
890
+ await this.closeConnections();
891
+ return true;
892
+
885
893
  case 'delete':
886
894
  case 'update':
887
895
  case 'sync':
@@ -1031,19 +1039,9 @@ parentPort.on('message', message => {
1031
1039
  connectionHandler.onMessage(message).catch(err => logger.error({ msg: 'Failed to process IPC message', err }));
1032
1040
  });
1033
1041
 
1034
- process.on('SIGTERM', () => {
1035
- connectionHandler.kill().catch(err => {
1036
- logger.error({ msg: 'Execution failed', err });
1037
- logger.flush(() => process.exit(4));
1038
- });
1039
- });
1040
-
1041
- process.on('SIGINT', () => {
1042
- connectionHandler.kill().catch(err => {
1043
- logger.error({ msg: 'Execution failed', err });
1044
- logger.flush(() => process.exit(5));
1045
- });
1046
- });
1042
+ // NB! No SIGTERM/SIGINT handlers here. Node delivers signals to the main thread only, so handlers
1043
+ // registered in a worker thread never run. Shutdown reaches this worker as a 'close' command from
1044
+ // server.js instead; see onCommand().
1047
1045
 
1048
1046
  main().catch(err => {
1049
1047
  logger.fatal({ msg: 'Execution failed', err });
package/workers/submit.js CHANGED
@@ -421,6 +421,16 @@ async function onCommand(command) {
421
421
  switch (command.cmd) {
422
422
  case 'resource-usage':
423
423
  return threadStats.usage();
424
+
425
+ // Shutdown drain. Signals reach the main thread only, so server.js forwards them here.
426
+ // This matters more than for the other queues: the `iaq:` entry is cleared in the
427
+ // 'completed' handler, so a thread terminated mid-delivery leaves the job to be recovered
428
+ // as stalled and re-run - re-sending a message the MTA had already accepted. A graceful
429
+ // close stops fetching new jobs immediately and waits for the in-flight one.
430
+ case 'close':
431
+ await submitWorker.close();
432
+ return true;
433
+
424
434
  default:
425
435
  logger.debug({ msg: 'Unhandled command', command });
426
436
  return 999;
@@ -12,12 +12,13 @@ const { GooglePubSub } = require('../lib/oauth/pubsub/google');
12
12
 
13
13
  const { readEnvValue, threadStats, getDuration, httpAgent, getServiceSecret, maybeReloadHttpProxyAgent } = require('../lib/tools');
14
14
  const { sendWebhookRequest } = require('../lib/webhook-request');
15
+ const { assertAllowedUrl, normalizePolicy, POLICY_OFF } = require('../lib/egress-filter');
15
16
 
16
17
  const { initSentry } = require('../lib/sentry');
17
18
  initSentry('webhooks');
18
19
 
19
20
  const { redis, queueConf } = require('../lib/db');
20
- const { Worker } = require('bullmq');
21
+ const { Worker, UnrecoverableError } = require('bullmq');
21
22
  const settings = require('../lib/settings');
22
23
 
23
24
  const { REDIS_PREFIX, ACCOUNT_DELETED_NOTIFY, MESSAGE_NEW_NOTIFY } = require('../lib/consts');
@@ -39,6 +40,17 @@ const NOTIFY_QC = (readEnvValue('EENGINE_NOTIFY_QC') && Number(readEnvValue('EEN
39
40
  // DEFAULT_WEBHOOK_REQUEST_TIMEOUT baked into sendWebhookRequest when unset
40
41
  const WEBHOOK_TIMEOUT = getDuration(readEnvValue('EENGINE_WEBHOOK_TIMEOUT')) || false;
41
42
 
43
+ // Which destinations webhook deliveries may reach. An account-scoped API token can set both the
44
+ // webhook URL and its custom headers, so without this the least-privileged credential in the
45
+ // system can aim EmailEngine at anything its host can route to. Defaults to blocking the
46
+ // link-local range (cloud instance metadata); `private` also blocks RFC1918 and friends, `off`
47
+ // disables the check and restores redirect following. See lib/egress-filter.js
48
+ const WEBHOOK_EGRESS_POLICY = normalizePolicy(readEnvValue('EENGINE_WEBHOOK_EGRESS_POLICY'));
49
+
50
+ // Built once rather than per delivery. Null when the policy is off, which also restores fetch's
51
+ // own redirect following in sendWebhookRequest().
52
+ const validateWebhookTarget = WEBHOOK_EGRESS_POLICY === POLICY_OFF ? null : target => assertAllowedUrl(target, { policy: WEBHOOK_EGRESS_POLICY });
53
+
42
54
  let callQueue = new Map();
43
55
  let mids = 0;
44
56
 
@@ -413,7 +425,8 @@ const notifyWorker = new Worker(
413
425
  body,
414
426
  headers,
415
427
  dispatcher: httpAgent.retry,
416
- timeout: WEBHOOK_TIMEOUT
428
+ timeout: WEBHOOK_TIMEOUT,
429
+ validateTarget: validateWebhookTarget
417
430
  });
418
431
  duration = Date.now() - start;
419
432
  } catch (err) {
@@ -514,6 +527,14 @@ const notifyWorker = new Worker(
514
527
  status: 'fail'
515
528
  });
516
529
 
530
+ // Neither of these changes on a retry: the egress policy rejects the same destination
531
+ // every time, and an endpoint configured to redirect keeps redirecting. Spending the
532
+ // remaining attempts on them only delays the operator seeing the real reason in the
533
+ // error flag. Fail the job now and keep the message.
534
+ if (err.code === 'EEGRESSBLOCKED' || err.code === 'EREDIRECTNOTFOLLOWED') {
535
+ throw new UnrecoverableError(err.message);
536
+ }
537
+
517
538
  throw err;
518
539
  } finally {
519
540
  if (duration) {
package/Gruntfile.js DELETED
@@ -1,58 +0,0 @@
1
- 'use strict';
2
-
3
- const config = require('@zone-eu/wild-config');
4
-
5
- module.exports = function (grunt) {
6
- // Project configuration.
7
- grunt.initConfig({
8
- shell: {
9
- eslint: {
10
- // Globs are quoted so eslint expands them itself - unquoted, sh (no globstar)
11
- // expands lib/**/*.js to depth-2 files only and skips most of lib/
12
- command: "npx eslint 'lib/**/*.js' 'workers/**/*.js' server.js Gruntfile.js"
13
- },
14
- server: {
15
- // Short Gmail fallback-poll interval so gmail-polling-test can exercise the poller
16
- // quickly. Harmless for push-based Gmail accounts in api-test: notifications keep
17
- // resetting the timer, and a stray fallback sync is coalesced/idempotent.
18
- command: 'EENGINE_GMAIL_FALLBACK_POLL_INTERVAL=15000 node server.js',
19
- options: {
20
- async: true
21
- }
22
- },
23
- flush: {
24
- command: `redis-cli -u "${config.dbs.redis}" flushdb`
25
- },
26
- waitServer: {
27
- // Polls /health until the server reports ready (all IMAP workers up,
28
- // Redis responding) instead of sleeping for a fixed delay
29
- command: 'node test/helpers/wait-for-server.js'
30
- },
31
- testUnit: {
32
- // Self-contained tests - need Redis but not the live server.
33
- // Run with default --test concurrency; the suite is verified to pass in parallel.
34
- // The *-test.js pattern keeps helper modules out of the test runner
35
- command: 'node --test --test-timeout=180000 test/*-test.js'
36
- },
37
- testIntegration: {
38
- // Tests that run against the live server started by shell:server
39
- command: 'node --test --test-concurrency=1 --test-timeout=180000 test/integration/*-test.js'
40
- },
41
- options: {
42
- stdout: data => console.log(data.toString().trim()),
43
- stderr: data => console.log(data.toString().trim()),
44
- failOnError: true
45
- }
46
- }
47
- });
48
-
49
- // Load the plugin(s)
50
- grunt.loadNpmTasks('grunt-shell-spawn');
51
-
52
- // Tasks
53
- grunt.registerTask('test-unit', ['shell:flush', 'shell:testUnit']);
54
- grunt.registerTask('test-integration', ['shell:flush', 'shell:server', 'shell:waitServer', 'shell:testIntegration', 'shell:server:kill']);
55
- grunt.registerTask('test', ['test-unit', 'test-integration']);
56
-
57
- grunt.registerTask('default', ['shell:eslint', 'test']);
58
- };