Skip to content

Commit

Permalink
feat(WIP): add a node-test plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanmanning committed Jan 7, 2025
1 parent 4460c33 commit 26acdc7
Show file tree
Hide file tree
Showing 10 changed files with 741 additions and 171 deletions.
2 changes: 2 additions & 0 deletions lib/schemas/src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { JestSchema } from './tasks/jest'
import { MochaSchema } from './tasks/mocha'
import { NodeSchema } from './tasks/node'
import { NodemonSchema } from './tasks/nodemon'
import { NodeTestSchema } from './tasks/node-test'
import { PrettierSchema } from './tasks/prettier'
import { TypeScriptSchema } from './tasks/typescript'
import { UploadAssetsToS3Schema } from './tasks/upload-assets-to-s3'
Expand All @@ -29,6 +30,7 @@ export const TaskSchemas = {
Mocha: MochaSchema,
Node: NodeSchema,
Nodemon: NodemonSchema,
NodeTest: NodeTestSchema,
NpmPrune: z.object({}).describe('Prune development npm dependencies.'),
NpmPublish: z.object({}).describe('Publish package to the npm registry.'),
NTest: SmokeTestSchema,
Expand Down
30 changes: 30 additions & 0 deletions lib/schemas/src/tasks/node-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { z } from 'zod'

export const NodeTestSchema = z
.object({
concurrency: z
.number()
.int()
.or(z.boolean())
.default(false)
.describe('The number of tests to run in parallel. See https://nodejs.org/api/test.html#runoptions'),
files: z
.string()
.array()
.optional()
.describe('The glob patterns for test files'),
ignore: z
.string()
.array()
.default([])
.describe('Glob patterns for test files to ignore'),
forceExit: z
.boolean()
.default(false)
.describe('Whether to force exit the process once all tests have finished executing')
})
.describe('Runs the built-in Node.js test runner to execute tests.')

export type NodeTestOptions = z.infer<typeof NodeTestSchema>

export const Schema = NodeTestSchema
Loading

0 comments on commit 26acdc7

Please sign in to comment.