11'use strict'
22
3- const { test } = require ( 'ava' )
3+ const test = require ( 'ava' )
44const execa = require ( 'execa' )
55const path = require ( 'path' )
66const rmfr = require ( 'rmfr' )
77
88const createLibrary = require ( './create-library' )
99
10- const tests = [
10+ const fixtures = [
1111 {
1212 name : 'my-test-library' ,
1313 author : 'nala' ,
14- description : 'this is a auto-generated test module. please ignore.' ,
14+ description : 'this is an auto-generated test module. please ignore.' ,
1515 repo : 'nala/my-test-library' ,
1616 license : 'MIT' ,
1717 manager : 'yarn' ,
@@ -21,7 +21,7 @@ const tests = [
2121 {
2222 name : 'my-test-typescript-library' ,
2323 author : 'nala' ,
24- description : 'this is a auto-generated test module. please ignore.' ,
24+ description : 'this is an auto-generated test module. please ignore.' ,
2525 repo : 'nala/my-test-library' ,
2626 license : 'MIT' ,
2727 manager : 'yarn' ,
@@ -31,7 +31,7 @@ const tests = [
3131 {
3232 name : 'my-test-library' ,
3333 author : 'nala' ,
34- description : 'this is a auto-generated test module. please ignore.' ,
34+ description : 'this is an auto-generated test module. please ignore.' ,
3535 repo : 'nala/my-test-library' ,
3636 license : 'MIT' ,
3737 manager : 'npm' ,
@@ -41,7 +41,7 @@ const tests = [
4141 {
4242 name : 'my-test-library' ,
4343 author : 'nala' ,
44- description : 'this is a auto-generated test module. please ignore.' ,
44+ description : 'this is an auto-generated test module. please ignore.' ,
4545 repo : 'nala/my-test-typescript-library' ,
4646 license : 'MIT' ,
4747 manager : 'npm' ,
@@ -51,7 +51,7 @@ const tests = [
5151 {
5252 name : '@automagical/nala' ,
5353 author : 'superstar-cats' ,
54- description : 'this is a auto-generated test module. please ignore.' ,
54+ description : 'this is an auto-generated test module. please ignore.' ,
5555 repo : 'superstar-cats/nala' ,
5656 license : 'GPL' ,
5757 manager : 'yarn' ,
@@ -61,7 +61,7 @@ const tests = [
6161 {
6262 name : 'no-git-library' ,
6363 author : 'nala' ,
64- description : 'this is a auto-generated test module. please ignore.' ,
64+ description : 'this is an auto-generated test module. please ignore.' ,
6565 repo : 'nala/no-git-library' ,
6666 license : 'MIT' ,
6767 manager : 'yarn' ,
@@ -71,7 +71,7 @@ const tests = [
7171 {
7272 name : 'my-custom-template' ,
7373 author : 'nala' ,
74- description : 'this is a auto-generated test module. please ignore.' ,
74+ description : 'this is an auto-generated test module. please ignore.' ,
7575 repo : 'nala/my-custom-template' ,
7676 license : 'GPL' ,
7777 manager : 'yarn' ,
@@ -81,36 +81,39 @@ const tests = [
8181 }
8282]
8383
84- tests . forEach ( ( opts ) => {
85- test . serial ( `creating "${ opts . name } " using ${ opts . manager } ` , async ( t ) => {
86- console . log ( `creating "${ opts . name } " using ${ opts . manager } ...` )
87- let ret
84+ fixtures . forEach ( ( fixture ) => {
85+ test . serial (
86+ `creating "${ fixture . name } " using ${ fixture . manager } ` ,
87+ async ( t ) => {
88+ console . log ( `creating "${ fixture . name } " using ${ fixture . manager } ...` )
89+ let ret
8890
89- // ensure library is created successfully
90- const root = await createLibrary ( opts )
91- const example = path . join ( root , 'example' )
92- t . truthy ( root . indexOf ( opts . shortName ) >= 0 )
91+ // ensure library is created successfully
92+ const root = await createLibrary ( fixture )
93+ const example = path . join ( root , 'example' )
94+ t . truthy ( root . indexOf ( fixture . shortName ) >= 0 )
9395
94- // ensure deps install successfully in root
95- ret = await execa . shell ( `${ opts . manager } install` , { cwd : root } )
96- t . is ( ret . code , 0 )
96+ // ensure deps install successfully in root
97+ ret = await execa . shell ( `${ fixture . manager } install` , { cwd : root } )
98+ t . is ( ret . code , 0 )
9799
98- // ensure root tests pass
99- ret = await execa . shell ( `${ opts . manager } test` , { cwd : root } )
100- t . is ( ret . code , 0 )
100+ // ensure root tests pass
101+ ret = await execa . shell ( `${ fixture . manager } test` , { cwd : root } )
102+ t . is ( ret . code , 0 )
101103
102- // ensure deps install successfully in example
103- ret = await execa . shell ( `${ opts . manager } install` , { cwd : example } )
104- t . is ( ret . code , 0 )
104+ // ensure deps install successfully in example
105+ ret = await execa . shell ( `${ fixture . manager } install` , { cwd : example } )
106+ t . is ( ret . code , 0 )
105107
106- // ensure bundle builds successfully in example
107- ret = await execa . shell ( `${ opts . manager } build` , { cwd : example } )
108- t . is ( ret . code , 0 )
108+ // ensure bundle builds successfully in example
109+ ret = await execa . shell ( `${ fixture . manager } build` , { cwd : example } )
110+ t . is ( ret . code , 0 )
109111
110- // ensure git is initialized properly
111- ret = await execa . shell ( 'git rev-parse --git-dir' , { cwd : root } )
112- t . is ( ret . stdout , opts . git ? '.git' : path . join ( process . cwd ( ) , '.git' ) )
112+ // ensure git is initialized properly
113+ ret = await execa . shell ( 'git rev-parse --git-dir' , { cwd : root } )
114+ t . is ( ret . stdout , fixture . git ? '.git' : path . join ( process . cwd ( ) , '.git' ) )
113115
114- await rmfr ( root )
115- } )
116+ await rmfr ( root )
117+ }
118+ )
116119} )
0 commit comments