Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wip): add a node-test plugin #688

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
22 changes: 22 additions & 0 deletions lib/schemas/src/tasks/node-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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().optional().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