@ryanatkn/gro 0.162.1 → 0.162.2

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/dist/package.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // generated by src/lib/package.gen.ts
2
2
  export const package_json = {
3
3
  name: '@ryanatkn/gro',
4
- version: '0.162.1',
4
+ version: '0.162.2',
5
5
  description: 'task runner and toolkit extending SvelteKit',
6
6
  motto: 'generate, run, optimize',
7
7
  glyph: '🌰',
@@ -266,7 +266,7 @@ export const package_json = {
266
266
  };
267
267
  export const src_json = {
268
268
  name: '@ryanatkn/gro',
269
- version: '0.162.1',
269
+ version: '0.162.2',
270
270
  modules: {
271
271
  '.': {
272
272
  path: 'index.ts',
@@ -3,6 +3,7 @@ import { type Task } from './task.ts';
3
3
  export declare const Args: z.ZodObject<{
4
4
  _: z.ZodDefault<z.ZodArray<z.ZodString>>;
5
5
  dir: z.ZodDefault<z.ZodString>;
6
+ fail_without_tests: z.ZodDefault<z.ZodBoolean>;
6
7
  t: z.ZodOptional<z.ZodString>;
7
8
  }, z.core.$strict>;
8
9
  export type Args = z.infer<typeof Args>;
@@ -1 +1 @@
1
- {"version":3,"file":"test.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/test.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAOhD,eAAO,MAAM,IAAI;;;;kBAOf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA4B3B,CAAC"}
1
+ {"version":3,"file":"test.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/test.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAOhD,eAAO,MAAM,IAAI;;;;;kBAWf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA+B3B,CAAC"}
package/dist/test.task.js CHANGED
@@ -7,8 +7,12 @@ import { serialize_args, to_forwarded_args } from "./args.js";
7
7
  import { VITEST_CLI } from "./constants.js";
8
8
  import { paths } from "./paths.js";
9
9
  export const Args = z.strictObject({
10
- _: z.array(z.string()).meta({ description: 'file patterns to test' }).default(['.test.']),
10
+ _: z.array(z.string()).meta({ description: 'file patterns to filter tests' }).default(['.test.']),
11
11
  dir: z.string().meta({ description: 'working directory for tests' }).default(paths.source),
12
+ fail_without_tests: z
13
+ .boolean()
14
+ .meta({ description: 'opt out of `passWithNoTests`' })
15
+ .default(false),
12
16
  t: z
13
17
  .string()
14
18
  .meta({ description: 'search pattern for test names, same as vitest -t and --testNamePattern' })
@@ -18,26 +22,27 @@ export const task = {
18
22
  summary: 'run tests with vitest',
19
23
  Args,
20
24
  run: async ({ args }) => {
21
- const { _: patterns, dir, t } = args;
22
- if (has_dep(VITEST_CLI)) {
23
- if (!find_cli(VITEST_CLI)) {
24
- throw new Task_Error('vitest is a dependency but not installed; run `npm i`?');
25
- }
26
- const vitest_args = ['run', ...patterns];
27
- if (dir) {
28
- vitest_args.push('--dir', dir);
29
- }
30
- if (t) {
31
- vitest_args.push('-t', t);
32
- }
33
- vitest_args.push(...serialize_args(to_forwarded_args(VITEST_CLI)));
34
- const spawned = await spawn_cli(VITEST_CLI, vitest_args); // TODO proper forwarding
35
- if (!spawned?.ok) {
36
- throw new Task_Error(`vitest failed with exit code ${spawned?.code}`);
37
- }
38
- }
39
- else {
25
+ const { _: patterns, dir, fail_without_tests, t } = args;
26
+ if (!has_dep(VITEST_CLI)) {
40
27
  throw new Task_Error('no test runner found, install vitest');
41
28
  }
29
+ if (!find_cli(VITEST_CLI)) {
30
+ throw new Task_Error('vitest is a dependency but not installed; run `npm i`?');
31
+ }
32
+ const vitest_args = ['run', ...patterns];
33
+ if (dir) {
34
+ vitest_args.push('--dir', dir);
35
+ }
36
+ if (!fail_without_tests) {
37
+ vitest_args.push('--passWithNoTests');
38
+ }
39
+ if (t) {
40
+ vitest_args.push('-t', t);
41
+ }
42
+ vitest_args.push(...serialize_args(to_forwarded_args(VITEST_CLI)));
43
+ const spawned = await spawn_cli(VITEST_CLI, vitest_args);
44
+ if (!spawned?.ok) {
45
+ throw new Task_Error(`vitest failed with exit code ${spawned?.code}`);
46
+ }
42
47
  },
43
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.162.1",
3
+ "version": "0.162.2",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -5,7 +5,7 @@ import type {Src_Json} from '@ryanatkn/belt/src_json.js';
5
5
 
6
6
  export const package_json: Package_Json = {
7
7
  name: '@ryanatkn/gro',
8
- version: '0.162.1',
8
+ version: '0.162.2',
9
9
  description: 'task runner and toolkit extending SvelteKit',
10
10
  motto: 'generate, run, optimize',
11
11
  glyph: '🌰',
@@ -272,7 +272,7 @@ export const package_json: Package_Json = {
272
272
 
273
273
  export const src_json: Src_Json = {
274
274
  name: '@ryanatkn/gro',
275
- version: '0.162.1',
275
+ version: '0.162.2',
276
276
  modules: {
277
277
  '.': {
278
278
  path: 'index.ts',
@@ -9,8 +9,12 @@ import {VITEST_CLI} from './constants.ts';
9
9
  import {paths} from './paths.ts';
10
10
 
11
11
  export const Args = z.strictObject({
12
- _: z.array(z.string()).meta({description: 'file patterns to test'}).default(['.test.']),
12
+ _: z.array(z.string()).meta({description: 'file patterns to filter tests'}).default(['.test.']),
13
13
  dir: z.string().meta({description: 'working directory for tests'}).default(paths.source),
14
+ fail_without_tests: z
15
+ .boolean()
16
+ .meta({description: 'opt out of `passWithNoTests`'})
17
+ .default(false),
14
18
  t: z
15
19
  .string()
16
20
  .meta({description: 'search pattern for test names, same as vitest -t and --testNamePattern'})
@@ -22,28 +26,31 @@ export const task: Task<Args> = {
22
26
  summary: 'run tests with vitest',
23
27
  Args,
24
28
  run: async ({args}): Promise<void> => {
25
- const {_: patterns, dir, t} = args;
29
+ const {_: patterns, dir, fail_without_tests, t} = args;
26
30
 
27
- if (has_dep(VITEST_CLI)) {
28
- if (!find_cli(VITEST_CLI)) {
29
- throw new Task_Error('vitest is a dependency but not installed; run `npm i`?');
30
- }
31
+ if (!has_dep(VITEST_CLI)) {
32
+ throw new Task_Error('no test runner found, install vitest');
33
+ }
31
34
 
32
- const vitest_args = ['run', ...patterns];
33
- if (dir) {
34
- vitest_args.push('--dir', dir);
35
- }
36
- if (t) {
37
- vitest_args.push('-t', t);
38
- }
39
- vitest_args.push(...serialize_args(to_forwarded_args(VITEST_CLI)));
35
+ if (!find_cli(VITEST_CLI)) {
36
+ throw new Task_Error('vitest is a dependency but not installed; run `npm i`?');
37
+ }
40
38
 
41
- const spawned = await spawn_cli(VITEST_CLI, vitest_args); // TODO proper forwarding
42
- if (!spawned?.ok) {
43
- throw new Task_Error(`vitest failed with exit code ${spawned?.code}`);
44
- }
45
- } else {
46
- throw new Task_Error('no test runner found, install vitest');
39
+ const vitest_args = ['run', ...patterns];
40
+ if (dir) {
41
+ vitest_args.push('--dir', dir);
42
+ }
43
+ if (!fail_without_tests) {
44
+ vitest_args.push('--passWithNoTests');
45
+ }
46
+ if (t) {
47
+ vitest_args.push('-t', t);
48
+ }
49
+ vitest_args.push(...serialize_args(to_forwarded_args(VITEST_CLI)));
50
+
51
+ const spawned = await spawn_cli(VITEST_CLI, vitest_args);
52
+ if (!spawned?.ok) {
53
+ throw new Task_Error(`vitest failed with exit code ${spawned?.code}`);
47
54
  }
48
55
  },
49
56
  };