@@ -14,15 +14,15 @@ describe("package-json utilities", () => {
14
14
const input = dedent `
15
15
{
16
16
"scripts": {
17
- "test": "echo \\ "Error: no test specified\ \" && exit 1"
17
+ "test": "echo \"Error: no test specified\" && exit 1"
18
18
}
19
19
}
20
20
` ;
21
21
22
22
const result = getScriptsNode ( parse ( 'json' , input ) ) ;
23
23
24
24
assert ( result ) ;
25
- assert . strictEqual ( result . children ( ) . length , 3 ) ; // curly braces + pair + curly braces
25
+ assert . strictEqual ( result . length , 1 ) ; // Number of children in the scripts node
26
26
} ) ;
27
27
28
28
it ( "should return empty array if any scripts is present" , ( ) => {
@@ -37,23 +37,6 @@ describe("package-json utilities", () => {
37
37
38
38
assert . strictEqual ( result . length , 0 ) ;
39
39
} ) ;
40
-
41
- it ( "should throw an error if multiple scripts nodes are found" , ( ) => {
42
- const input = dedent `
43
- {
44
- "scripts": {
45
- "test": "echo \\"Error: no test specified\\" && exit 1"
46
- },
47
- "scripts": {
48
- "start": "node index.js"
49
- }
50
- }
51
- ` ;
52
-
53
- assert . throws ( ( ) => getScriptsNode ( parse ( 'json' , input ) ) , {
54
- message : / M u l t i p l e " s c r i p t s " f i e l d s f o u n d /
55
- } ) ;
56
- } ) ;
57
40
} ) ;
58
41
59
42
describe ( "getNodeJsUsage" , ( ) => {
@@ -62,7 +45,7 @@ describe("package-json utilities", () => {
62
45
{
63
46
"scripts": {
64
47
"start": "node script.js",
65
- "test": "echo \\ "Error: no test specified\ \" && exit 1"
48
+ "test": "echo \"Error: no test specified\" && exit 1"
66
49
}
67
50
}
68
51
` ;
@@ -94,7 +77,7 @@ describe("package-json utilities", () => {
94
77
{
95
78
"scripts": {
96
79
"start": "node.exe script.js",
97
- "test": "echo \\ "Error: no test specified\ \" && exit 1"
80
+ "test": "echo \"Error: no test specified\" && exit 1"
98
81
}
99
82
}
100
83
` ;
@@ -110,7 +93,7 @@ describe("package-json utilities", () => {
110
93
{
111
94
"scripts": {
112
95
"start": "npm run build",
113
- "test": "echo \\ "Error: no test specified\ \" && exit 1"
96
+ "test": "echo \"Error: no test specified\" && exit 1"
114
97
}
115
98
}
116
99
` ;
0 commit comments