• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

typeorm / typeorm / 19549987525

20 Nov 2025 08:11PM UTC coverage: 80.769% (+4.3%) from 76.433%
19549987525

push

github

web-flow
ci: run tests on commits to master and next (#11783)

Co-authored-by: Oleg "OSA413" Sokolov <OSA413@users.noreply.github.com>

26500 of 32174 branches covered (82.36%)

Branch coverage included in aggregate %.

91252 of 113615 relevant lines covered (80.32%)

88980.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

43.55
/src/commands/SubscriberCreateCommand.ts
1
import ansi from "ansis"
26✔
2
import path from "path"
26✔
3
import yargs from "yargs"
26✔
4
import { PlatformTools } from "../platform/PlatformTools"
26✔
5
import { CommandUtils } from "./CommandUtils"
26✔
6

26✔
7
/**
26✔
8
 * Generates a new subscriber.
26✔
9
 */
26✔
10
export class SubscriberCreateCommand implements yargs.CommandModule {
208✔
11
    command = "subscriber:create <path>"
208✔
12
    describe = "Generates a new subscriber."
208✔
13

208✔
14
    builder(args: yargs.Argv) {
208✔
15
        return args.positional("path", {
×
16
            type: "string",
×
17
            describe: "Path of the subscriber file",
×
18
            demandOption: true,
×
19
        })
×
20
    }
×
21

208✔
22
    async handler(args: yargs.Arguments) {
208✔
23
        try {
×
24
            const fullPath = (args.path as string).startsWith("/")
×
25
                ? (args.path as string)
×
26
                : path.resolve(process.cwd(), args.path as string)
×
27
            const filename = path.basename(fullPath)
×
28
            const fileContent = SubscriberCreateCommand.getTemplate(filename)
×
29
            const fileExists = await CommandUtils.fileExists(fullPath + ".ts")
×
30
            if (fileExists) {
×
31
                throw new Error(`File "${fullPath}.ts" already exists`)
×
32
            }
×
33
            await CommandUtils.createFile(fullPath + ".ts", fileContent)
×
34
            console.log(
×
35
                ansi.green(
×
36
                    `Subscriber ${ansi.blue`${fullPath}.ts`} has been created successfully.`,
×
37
                ),
×
38
            )
×
39
        } catch (error) {
×
40
            PlatformTools.logCmdErr("Error during subscriber creation:", error)
×
41
            process.exit(1)
×
42
        }
×
43
    }
×
44

208✔
45
    // -------------------------------------------------------------------------
208✔
46
    // Protected Static Methods
208✔
47
    // -------------------------------------------------------------------------
208✔
48

208✔
49
    /**
208✔
50
     * Gets contents of the entity file.
208✔
51
     */
208✔
52
    protected static getTemplate(name: string): string {
208✔
53
        return `import { EventSubscriber, EntitySubscriberInterface } from "typeorm"
×
54

×
55
@EventSubscriber()
×
56
export class ${name} implements EntitySubscriberInterface {
×
57

×
58
}
×
59
`
×
60
    }
×
61
}
208✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc