@xarc/app-dev 11.0.10 → 12.1.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.
@@ -10,6 +10,7 @@ import Path from "path";
10
10
  import assert from "assert";
11
11
  import requireAt from "require-at";
12
12
  import { makeOptionalRequire } from "optional-require";
13
+ import type { TaskRunner } from "@xarc/run";
13
14
  import xrun from "@xarc/run";
14
15
  import { getDevOptions } from "../config/archetype";
15
16
  import ck from "chalker";
@@ -18,7 +19,6 @@ import { psChildren } from "ps-get";
18
19
  import chokidar from "chokidar";
19
20
  import { spawn } from "child_process";
20
21
  import scanDir from "filter-scan-dir";
21
- import _ from "lodash";
22
22
  import xsh from "xsh";
23
23
  import { logger } from "./logger";
24
24
  import { createGitIgnoreDir } from "./utils";
@@ -26,7 +26,10 @@ import { jestTestDirectories } from "./tasks/constants";
26
26
  import { eslintTasks } from "./tasks/eslint";
27
27
  import { updateAppDep } from "./tasks/package-json";
28
28
 
29
- const { getWebpackStartConfig, setWebpackProfile } = require("@xarc/webpack/lib/util/custom-check");
29
+ const {
30
+ getWebpackStartConfig,
31
+ setWebpackProfile,
32
+ } = require("@xarc/webpack/lib/util/custom-check");
30
33
 
31
34
  const optionalRequire = makeOptionalRequire(require);
32
35
 
@@ -133,7 +136,10 @@ export const getDevTaskRunner = (cwd: string = process.cwd()) => {
133
136
  *
134
137
  * @returns The `@xarc/run` task runner instance that was used.
135
138
  */
136
- export function loadXarcDevTasks(userXrun?: any, userOptions: XarcOptions = {}) {
139
+ export function loadXarcDevTasks(
140
+ userXrun?: TaskRunner,
141
+ userOptions: XarcOptions = {}
142
+ ) {
137
143
  let xarcOptions = getDevOptions(userOptions);
138
144
  xarcCwd = xarcOptions.cwd;
139
145
 
@@ -153,8 +159,20 @@ export function loadXarcDevTasks(userXrun?: any, userOptions: XarcOptions = {})
153
159
  const mapIsomorphicCdn = require(`../scripts/map-isomorphic-cdn.js`);
154
160
 
155
161
  const config = xarcOptions.config;
156
- const karmaConfig = (file) => Path.join(config.karma, file);
157
- const mochaConfig = (file) => Path.join(config.mocha, file);
162
+ const karmaConfig = (filePath: string): string =>
163
+ Path.join(config.karma, filePath);
164
+ const makeConfigResolver =
165
+ (configDir: string) =>
166
+ (filePath: string): string => {
167
+ const rootConfig = Path.join(xarcCwd, filePath);
168
+ if (Fs.existsSync(rootConfig)) {
169
+ return rootConfig;
170
+ }
171
+ return Path.join(configDir, filePath);
172
+ };
173
+
174
+ const mochaConfig = makeConfigResolver(config.mocha);
175
+ const jestConfig = makeConfigResolver(config.jest);
158
176
 
159
177
  const shell = xsh.$;
160
178
  const exec = xsh.exec;
@@ -195,7 +213,9 @@ export function loadXarcDevTasks(userXrun?: any, userOptions: XarcOptions = {})
195
213
  } else if (child.kill && child.pid) {
196
214
  const ch = child;
197
215
  child = "restart";
198
- (await psChildren(ch.pid)).reverse().forEach((c) => process.kill(c.pid));
216
+ (await psChildren(ch.pid))
217
+ .reverse()
218
+ .forEach((c) => process.kill(c.pid));
199
219
  ch.kill();
200
220
  }
201
221
  }, 500);
@@ -210,7 +230,10 @@ export function loadXarcDevTasks(userXrun?: any, userOptions: XarcOptions = {})
210
230
  // and the app from APP_SERVER_PORT.
