1
1
'use strict'
2
2
3
- const { test } = require ( 'ava' )
3
+ const test = require ( 'ava' )
4
4
const execa = require ( 'execa' )
5
5
const path = require ( 'path' )
6
6
const rmfr = require ( 'rmfr' )
7
7
8
8
const createLibrary = require ( './create-library' )
9
9
10
- const tests = [
10
+ const fixtures = [
11
11
{
12
12
name : 'my-test-library' ,
13
13
author : 'nala' ,
14
- description : 'this is a auto-generated test module. please ignore.' ,
14
+ description : 'this is an auto-generated test module. please ignore.' ,
15
15
repo : 'nala/my-test-library' ,
16
16
license : 'MIT' ,
17
17
manager : 'yarn' ,
@@ -21,7 +21,7 @@ const tests = [
21
21
{
22
22
name : 'my-test-typescript-library' ,
23
23
author : 'nala' ,
24
- description : 'this is a auto-generated test module. please ignore.' ,
24
+ description : 'this is an auto-generated test module. please ignore.' ,
25
25
repo : 'nala/my-test-library' ,
26
26
license : 'MIT' ,
27
27
manager : 'yarn' ,
@@ -31,7 +31,7 @@ const tests = [
31
31
{
32
32
name : 'my-test-library' ,
33
33
author : 'nala' ,
34
- description : 'this is a auto-generated test module. please ignore.' ,
34
+ description : 'this is an auto-generated test module. please ignore.' ,
35
35
repo : 'nala/my-test-library' ,
36
36
license : 'MIT' ,
37
37
manager : 'npm' ,
@@ -41,7 +41,7 @@ const tests = [
41
41
{
42
42
name : 'my-test-library' ,
43
43
author : 'nala' ,
44
- description : 'this is a auto-generated test module. please ignore.' ,
44
+ description : 'this is an auto-generated test module. please ignore.' ,
45
45
repo : 'nala/my-test-typescript-library' ,
46
46
license : 'MIT' ,
47
47
manager : 'npm' ,
@@ -51,7 +51,7 @@ const tests = [
51
51
{
52
52
name : '@automagical/nala' ,
53
53
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.' ,
55
55
repo : 'superstar-cats/nala' ,
56
56
license : 'GPL' ,
57
57
manager : 'yarn' ,
@@ -61,7 +61,7 @@ const tests = [
61
61
{
62
62
name : 'no-git-library' ,
63
63
author : 'nala' ,
64
- description : 'this is a auto-generated test module. please ignore.' ,
64
+ description : 'this is an auto-generated test module. please ignore.' ,
65
65
repo : 'nala/no-git-library' ,
66
66
license : 'MIT' ,
67
67
manager : 'yarn' ,
@@ -71,7 +71,7 @@ const tests = [
71
71
{
72
72
name : 'my-custom-template' ,
73
73
author : 'nala' ,
74
- description : 'this is a auto-generated test module. please ignore.' ,
74
+ description : 'this is an auto-generated test module. please ignore.' ,
75
75
repo : 'nala/my-custom-template' ,
76
76
license : 'GPL' ,
77
77
manager : 'yarn' ,
@@ -81,36 +81,39 @@ const tests = [
81
81
}
82
82
]
83
83
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
88
90
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 )
93
95
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 )
97
99
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 )
101
103
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 )
105
107
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 )
109
111
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' ) )
113
115
114
- await rmfr ( root )
115
- } )
116
+ await rmfr ( root )
117
+ }
118
+ )
116
119
} )
0 commit comments