@@ -7,31 +7,18 @@ import {
77 twitchChatPkg ,
88 validDevInstall ,
99 validProdInstall ,
10- } from "../testUtils " ;
10+ } from "../test.util " ;
1111import { SemVer } from "semver" ;
1212import * as path from "path" ;
1313import * as installation from "../../src/utils/installation" ;
1414import * as fsUtils from "../../src/utils/fs" ;
1515import * as npm from "../../src/utils/npm" ;
1616import { ensureValidInstallation , generateBundle } from "../../src/generate" ;
17- import { computeGenOptsFields , GenerationOptions , PromptedGenerationOptions } from "../../src/generate/prompt" ;
18-
19- const defaultOptsPrompt : PromptedGenerationOptions = {
20- bundleName : "test-bundle" ,
21- bundleDir : path . join ( fsRoot , "bundles" ) ,
22- description : "Hello, this is a description for a test bundle." ,
23- version : new SemVer ( "0.1.0" ) ,
24- services : [ twitchChatPkg . path . replace ( "nodecg-io-" , "" ) ] ,
25- language : "typescript" ,
26- graphic : false ,
27- dashboard : false ,
28- } ;
29-
30- const defaultOpts = computeGenOptsFields ( defaultOptsPrompt , validProdInstall ) ;
31- const jsOpts : GenerationOptions = { ...defaultOpts , language : "javascript" } ;
17+ import { GenerationOptions } from "../../src/generate/prompt" ;
18+ import { defaultOpts , jsOpts } from "./opts.util" ;
19+
3220const nodecgPackageJsonPath = path . join ( fsRoot , "package.json" ) ;
3321const packageJsonPath = path . join ( defaultOpts . bundlePath , "package.json" ) ;
34- const tsConfigPath = path . join ( defaultOpts . bundlePath , "tsconfig.json" ) ;
3522
3623jest . spyOn ( installation , "readInstallInfo" ) . mockResolvedValue ( validProdInstall ) ;
3724jest . spyOn ( fsUtils , "executeCommand" ) . mockResolvedValue ( ) ;
@@ -96,18 +83,6 @@ describe("generateBundle", () => {
9683 } ) ;
9784} ) ;
9885
99- describe ( "genTSConfig" , ( ) => {
100- test ( "should generate tsconfig if typescript" , async ( ) => {
101- await generateBundle ( fsRoot , defaultOpts , validProdInstall ) ;
102- expect ( vol . existsSync ( tsConfigPath ) ) . toBe ( true ) ;
103- } ) ;
104-
105- test ( "should not generate tsconfig if javascript" , async ( ) => {
106- await generateBundle ( fsRoot , jsOpts , validProdInstall ) ;
107- expect ( vol . existsSync ( tsConfigPath ) ) . toBe ( false ) ;
108- } ) ;
109- } ) ;
110-
11186describe ( "genPackageJson" , ( ) => {
11287 // We don't have a good type for a package.json and this is only testing code so this should be fine.
11388 // eslint-disable-next-line @typescript-eslint/no-explicit-any
0 commit comments