211
231
  // If the APP_SERVER_PORT is set to the empty string however,
212
232
  // leave it empty and therefore disable the dev proxy server.
213
- xrun.updateEnv({ APP_SERVER_PORT: "0", WEBPACK_DEV_PORT: "0" }, { override: false });
233
+ xrun.updateEnv(
234
+ { APP_SERVER_PORT: "0", WEBPACK_DEV_PORT: "0" },
235
+ { override: false }
236
+ );
214
237
 
215
238
  const eTmpDir = xarcOptions.eTmpDir;
216
239
 
@@ -238,7 +261,9 @@ export function loadXarcDevTasks(userXrun?: any, userOptions: XarcOptions = {})
238
261
  function generateServiceWorker() {
239
262
  const NODE_ENV = process.env.NODE_ENV;
240
263
  const serviceWorkerExists = Fs.existsSync("./service-worker.js");
241
- const serviceWorkerConfigExists = Fs.existsSync("config/sw-precache-config.json");
264
+ const serviceWorkerConfigExists = Fs.existsSync(
265
+ "config/sw-precache-config.json"
266
+ );
242
267
 
243
268
  /**
244
269
  * Determines whether the fetch event handler is included in the generated service worker code,
@@ -247,7 +272,8 @@ export function loadXarcDevTasks(userXrun?: any, userOptions: XarcOptions = {})
247
272
  * https://github.com/GoogleChrome/sw-precache#handlefetch-boolean
248
273
  *
249
274
  */
250
- const cacheRequestFetch = NODE_ENV !== "production" ? "--no-handle-fetch" : "";
275
+ const cacheRequestFetch =
276
+ NODE_ENV !== "production" ? "--no-handle-fetch" : "";
251
277
 
252
278
  if (serviceWorkerConfigExists) {
253
279
  // generate-service-worker
@@ -317,7 +343,11 @@ export function loadXarcDevTasks(userXrun?: any, userOptions: XarcOptions = {})
317
343
  logger.info(`Starting app server${x}`);
318
344
  logger.info("To terminate press Ctrl+C.");
319
345
  xarcOptions.AppMode.setEnv(xarcOptions.AppMode.lib.dir);
320
- return exec(`node`, argFlags, Path.join(xarcOptions.AppMode.lib.server, "index.js"));
346
+ return exec(
347
+ `node`,
348
+ argFlags,
349
+ Path.join(xarcOptions.AppMode.lib.server, "index.js")
350
+ );
321
351
  }
322
352
 
323
353
  /**
@@ -395,7 +425,11 @@ ie >= 11
395
425
  });
396
426
  };
397
427
 
398
- const makeBabelConfig = (destDir, _rcFile, resultFile = "babel.config.js") => {
428
+ const makeBabelConfig = (
429
+ destDir: string,
430
+ _rcFile: string,
431
+ resultFile: string = "babel.config.js"
432
+ ): void => {
399
433
  destDir = Path.resolve(xarcCwd, destDir);
400
434
 
401
435
  const files = [".babelrc.js", resultFile];
@@ -409,7 +443,9 @@ ie >= 11
409
443
 
410
444
  const newName = Path.join(destDir, resultFile);
411
445
 
412
- console.log(ck`<orange>Generating <cyan>${newName}</> for you - please commit it.</>`);
446
+ console.log(
447
+ ck`<orange>Generating <cyan>${newName}</> for you - please commit it.</>`
448
+ );
413
449
  Fs.writeFileSync(
414
450
  newName,
415
451
  // NOTE: do not change module.exports below, this is .js file for app
@@ -425,8 +461,17 @@ module.exports = {
425
461
  const AppMode = xarcOptions.AppMode;
426
462
 
427
463
  const babelCliIgnore = quote(
428
- [...jestTestDirectories.map((dir) => `**/${dir}`), `**/*.spec.js`, `**/*.spec.jsx`]
429
- .concat(xarcOptions.babel.enableTypeScript && [`**/*.test.ts`, `**/*.test.tsx`])
464
+ [
465
+ ...jestTestDirectories.map((dir) => `**/${dir}`),
466
+ `**/*.spec.js`,
467
+ `**/*.spec.jsx`,
468
+ ]
469
+ .concat(
470
+ xarcOptions.babel.enableTypeScript && [
471
+ `**/*.test.ts`,
472
+ `**/*.test.tsx`,
473
+ ]
474
+ )
430
475
  .concat(`**/.__dev_hmr`)
431
476
  .filter((x) => x)
432
477
  .join(",")
@@ -449,9 +494,14 @@ module.exports = {
449
494
 
450
495
  let tasks = {
451
496
  ".mk-prod-dir": () =>
452
- createGitIgnoreDir(Path.resolve(xarcCwd, xarcOptions.prodDir), "Electrode production dir"),
453
- ".mk-dist-dir": () => createGitIgnoreDir(Path.resolve(xarcCwd, "dist"), "Electrode dist dir"),
454
- ".mk-dll-dir": () => createGitIgnoreDir(Path.resolve(xarcCwd, "dll"), "Electrode dll dir"),
497
+ createGitIgnoreDir(
498
+ Path.resolve(xarcCwd, xarcOptions.prodDir),
499
+ "Electrode production dir"
500
+ ),
501
+ ".mk-dist-dir": () =>
502
+ createGitIgnoreDir(Path.resolve(xarcCwd, "dist"), "Electrode dist dir"),
503
+ ".mk-dll-dir": () =>
504
+ createGitIgnoreDir(Path.resolve(xarcCwd, "dll"), "Electrode dll dir"),
455
505
  ".production-env": () => {
456
506
  setProductionEnv();
457
507
  xarcOptions = getDevOptions(userOptions); // re-evaluate options
@@ -469,7 +519,12 @@ module.exports = {
469
519
  build: {
470
520
  dep: [".remove-log-files", ".production-env"],
471
521
  desc: `Build your app's ${AppMode.src.dir} directory into ${AppMode.lib.dir} for production`,
472
- task: [".build-lib", "build-dist", ".check.top.level.babelrc", "mv-to-dist"],
522
+ task: [
523
+ ".build-lib",
524
+ "build-dist",
525
+ ".check.top.level.babelrc",
526
+ "mv-to-dist",
527
+ ],
473
528
  },
474
529
 
475
530
  //
@@ -513,9 +568,14 @@ module.exports = {
513
568
  "build-dist:clean-tmp",
514
569
  ],
515
570
 
516
- ".copy-xarc-options-to-dist": () => shell.cp(Path.join(eTmpDir, "xarc-options.json"), "dist"),
571
+ ".copy-xarc-options-to-dist": () =>
572
+ shell.cp(Path.join(eTmpDir, "xarc-options.json"), "dist"),
517
573
 
518
- "mv-to-dist": ["mv-to-dist:clean", "mv-to-dist:mv-dirs", "mv-to-dist:keep-targets"],
574
+ "mv-to-dist": [
575
+ "mv-to-dist:clean",
576
+ "mv-to-dist:mv-dirs",
577
+ "mv-to-dist:keep-targets",
578
+ ],
519
579
  "build-dist-dev-static": {
520
580
  desc: false,
521
581
  task: function () {
@@ -607,7 +667,11 @@ module.exports = {
607
667
  } else if (file.endsWith(".map")) {
608
668
  shell.cp("-r", file, "dist/map");
609
669
  } else {
610
- shell.cp("-r", file, `dist/server/${dir.split("-")[1]}-${Path.basename(file)}`);
670
+ shell.cp(
671
+ "-r",
672
+ file,
673
+ `dist/server/${dir.split("-")[1]}-${Path.basename(file)}`
674
+ );
611
675
  }
612
676
  });
613
677
  });
@@ -620,7 +684,11 @@ module.exports = {
620
684
  task: () => {
621
685
  buildDistDirs.forEach((dir) => {
622
686
  // add `targets` field to `dist-X/isomorphic-assets.json`
623
- const isomorphicPath = Path.resolve(xarcCwd, dir, "isomorphic-assets.json");
687
+ const isomorphicPath = Path.resolve(
688
+ xarcCwd,
689
+ dir,
690
+ "isomorphic-assets.json"
691
+ );
624
692
  if (Fs.existsSync(isomorphicPath)) {
625
693
  Fs.readFile(
626
694
  isomorphicPath,
@@ -633,9 +701,13 @@ module.exports = {
633
701
  const { envTargets } = xarcOptions.babel;
634
702
  assetsJson.targets = envTargets[dir.split("-")[1]];
635
703
  // eslint-disable-next-line no-shadow
636
- Fs.writeFile(isomorphicPath, JSON.stringify(assetsJson, null, 2), (err) => {
637
- if (err) throw err;
638
- });
704
+ Fs.writeFile(
705
+ isomorphicPath,
706
+ JSON.stringify(assetsJson, null, 2),
707
+ (error) => {
708
+ if (error) throw error;
709
+ }
710
+ );
639
711
  }
640
712
  );
641
713
  }
@@ -686,7 +758,9 @@ module.exports = {
686
758
  grouping: true,
687
759
  filterDir: (x) => (x === `.__dev_hmr` && "dirs") || "otherDirs",
688
760
  filter: (x, p) =>
689
- x.indexOf(".spec.") > 0 || x.indexOf(".test.") > 0 || p === `.__dev_hmr`,
761
+ x.indexOf(".spec.") > 0 ||
762
+ x.indexOf(".test.") > 0 ||
763
+ p === `.__dev_hmr`,
690
764
  });
691
765
  scanned.files.forEach((f) => {
692
766
  try {
@@ -791,7 +865,13 @@ module.exports = {
791
865
  "check-cov": ["lint", "test-cov"],
792
866
  "check-dev": ["lint", "test-dev"],
793
867
 
794
- clean: [".clean.dist", ".clean.lib", ".clean.prod", ".clean.etmp", ".clean.dll"],
868
+ clean: [
869
+ ".clean.dist",
870
+ ".clean.lib",
871
+ ".clean.prod",
872
+ ".clean.etmp",
873
+ ".clean.dll",
874
+ ],
795
875
  ".clean.dist": () => shell.rm("-rf", "dist", ...buildDistDirs),
796
876
  ".clean.lib": () => undefined, // to be updated below for src mode
797
877
  ".clean.prod": () => shell.rm("-rf", xarcOptions.prodDir),
@@ -815,7 +895,9 @@ module.exports = {
815
895
  task(context) {
816
896
  userXrun.updateEnv({ NODE_ENV: "production" }, { override: false });
817
897
  if (process.env.APP_SERVER_PORT === "0") {
818
- console.log("mock-cloud need to explicitly set APP_SERVER_PORT, changing 0 to 3100");
898
+ process.stdout.write(
899
+ "mock-cloud need to explicitly set APP_SERVER_PORT, changing 0 to 3100\n"
900
+ );
819
901
  process.env.APP_SERVER_PORT = "3100";
820
902
  }
821
903
 
@@ -835,12 +917,18 @@ module.exports = {
835
917
  console.log("dist does not exist, running build task first.");
836
918
  return xrun2.serial(
837
919
  "build",
838
- () => console.log("build completed, starting mock prod mode with proxy"),
920
+ () =>
921
+ process.stdout.write(
922
+ "build completed, starting mock prod mode with proxy\n"
923
+ ),
839
924
  mockTask
840
925
  );
841
926
  }
842
927
 
843
- return xrun2.serial(() => console.log("dist exist, skipping build task"), mockTask);
928
+ return xrun2.serial(
929
+ () => process.stdout.write("dist exist, skipping build task\n"),
930
+ mockTask
931
+ );
844
932
  },
845
933
  },
846
934
 
@@ -859,7 +947,10 @@ You only need to run this if you are doing something not through the xarc tasks.
859
947
  dep: [".remove-log-files", ".development-env", ".build.babelrc"],
860
948
  task() {
861
949
  const args = this.args.join(" ");
862
- return [".webpack-dev", [`server-admin ${args}`, "generate-service-worker"]];
950
+ return [
951
+ ".webpack-dev",
952
+ [`server-admin ${args}`, "generate-service-worker"],
953
+ ];
863
954
  },
864
955
  },
865
956
 
@@ -913,13 +1004,15 @@ You only need to run this if you are doing something not through the xarc tasks.
913
1004
 
914
1005
  "server-prod": {
915
1006
  dep: [".production-env", ".static-files-env"],
916
- desc:
917
- "Start server in production mode with static files routes. Must run 'clap build' first.",
1007
+ desc: "Start server in production mode with static files routes. Must run 'clap build' first.",
918
1008
  task: () => startAppServer(),
919
1009
  },
920
1010
 
921
1011
  ".init-bundle.valid.log": () =>
922
- Fs.writeFileSync(Path.resolve(xarcCwd, eTmpDir, "bundle.valid.log"), `${Date.now()}`),
1012
+ Fs.writeFileSync(
1013
+ Path.resolve(xarcCwd, eTmpDir, "bundle.valid.log"),
1014
+ `${Date.now()}`
1015
+ ),
923
1016
 
924
1017
  "server-admin": {
925
1018
  desc: "Start development with admin server",
@@ -930,11 +1023,16 @@ You only need to run this if you are doing something not through the xarc tasks.
930
1023
  const exec = quote(Path.join(xarcOptions.devDir, "lib/babel-run"));
931
1024
  const isNodeArgs = (x) => x.startsWith("--inspect");
932
1025
  const nodeArgs = context.args.filter(isNodeArgs).join(" ");
933
- const otherArgs = context.args.filter((x) => !isNodeArgs(x)).join(" ");
1026
+ const otherArgs = context.args
1027
+ .filter((x) => !isNodeArgs(x))
1028
+ .join(" ");
934
1029
 
935
1030
  // get user specified port for admin
936
1031
  const userPort = getDevAdminPortFromEnv(xarcOptions.adminPort);
937
- const portArg = !otherArgs.includes("--port") && userPort ? `--port ${userPort}` : "";
1032
+ const portArg =
1033
+ !otherArgs.includes("--port") && userPort
1034
+ ? `--port ${userPort}`
1035
+ : "";
938
1036
 
939
1037
  return mkCmd(
940
1038
  `~(tty)$node`,
@@ -976,19 +1074,28 @@ You only need to run this if you are doing something not through the xarc tasks.
976
1074
  options: --debug --mock-cdn`,
977
1075
  task(context) {
978
1076
  const debug = context.argOpts.debug ? "--inspect-brk " : "";
979
- const proxySpawn = require.resolve("@xarc/app-dev/lib/dev-admin/redbird-spawn");
1077
+ const proxySpawn = require.resolve(
1078
+ "@xarc/app-dev/lib/dev-admin/redbird-spawn"
1079
+ );
980
1080
  return `~(tty)$node ${debug}${proxySpawn} ${context.args.join(" ")}`;
981
1081
  },
982
1082
  },
983
1083
 
984
- "test-server": xrun2.concurrent(["lint-server", "lint-server-test"], "test-server-cov"),
985
- "test-watch-all": xrun2.concurrent("server-admin.test", "test-frontend-dev-watch"),
1084
+ "test-server": xrun2.concurrent(
1085
+ ["lint-server", "lint-server-test"],
1086
+ "test-server-cov"
1087
+ ),
1088
+ "test-watch-all": xrun2.concurrent(
1089
+ "server-admin.test",
1090
+ "test-frontend-dev-watch"
1091
+ ),
986
1092
 
987
1093
  "test-ci": ["test-frontend-ci"],
988
1094
  "test-cov": [
989
1095
  "?.karma.test-frontend-cov",
990
1096
  "?.jest.test-frontend-cov",
991
- "test-server-cov",
1097
+ "?.mocha.test-frontend-cov",
1098
+ "?.test-server-cov",
992
1099
  ].filter((x) => x),
993
1100
  "test-dev": ["test-frontend-dev", "test-server-dev"],
994
1101
 
@@ -1019,21 +1126,24 @@ You only need to run this if you are doing something not through the xarc tasks.
1019
1126
  task: () => generateServiceWorker(),
1020
1127
  },
1021
1128
  pwa: {
1022
- desc:
1023
- "PWA must have dist by running `clap build` first and then start the app server only.",
1129
+ desc: "PWA must have dist by running `clap build` first and then start the app server only.",
1024
1130
  task: ["build", "server"],
1025
1131
  },
1026
1132
 
1027
1133
  "generate-browsers-listrc": {
1028
- desc:
1029
- "Generate .browserlistrc config file, it's used by Browserlist for AutoPrefixer/PostCSS",
1134
+ desc: "Generate .browserlistrc config file, it's used by Browserlist for AutoPrefixer/PostCSS",
1030
1135
  task: () => generateBrowsersListRc(),
1031
1136
  },
1032
1137
  };
1033
1138
 
1034
1139
  tasks = Object.assign(tasks, {
1035
1140
  ".clean.lib": () =>
1036
- shell.rm("-rf", AppMode.lib.client, AppMode.lib.server, AppMode.savedFile),
1141
+ shell.rm(
1142
+ "-rf",
1143
+ AppMode.lib.client,
1144
+ AppMode.lib.server,
1145
+ AppMode.savedFile
1146
+ ),
1037
1147
  ".build-lib:app-mode": () =>
1038
1148
  Fs.writeFileSync(
1039
1149
  Path.resolve(xarcCwd, AppMode.savedFile),
@@ -1046,7 +1156,9 @@ You only need to run this if you are doing something not through the xarc tasks.
1046
1156
  },
1047
1157
  });
1048
1158
 
1049
- if (Fs.existsSync(Path.resolve(xarcCwd, AppMode.src.client, "dll.config.js"))) {
1159
+ if (
1160
+ Fs.existsSync(Path.resolve(xarcCwd, AppMode.src.client, "dll.config.js"))
1161
+ ) {
1050
1162
  Object.assign(tasks, {
1051
1163
  "build-dist-dll": {
1052
1164
  dep: [".mk-dll-dir", ".production-env"],
@@ -1066,7 +1178,8 @@ You only need to run this if you are doing something not through the xarc tasks.
1066
1178
  Object.assign(tasks, eslintTasks(xarcOptions, xrun2));
1067
1179
 
1068
1180
  if (xarcOptions.options.karma) {
1069
- const noSingleRun = process.argv.indexOf("--no-single-run") >= 0 ? "--no-single-run" : "";
1181
+ const noSingleRun =
1182
+ process.argv.indexOf("--no-single-run") >= 0 ? "--no-single-run" : "";
1070
1183
 
1071
1184
  Object.assign(tasks, {
1072
1185
  ".karma.test-frontend": {
@@ -1154,7 +1267,8 @@ You only need to run this if you are doing something not through the xarc tasks.
1154
1267
  dir: Path.resolve(xarcCwd, AppMode.src.dir),
1155
1268
  grouping: true,
1156
1269
  includeDir: true,
1157
- filterDir: (d) => (jestTestDirectories.indexOf(d) >= 0 ? "dirs" : "otherDirs"),
1270
+ filterDir: (d) =>
1271
+ jestTestDirectories.indexOf(d) >= 0 ? "dirs" : "otherDirs",
1158
1272
  filterExt: [".js", ".jsx", ".ts", ".tsx"],
1159
1273
  filter: (x) => x.indexOf(".spec.") > 0 || x.indexOf(".test.") > 0,
1160
1274
  });
@@ -1171,15 +1285,18 @@ You only need to run this if you are doing something not through the xarc tasks.
1171
1285
  const jestBinJs = require.resolve("jest/bin/jest");
1172
1286
  logger.info("Running jest unit tests");
1173
1287
 
1174
- const brk = this.argv.indexOf("--inspect-brk") >= 0 ? "--inspect-brk" : "";
1175
- const jestOpts = this.argv.slice(1).filter((x) => x !== "--inspect-brk");
1288
+ const brk =
1289
+ this.argv.indexOf("--inspect-brk") >= 0 ? "--inspect-brk" : "";
1290
+ const jestOpts = this.argv
1291
+ .slice(1)
1292
+ .filter((x) => x !== "--inspect-brk");
1176
1293
 
1177
1294
  return mkCmd(
1178
1295
  `~(tty)$node`,
1179
1296
  brk,
1180
1297
  jestBinJs,
1181
1298
  jestOpts.join(" "),
1182
- `--config ${xarcOptions.config.jest}/jest.config.js`
1299
+ `--config ${quote(jestConfig("jest.config.js"))}`
1183
1300
  );
1184
1301
  } else {
1185
1302
  return undefined;
@@ -1197,13 +1314,33 @@ You only need to run this if you are doing something not through the xarc tasks.
1197
1314
 
1198
1315
  if (xarcOptions.options.mocha) {
1199
1316
  Object.assign(tasks, {
1317
+ mocha: {
1318
+ desc: "Run mocha tests (--inspect-brk to start debugger)",
1319
+ task() {
1320
+ return `.mocha.test-frontend-cov ${this.argv.slice(1).join(" ")}`;
1321
+ },
1322
+ },
1323
+ ".mocha.test-frontend-cov"() {
1324
+ const brk =
1325
+ this.argv.indexOf("--inspect-brk") >= 0 ? "--inspect-brk" : "";
1326
+ const mochaOpts = this.argv
1327
+ .slice(1)
1328
+ .filter((x) => x !== "--inspect-brk");
1329
+ return mkCmd(
1330
+ `~$nyc --all`,
1331
+ `--reporter=text --reporter=lcov node_modules/mocha/bin/_mocha --config`,
1332
+ quote(mochaConfig(".mocharc.js")),
1333
+ brk,
1334
+ mochaOpts.join(" ")
1335
+ );
1336
+ },
1200
1337
  "test-server-cov": () => {
1201
1338
  if (shell.test("-d", "test/server")) {
1202
1339
  AppMode.setEnv(AppMode.src.dir);
1203
1340
  return mkCmd(
1204
1341
  `~$nyc --all --cwd src/server`,
1205
- `--reporter=text --reporter=lcov node_modules/mocha/bin/_mocha --opts`,
1206
- quote(mochaConfig("mocha.opts")),
1342
+ `--reporter=text --reporter=lcov node_modules/mocha/bin/_mocha --config`,
1343
+ quote(mochaConfig(".mocharc.js")),
1207
1344
  `test/server`
1208
1345
  );
1209
1346
  }
@@ -1213,7 +1350,11 @@ You only need to run this if you are doing something not through the xarc tasks.
1213
1350
  "test-server-dev": () => {
1214
1351
  if (shell.test("-d", "test/server")) {
1215
1352
  AppMode.setEnv(AppMode.src.dir);
1216
- return mkCmd(`~$mocha -c --opts`, quote(mochaConfig("mocha.opts")), `test/server`);
1353
+ return mkCmd(
1354
+ `~$mocha -c --config`,
1355
+ quote(mochaConfig(".mocharc.js")),
1356
+ `test/server`
1357
+ );
1217
1358
  }
1218
1359
  return undefined;
1219
1360
  },
@@ -1,5 +0,0 @@
1
- --require @xarc/app-dev/config/mocha/setup.js
2
- --reporter spec
3
- --recursive
4
- --ui bdd
5
- --require @babel/register
@@ -1,5 +0,0 @@
1
- --require @xarc/app-dev/config/mocha/setup.js
2
- --reporter spec
3
- --recursive
4
- --ui bdd
5
- --require @babel/register