@@ -4,7 +4,15 @@ import {assert} from 'chai';
44import { Before , Given , Then } from '@cucumber/cucumber' ;
55
66Before ( function ( ) {
7- this . existingScripts = { ...any . simpleObject ( ) , test : any . string ( ) } ;
7+ this . existingScripts = {
8+ ...any . simpleObject ( ) ,
9+ test : any . string ( ) ,
10+ 'lint:md' : any . string ( ) ,
11+ prepare : any . string ( ) ,
12+ 'test:unit' : any . string ( ) ,
13+ 'prelint:publish' : 'run-s build' ,
14+ 'test:integration' : any . string ( )
15+ } ;
816} ) ;
917
1018Given ( 'no additional scripts are included in the results' , async function ( ) {
@@ -63,3 +71,29 @@ Then('the updated test script includes build', async function () {
6371 assert . equal ( pretest , 'run-s build' ) ;
6472 assert . notInclude ( test , 'build' ) ;
6573} ) ;
74+
75+ Then ( 'the scripts are ordered correctly' , async function ( ) {
76+ const { scripts} = JSON . parse ( await fs . readFile ( `${ process . cwd ( ) } /package.json` , 'utf8' ) ) ;
77+ const {
78+ test,
79+ 'test:unit' : testUnit ,
80+ 'test:integration' : testIntegration ,
81+ 'prelint:publish' : prelintPublish ,
82+ 'lint:md' : lintMd ,
83+ ...otherExistingScripts
84+ } = this . existingScripts ;
85+
86+ assert . deepEqual (
87+ Object . keys ( scripts ) ,
88+ [
89+ 'test' ,
90+ 'lint:lockfile' ,
91+ 'lint:md' ,
92+ 'prelint:publish' ,
93+ 'lint:publish' ,
94+ 'test:unit' ,
95+ 'test:integration' ,
96+ ...Object . keys ( otherExistingScripts ) . sort ( ( a , b ) => a . localeCompare ( b ) )
97+ ]
98+ ) ;
99+ } ) ;
0 commit comments