@neurodevs/meta-node 0.19.10 → 0.19.12

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.
@@ -1,22 +1,20 @@
1
1
  import { ChildProcess, exec as execSync } from 'child_process'
2
2
  import { readFile, writeFile } from 'fs/promises'
3
3
  import { mkdir } from 'fs/promises'
4
+ import path from 'path'
4
5
  import { promisify } from 'util'
5
6
  import {
6
- callsToChdir,
7
7
  callsToExec,
8
8
  callsToFetch,
9
9
  callsToMkdir,
10
10
  callsToReadFile,
11
11
  callsToWriteFile,
12
- fakeChdir,
13
12
  fakeExec,
14
13
  fakeFetch,
15
14
  fakeMkdir,
16
15
  fakePathExists,
17
16
  fakeReadFile,
18
17
  fakeWriteFile,
19
- resetCallsToChdir,
20
18
  resetCallsToExec,
21
19
  resetCallsToFetch,
22
20
  resetCallsToMkdir,
@@ -43,10 +41,85 @@ const exec = promisify(execSync)
43
41
  export default class NpmAutopackageTest extends AbstractPackageTest {
44
42
  private static instance: Autopackage
45
43
 
44
+ private static readonly installDir = this.generateId()
45
+ private static readonly description = this.generateId()
46
+ private static readonly gitNamespace = this.generateId()
47
+ private static readonly npmNamespace = this.generateId()
48
+ private static readonly keywords = [this.generateId(), this.generateId()]
49
+ private static readonly license = this.generateId()
50
+ private static readonly author = this.generateId()
51
+ private static readonly githubToken = this.generateId()
52
+ private static readonly randomId = this.generateId()
53
+
54
+ private static readonly packageDir = path.join(
55
+ this.installDir,
56
+ this.packageName
57
+ )
58
+
59
+ private static readonly packageJsonPath = path.join(
60
+ this.packageDir,
61
+ 'package.json'
62
+ )
63
+
64
+ private static readonly gitignorePath = path.join(
65
+ this.packageDir,
66
+ '.gitignore'
67
+ )
68
+ private static readonly buildDirGitignorePattern = '\nbuild/\n'
69
+
70
+ private static readonly tasksJsonPath = path.join(
71
+ this.packageDir,
72
+ '.vscode',
73
+ 'tasks.json'
74
+ )
75
+
76
+ private static readonly testDirPath = path.join(
77
+ this.packageDir,
78
+ 'src',
79
+ '__tests__'
80
+ )
81
+
82
+ private static readonly abstractTestPath = path.join(
83
+ this.testDirPath,
84
+ 'AbstractPackageTest.ts'
85
+ )
86
+
87
+ private static readonly setupVscodeCmd = 'spruce setup.vscode --all true'
88
+
89
+ private static readonly checkGenerateIdVersionCmd = `yarn info @neurodevs/generate-id version --silent`
90
+ private static readonly checkNodeTddVersionCmd = `yarn info @neurodevs/node-tdd version --silent`
91
+
92
+ private static readonly dependencies = {
93
+ [this.generateId()]: this.generateId(),
94
+ [this.generateId()]: this.generateId(),
95
+ }
96
+
97
+ private static readonly yarnInstallDevDepsCommand =
98
+ 'yarn add -D @neurodevs/generate-id@latest @neurodevs/node-tdd@latest'
99
+
100
+ private static readonly abstractTestFile = `import AbstractModuleTest from '@neurodevs/node-tdd'
101
+
102
+ export default abstract class AbstractPackageTest extends AbstractModuleTest {
103
+ protected static async beforeEach() {
104
+ await super.beforeEach()
105
+ }
106
+ }
107
+ `
108
+
109
+ private static readonly defaultOptions = {
110
+ installDir: this.installDir,
111
+ name: this.packageName,
112
+ description: this.description,
113
+ gitNamespace: this.gitNamespace,
114
+ npmNamespace: this.npmNamespace,
115
+ keywords: this.keywords,
116
+ license: this.license,
117
+ author: this.author,
118
+ }
119
+
46
120
  protected static async beforeEach() {
47
121
  await super.beforeEach()
48
122
 
49
- this.fakeChdir()
50
123
  this.fakeExec()
51
124
  this.fakeFetch()
52
125
  this.fakeMkdir()
@@ -101,7 +174,7 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
101
174
  'Content-Type': 'application/json',
102
175
  },
103
176
  body: JSON.stringify({
104
- name: this.name,
177
+ name: this.packageName,
105
178
  private: false,
106
179
  description: this.description,
107
180
  auto_init: true,
@@ -114,46 +187,27 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
114
187
  )
115
188
  }
116
189
 
117
- @test()
118
- protected static async thenChdirToInstallDir() {
119
- await this.run()
120
-
121
- assert.isEqual(
122
- callsToChdir[0],
123
- this.installDir,
124
- 'Did not change to installDir!'
125
- )
126
- }
127
-
128
190
  @test()
129
191
  protected static async thenGitClone() {
130
192
  await this.run()
131
193
 
132
- assert.isEqual(
133
- callsToExec[0]?.command,
134
- `git clone https://github.com/${this.gitNamespace}/${this.name}.git`,
194
+ assert.isEqualDeep(
195
+ callsToExec[0],
196
+ {
197
+ command: `git clone https://github.com/${this.gitNamespace}/${this.packageName}.git`,
198
+ options: { cwd: this.installDir },
199
+ },
135
200
  'Did not call git clone!'
136
201
  )
137
202
  }
138
203
 
139
- @test()
140
- protected static async thenChdirToPackageDir() {
141
- await this.run()
142
-
143
- assert.isEqual(
144
- callsToChdir[1],
145
- this.packageDir,
146
- 'Did not change to packageDir!'
147
- )
148
- }
149
-
150
204
  @test()
151
205
  protected static async thenGitFetchOrigin() {
152
206
  await this.run()
153
207
 
154
- assert.isEqual(
155
- callsToExec[1]?.command,
156
- `git fetch origin`,
208
+ assert.isEqualDeep(
209
+ callsToExec[1],
210
+ { command: `git fetch origin`, options: { cwd: this.packageDir } },
157
211
  'Did not call git fetch origin!'
158
212
  )
159
213
  }
@@ -162,9 +216,12 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
162
216
  protected static async thenGitFetchResetHard() {
163
217
  await this.run()
164
218
 
165
- assert.isEqual(
166
- callsToExec[2]?.command,
167
- `git reset --hard origin/main`,
219
+ assert.isEqualDeep(
220
+ callsToExec[2],
221
+ {
222
+ command: `git reset --hard origin/main`,
223
+ options: { cwd: this.packageDir },
224
+ },
168
225
  'Did not call git reset hard!'
169
226
  )
170
227
  }
@@ -173,9 +230,12 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
173
230
  protected static async thenSpruceCreateModule() {
174
231
  await this.run()
175
232
 
176
- assert.isEqual(
177
- callsToExec[4]?.command,
178
- this.createModuleCmd,
233
+ assert.isEqualDeep(
234
+ callsToExec[4],
235
+ {
236
+ command: this.createModuleCmd,
237
+ options: { cwd: this.packageDir },
238
+ },
179
239
  'Did not call "spruce create.module"!'
180
240
  )
181
241
  }
@@ -185,8 +245,11 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
185
245
  await this.run()
186
246
 
187
247
  assert.isEqualDeep(
188
- FakeAutocommit.callsToConstructor[0]?.commitMessage,
189
- `patch: create package (@neurodevs/meta-node: ${this.metaNodeVersion})`,
248
+ FakeAutocommit.callsToConstructor[0],
249
+ {
250
+ commitMessage: `patch: create package (@neurodevs/meta-node: ${this.metaNodeVersion})`,
251
+ cwd: this.packageDir,
252
+ },
190
253
  'Did not commit create package changes!'
191
254
  )
192
255
  }
@@ -254,8 +317,11 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
254
317
  await this.run()
255
318
 
256
319
  assert.isEqualDeep(
257
- FakeAutocommit.callsToConstructor[1]?.commitMessage,
258
- `patch: update package.json (@neurodevs/meta-node: ${this.metaNodeVersion})`,
320
+ FakeAutocommit.callsToConstructor[1],
321
+ {
322
+ commitMessage: `patch: update package.json (@neurodevs/meta-node: ${this.metaNodeVersion})`,
323
+ cwd: this.packageDir,
324
+ },
259
325
  'Did not commit update package changes!'
260
326
  )
261
327
  }
@@ -280,8 +346,11 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
280
346
  await this.run()
281
347
 
282
348
  assert.isEqualDeep(
283
- FakeAutocommit.callsToConstructor[2]?.commitMessage,
284
- `patch: add build dir to gitignore (@neurodevs/meta-node: ${this.metaNodeVersion})`,
349
+ FakeAutocommit.callsToConstructor[2],
350
+ {
351
+ commitMessage: `patch: add build dir to gitignore (@neurodevs/meta-node: ${this.metaNodeVersion})`,
352
+ cwd: this.packageDir,
353
+ },
285
354
  'Did not commit .gitignore changes!'
286
355
  )
287
356
  }
@@ -290,9 +359,12 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
290
359
  protected static async thenSpruceSetupVscode() {
291
360
  await this.run()
292
361
 
293
- assert.isEqual(
294
- callsToExec[5]?.command,
295
- this.setupVscodeCmd,
362
+ assert.isEqualDeep(
363
+ callsToExec[5],
364
+ {
365
+ command: this.setupVscodeCmd,
366
+ options: { cwd: this.packageDir },
367
+ },
296
368
  'Did not call "spruce setup.vscode"!'
297
369
  )
298
370
  }
@@ -302,8 +374,11 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
302
374
  await this.run()
303
375
 
304
376
  assert.isEqualDeep(
305
- FakeAutocommit.callsToConstructor[3]?.commitMessage,
306
- `patch: setup vscode (@neurodevs/meta-node: ${this.metaNodeVersion})`,
377
+ FakeAutocommit.callsToConstructor[3],
378
+ {
379
+ commitMessage: `patch: setup vscode (@neurodevs/meta-node: ${this.metaNodeVersion})`,
380
+ cwd: this.packageDir,
381
+ },
307
382
  'Did not commit vscode changes!'
308
383
  )
309
384
  }
@@ -324,8 +399,11 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
324
399
  await this.run()
325
400
 
326
401
  assert.isEqualDeep(
327
- FakeAutocommit.callsToConstructor[4]?.commitMessage,
328
- `patch: update vscode tasks.json (@neurodevs/meta-node: ${this.metaNodeVersion})`,
402
+ FakeAutocommit.callsToConstructor[4],
403
+ {
404
+ commitMessage: `patch: update vscode tasks.json (@neurodevs/meta-node: ${this.metaNodeVersion})`,
405
+ cwd: this.packageDir,
406
+ },
329
407
  'Did not commit updated vscode tasks.json changes!'
330
408
  )
331
409
  }
@@ -334,9 +412,12 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
334
412
  protected static async thenInstallsDefaultDevDependencies() {
335
413
  await this.run()
336
414
 
337
- assert.isEqual(
338
- callsToExec[8]?.command,
339
- this.yarnInstallDevDepsCommand,
415
+ assert.isEqualDeep(
416
+ callsToExec[8],
417
+ {
418
+ command: this.yarnInstallDevDepsCommand,
419
+ options: { cwd: this.packageDir },
420
+ },
340
421
  'Did not install default devDependencies!'
341
422
  )
342
423
  }
@@ -346,8 +427,11 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
346
427
  await this.run()
347
428
 
348
429
  assert.isEqualDeep(
349
- FakeAutocommit.callsToConstructor[5]?.commitMessage,
350
- `patch: install default devDependencies (@neurodevs/meta-node: ${this.metaNodeVersion})`,
430
+ FakeAutocommit.callsToConstructor[5],
431
+ {
432
+ commitMessage: `patch: install default devDependencies (@neurodevs/meta-node: ${this.metaNodeVersion})`,
433
+ cwd: this.packageDir,
434
+ },
351
435
  'Did not commit install devDependencies changes!'
352
436
  )
353
437
  }
@@ -359,7 +443,7 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
359
443
  assert.isEqualDeep(
360
444
  callsToMkdir[0],
361
445
  {
362
- path: 'src/__tests__',
446
+ path: this.testDirPath,
363
447
  options: { recursive: true },
364
448
  },
365
449
  'Did not install tests directory!'
@@ -373,8 +457,8 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
373
457
  assert.isEqualDeep(
374
458
  callsToWriteFile[3],
375
459
  {
376
- file: this.abstractPackageTestPath,
377
- data: this.abstractPackageTestFile,
460
+ file: this.abstractTestPath,
461
+ data: this.abstractTestFile,
378
462
  options: { encoding: 'utf-8' },
379
463
  },
380
464
  'Did not install AbstractPackageTest!'
@@ -386,8 +470,11 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
386
470
  await this.run()
387
471
 
388
472
  assert.isEqualDeep(
389
- FakeAutocommit.callsToConstructor[6]?.commitMessage,
390
- `patch: install AbstractPackageTest (@neurodevs/meta-node: ${this.metaNodeVersion})`,
473
+ FakeAutocommit.callsToConstructor[6],
474
+ {
475
+ commitMessage: `patch: install AbstractPackageTest (@neurodevs/meta-node: ${this.metaNodeVersion})`,
476
+ cwd: this.packageDir,
477
+ },
391
478
  'Did not commit install AbstractPackageTest changes!'
392
479
  )
393
480
  }
@@ -396,13 +483,78 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
396
483
  protected static async lastlyOpensVscodeAtEnd() {
397
484
  await this.run()
398
485
 
399
- assert.isEqual(
400
- callsToExec[9]?.command,
401
- 'code .',
486
+ assert.isEqualDeep(
487
+ callsToExec[9],
488
+ { command: 'code .', options: { cwd: this.packageDir } },
402
489
  'Did not open vscode at end!'
403
490
  )
404
491
  }
405
492
 
493
+ @test()
494
+ protected static async installsDevDependenciesIfGenerateIdNotLatest() {
495
+ setFakeExecResult(this.checkGenerateIdVersionCmd, {
496
+ stdout: '0.0.1',
497
+ } as unknown as ChildProcess)
498
+
499
+ await this.createAndRunAutopackage()
500
+
501
+ const calls = callsToExec.filter(
502
+ (call) => call?.command === this.yarnInstallDevDepsCommand
503
+ )
504
+
505
+ assert.isEqualDeep(
506
+ calls[0],
507
+ {
508
+ command: this.yarnInstallDevDepsCommand,
509
+ options: { cwd: this.packageDir },
510
+ },
511
+ 'Should install default devDependencies if not already installed!'
512
+ )
513
+ }
514
+
515
+ @test()
516
+ protected static async installsDevDependenciesIfNodeTddNotLatest() {
517
+ setFakeExecResult(this.checkGenerateIdVersionCmd, {
518
+ stdout: '1.0.0',
519
+ } as unknown as ChildProcess)
520
+
521
+ setFakeExecResult(this.checkNodeTddVersionCmd, {
522
+ stdout: '0.0.1',
523
+ } as unknown as ChildProcess)
524
+
525
+ await this.createAndRunAutopackage()
526
+
527
+ const calls = callsToExec.filter(
528
+ (call) => call?.command === this.yarnInstallDevDepsCommand
529
+ )
530
+
531
+ assert.isEqualDeep(
532
+ calls[0],
533
+ {
534
+ command: this.yarnInstallDevDepsCommand,
535
+ options: { cwd: this.packageDir },
536
+ },
537
+ 'Should install default devDependencies if not already installed!'
538
+ )
539
+ }
540
+
541
+ @test()
542
+ protected static async makeNpmNamespaceOptional() {
543
+ resetCallsToWriteFile()
544
+
545
+ const instance = this.NpmAutopackage({
546
+ npmNamespace: undefined,
547
+ })
548
+
549
+ await instance.run()
550
+
551
+ assert.doesInclude(
552
+ callsToWriteFile[0]?.data,
553
+ `"name": "${this.packageName}"`,
554
+ 'Did not handle missing npmNamespace!'
555
+ )
556
+ }
557
+
406
558
  @test()
407
559
  protected static async doesNotCreateRepoInGithubOrgIfDone() {
408
560
  const fakeResponse = new Response(null, {
@@ -429,7 +581,7 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
429
581
  callsToExec.filter(
430
582
  (call) =>
431
583
  call?.command ===
432
- `git clone https://github.com/${this.gitNamespace}/${this.name}.git`
584
+ `git clone https://github.com/${this.gitNamespace}/${this.packageName}.git`
433
585
  ).length,
434
586
  1,
435
587
  'Did not clone repo once!'
@@ -547,7 +699,7 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
547
699
 
548
700
  @test()
549
701
  protected static async doesNotOpenVscodeIfNotCloned() {
550
- setPathShouldExist(this.name, true)
702
+ setPathShouldExist(this.packageDir, true)
551
703
 
552
704
  await this.createAndRunAutopackage()
553
705
 
@@ -557,48 +709,6 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
557
709
  )
558
710
  }
559
711
 
560
- @test()
561
- protected static async installsDevDependenciesIfGenerateIdNotLatest() {
562
- setFakeExecResult(this.checkGenerateIdVersionCmd, {
563
- stdout: '0.0.1',
564
- } as unknown as ChildProcess)
565
-
566
- await this.createAndRunAutopackage()
567
-
568
- const calls = callsToExec.filter(
569
- (call) => call?.command === this.yarnInstallDevDepsCommand
570
- )
571
-
572
- assert.isEqual(
573
- calls.length,
574
- 1,
575
- 'Should not install default devDependencies if already installed!'
576
- )
577
- }
578
-
579
- @test()
580
- protected static async installsDevDependenciesIfNodeTddNotLatest() {
581
- setFakeExecResult(this.checkGenerateIdVersionCmd, {
582
- stdout: '1.0.0',
583
- } as unknown as ChildProcess)
584
-
585
- setFakeExecResult(this.checkNodeTddVersionCmd, {
586
- stdout: '0.0.1',
587
- } as unknown as ChildProcess)
588
-
589
- await this.createAndRunAutopackage()
590
-
591
- const calls = callsToExec.filter(
592
- (call) => call?.command === this.yarnInstallDevDepsCommand
593
- )
594
-
595
- assert.isEqual(
596
- calls.length,
597
- 1,
598
- 'Should not install default devDependencies if already installed!'
599
- )
600
- }
601
-
602
712
  @test()
603
713
  protected static async doesNotThrowIfGenerateIdNotInPackageJson() {
604
714
  setFakeReadFileResult(
@@ -611,12 +721,12 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
611
721
 
612
722
  @test()
613
723
  protected static async doesNotInstallAbstractPackageTestIfTsExists() {
614
- setPathShouldExist(this.abstractPackageTestPath, true)
724
+ setPathShouldExist(this.abstractTestPath, true)
615
725
 
616
726
  await this.createAndRunAutopackage()
617
727
 
618
728
  const calls = callsToWriteFile.filter(
619
- (call) => call.file === this.abstractPackageTestPath
729
+ (call) => call.file === this.abstractTestPath
620
730
  )
621
731
 
622
732
  assert.isEqual(
@@ -628,12 +738,12 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
628
738
 
629
739
  @test()
630
740
  protected static async doesNotInstallAbstractPackageTestIfTsxExists() {
631
- setPathShouldExist(`${this.abstractPackageTestPath}x`, true)
741
+ setPathShouldExist(`${this.abstractTestPath}x`, true)
632
742
 
633
743
  await this.createAndRunAutopackage()
634
744
 
635
745
  const calls = callsToWriteFile.filter(
636
- (call) => call.file === this.abstractPackageTestPath
746
+ (call) => call.file === this.abstractTestPath
637
747
  )
638
748
 
639
749
  assert.isEqual(
@@ -643,23 +753,6 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
643
753
  )
644
754
  }
645
755
 
646
- @test()
647
- protected static async makeNpmNamespaceOptional() {
648
- resetCallsToWriteFile()
649
-
650
- const instance = this.NpmAutopackage({
651
- npmNamespace: undefined,
652
- })
653
-
654
- await instance.run()
655
-
656
- assert.doesInclude(
657
- callsToWriteFile[0]?.data,
658
- `"name": "${this.name}"`,
659
- 'Did not handle missing npmNamespace!'
660
- )
661
- }
662
-
663
756
  private static async run() {
664
757
  await this.instance.run()
665
758
  }
@@ -670,26 +763,13 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
670
763
  }
671
764
 
672
765
  private static get scopedPackageName() {
673
- return `@${this.npmNamespace}/${this.name}`
674
- }
675
-
676
- private static get packageDir() {
677
- return this.name
766
+ return `@${this.npmNamespace}/${this.packageName}`
678
767
  }
679
768
 
680
- private static readonly packageJsonPath = 'package.json'
681
- private static readonly gitignorePath = '.gitignore'
682
- private static readonly buildDirGitignorePattern = '\nbuild/\n'
683
-
684
769
  private static get createModuleCmd() {
685
- return `spruce create.module --name "${this.name}" --destination "." --description "${this.description}"`
770
+ return `spruce create.module --name "${this.packageName}" --destination "." --description "${this.description}"`
686
771
  }
687
772
 
688
- private static readonly setupVscodeCmd = 'spruce setup.vscode --all true'
689
-
690
- private static readonly checkGenerateIdVersionCmd = `yarn info @neurodevs/generate-id version --silent`
691
- private static readonly checkNodeTddVersionCmd = `yarn info @neurodevs/node-tdd version --silent`
692
-
693
773
  private static orderJsonKeys(
694
774
  json: Record<string, unknown>,
695
775
  keyOrder: string[]
@@ -713,11 +793,6 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
713
793
  return ordered
714
794
  }
715
795
 
716
- private static fakeChdir() {
717
- NpmAutopackage.chdir = fakeChdir
718
- resetCallsToChdir()
719
- }
720
-
721
796
  private static fakeExec() {
722
797
  NpmAutopackage.exec = fakeExec as unknown as typeof exec
723
798
  resetCallsToExec()
@@ -739,7 +814,7 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
739
814
  NpmAutopackage.pathExists = fakePathExists
740
815
  resetCallsToPathExists()
741
816
 
742
- setPathShouldExist(this.abstractPackageTestPath, false)
817
+ setPathShouldExist(this.abstractTestPath, false)
743
818
  }
744
819
 
745
820
  private static fakeReadFile() {
@@ -773,34 +848,17 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
773
848
  setFakeFetchResponse(this.reposUrl, fakeResponse)
774
849
  }
775
850
 
776
- private static readonly installDir = this.generateId()
777
- private static readonly name = this.generateId()
778
- private static readonly description = this.generateId()
779
- private static readonly gitNamespace = this.generateId()
780
- private static readonly npmNamespace = this.generateId()
781
- private static readonly keywords = [this.generateId(), this.generateId()]
782
- private static readonly license = this.generateId()
783
- private static readonly author = this.generateId()
784
-
785
- private static readonly githubToken = this.generateId()
786
- private static readonly randomId = this.generateId()
787
-
788
851
  private static get reposUrl() {
789
- return `https://api.github.com/repos/${this.gitNamespace}/${this.name}`
852
+ return `https://api.github.com/repos/${this.gitNamespace}/${this.packageName}`
790
853
  }
791
854
 
792
855
  private static get orgsUrl() {
793
856
  return `https://api.github.com/orgs/${this.gitNamespace}/repos`
794
857
  }
795
858
 
796
- private static readonly dependencies = {
797
- [this.generateId()]: this.generateId(),
798
- [this.generateId()]: this.generateId(),
799
- }
800
-
801
859
  private static get originalPackageJson() {
802
860
  return JSON.stringify({
803
- name: this.name,
861
+ name: this.packageName,
804
862
  description: 'Old description',
805
863
  dependencies: this.dependencies,
806
864
  devDependencies: {
@@ -819,20 +877,18 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
819
877
  license: this.license,
820
878
  author: this.author,
821
879
  main: 'build/index.js',
822
- homepage: `https://github.com/${this.gitNamespace}/${this.name}`,
880
+ homepage: `https://github.com/${this.gitNamespace}/${this.packageName}`,
823
881
  repository: {
824
882
  type: 'git',
825
- url: `git+https://github.com/${this.gitNamespace}/${this.name}.git`,
883
+ url: `git+https://github.com/${this.gitNamespace}/${this.packageName}.git`,
826
884
  },
827
885
  bugs: {
828
- url: `https://github.com/${this.gitNamespace}/${this.name}/issues`,
886
+ url: `https://github.com/${this.gitNamespace}/${this.packageName}/issues`,
829
887
  },
830
888
  dependencies: this.dependencies,
831
889
  })
832
890
  }
833
891
 
834
- private static readonly tasksJsonPath = '.vscode/tasks.json'
835
-
836
892
  private static originalTasksJson = {
837
893
  [this.randomId]: this.randomId,
838
894
  tasks: [
@@ -881,32 +937,6 @@ export default class NpmAutopackageTest extends AbstractPackageTest {
881
937
  )
882
938
  }
883
939
 
884
- private static readonly yarnInstallDevDepsCommand =
885
- 'yarn add -D @neurodevs/generate-id@latest @neurodevs/node-tdd@latest'
886
-
887
- private static readonly abstractPackageTestPath =
888
- 'src/__tests__/AbstractPackageTest.ts'
889
-
890
- private static readonly abstractPackageTestFile = `import AbstractModuleTest from '@neurodevs/node-tdd'
891
-
892
- export default abstract class AbstractPackageTest extends AbstractModuleTest {
893
- protected static async beforeEach() {
894
- await super.beforeEach()
895
- }
896
- }
897
- `
898
-
899
- private static readonly defaultOptions = {
900
- installDir: this.installDir,
901
- name: this.name,
902
- description: this.description,
903
- gitNamespace: this.gitNamespace,
904
- npmNamespace: this.npmNamespace,
905
- keywords: this.keywords,
906
- license: this.license,
907
- author: this.author,
908
- }
909
-
910
940
  private static NpmAutopackage(options?: Partial<AutopackageOptions>) {
911
941
  return NpmAutopackage.Create({ ...this.defaultOptions, ...options })
912
942
  }