@@ -693,6 +693,7 @@ describe("Plugins service", () => {
693
693
newPluginHashes ?: IStringDictionary ;
694
694
buildDataFileExists ?: boolean ;
695
695
hasPluginPlatformsDir ?: boolean ;
696
+ pluginHashesAfterPrepare ?: IStringDictionary ;
696
697
} ) : any => {
697
698
const testData : any = {
698
699
pluginsService : null ,
@@ -730,7 +731,10 @@ describe("Plugins service", () => {
730
731
currentPluginNativeHashes : IStringDictionary
731
732
) => ! ! opts . hasChangesInShasums ,
732
733
generateHashes : async ( files : string [ ] ) : Promise < IStringDictionary > =>
733
- pluginHashes ,
734
+ testData . isPreparePluginNativeCodeCalled &&
735
+ opts . pluginHashesAfterPrepare
736
+ ? opts . pluginHashesAfterPrepare
737
+ : pluginHashes ,
734
738
} ) ;
735
739
736
740
unitTestsInjector . register ( "fs" , {
@@ -767,9 +771,8 @@ describe("Plugins service", () => {
767
771
unitTestsInjector . register ( "nodeModulesDependenciesBuilder" , { } ) ;
768
772
unitTestsInjector . register ( "tempService" , stubs . TempServiceStub ) ;
769
773
770
- const pluginsService : PluginsService = unitTestsInjector . resolve (
771
- PluginsService
772
- ) ;
774
+ const pluginsService : PluginsService =
775
+ unitTestsInjector . resolve ( PluginsService ) ;
773
776
testData . pluginsService = pluginsService ;
774
777
testData . pluginData = samplePluginData ;
775
778
return testData ;
@@ -805,6 +808,25 @@ describe("Plugins service", () => {
805
808
} ) ;
806
809
} ) ;
807
810
811
+ it ( "should hash the plugin files after prepare" , async ( ) => {
812
+ const newPluginHashes = { file : "hash" } ;
813
+ const pluginHashesAfterPrepare = { file : "hasedafterprepare" } ;
814
+ const testData = setupTest ( {
815
+ newPluginHashes,
816
+ hasPluginPlatformsDir : true ,
817
+ pluginHashesAfterPrepare,
818
+ } ) ;
819
+ await testData . pluginsService . preparePluginNativeCode ( {
820
+ pluginData : testData . pluginData ,
821
+ platform,
822
+ projectData,
823
+ } ) ;
824
+ assert . isTrue ( testData . isPreparePluginNativeCodeCalled ) ;
825
+ assert . deepStrictEqual ( testData . dataPassedToWriteJson , {
826
+ [ testData . pluginData . name ] : pluginHashesAfterPrepare ,
827
+ } ) ;
828
+ } ) ;
829
+
808
830
it ( "does not prepare the files when plugin has platforms dir and files have not changed since then" , async ( ) => {
809
831
const testData = setupTest ( {
810
832
hasChangesInShasums : false ,
0 commit comments