@@ -45,63 +45,71 @@ describe('Vite - plugin', () => {
4545 } ) ;
4646 } ) ;
4747
48- it ( 'should support localesDir as absolute path' , ( ) => {
49- const plugin = initPlugin ( { localesDir : '/absolute/path/to/locales' } ) ;
50- const mockServer = triggerHotUpdateWith ( { file : '/absolute/path/to/locales/en.json' } , plugin ) ;
51-
52- expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
53- changedFiles : [ 'en' ] ,
48+ if ( process . platform !== 'win32' ) {
49+ it ( 'should support localesDir as absolute path' , ( ) => {
50+ const plugin = initPlugin ( { localesDir : '/absolute/path/to/locales' } ) ;
51+ const mockServer = triggerHotUpdateWith (
52+ { file : '/absolute/path/to/locales/en.json' } ,
53+ plugin
54+ ) ;
55+
56+ expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
57+ changedFiles : [ 'en' ] ,
58+ } ) ;
5459 } ) ;
55- } ) ;
5660
57- it ( 'should support localesDir as relative path' , ( ) => {
58- const plugin = initPlugin ( { localesDir : './public/locales' } ) ;
59- const mockServer = triggerHotUpdateWith ( { file : '/root/public/locales/en.json' } , plugin ) ;
61+ it ( 'should support localesDir as relative path' , ( ) => {
62+ const plugin = initPlugin ( { localesDir : './public/locales' } ) ;
63+ const mockServer = triggerHotUpdateWith ( { file : '/root/public/locales/en.json' } , plugin ) ;
6064
61- expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
62- changedFiles : [ 'en' ] ,
65+ expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
66+ changedFiles : [ 'en' ] ,
67+ } ) ;
6368 } ) ;
64- } ) ;
6569
66- it ( 'should support localesDirs as absolute path' , ( ) => {
67- const plugin = initPlugin ( { localesDirs : [ '/absolute/path/to/locales' ] } ) ;
68- const mockServer = triggerHotUpdateWith ( { file : '/absolute/path/to/locales/en.json' } , plugin ) ;
70+ it ( 'should support localesDirs as absolute path' , ( ) => {
71+ const plugin = initPlugin ( { localesDirs : [ '/absolute/path/to/locales' ] } ) ;
72+ const mockServer = triggerHotUpdateWith (
73+ { file : '/absolute/path/to/locales/en.json' } ,
74+ plugin
75+ ) ;
6976
70- expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
71- changedFiles : [ 'en' ] ,
77+ expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
78+ changedFiles : [ 'en' ] ,
79+ } ) ;
7280 } ) ;
73- } ) ;
7481
75- it ( 'should support localesDirs as relative path' , ( ) => {
76- const plugin = initPlugin ( { localesDirs : [ './public/locales' ] } ) ;
77- const mockServer = triggerHotUpdateWith ( { file : '/root/public/locales/en.json' } , plugin ) ;
82+ it ( 'should support localesDirs as relative path' , ( ) => {
83+ const plugin = initPlugin ( { localesDirs : [ './public/locales' ] } ) ;
84+ const mockServer = triggerHotUpdateWith ( { file : '/root/public/locales/en.json' } , plugin ) ;
7885
79- expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
80- changedFiles : [ 'en' ] ,
86+ expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
87+ changedFiles : [ 'en' ] ,
88+ } ) ;
8189 } ) ;
82- } ) ;
8390
84- it ( 'should process.cwd if root is not specified' , ( ) => {
85- const plugin = initPlugin ( { localesDirs : [ './public/locales' ] , root : '' } ) ;
86- const mockServer = triggerHotUpdateWith (
87- { file : `${ process . cwd ( ) } /public/locales/en.json` } ,
88- plugin
89- ) ;
91+ it ( 'should process.cwd if root is not specified' , ( ) => {
92+ const plugin = initPlugin ( { localesDirs : [ './public/locales' ] , root : '' } ) ;
93+ const mockServer = triggerHotUpdateWith (
94+ { file : `${ process . cwd ( ) } /public/locales/en.json` } ,
95+ plugin
96+ ) ;
9097
91- expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
92- changedFiles : [ 'en' ] ,
98+ expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
99+ changedFiles : [ 'en' ] ,
100+ } ) ;
93101 } ) ;
94- } ) ;
95102
96- it ( 'should support namespaces' , ( ) => {
97- const plugin = initPlugin ( { localesDirs : [ './public/locales' ] , root : '/root' } ) ;
98- const mockServer = triggerHotUpdateWith (
99- { file : '/root/public/locales/namespace/en.json' } ,
100- plugin
101- ) ;
103+ it ( 'should support namespaces' , ( ) => {
104+ const plugin = initPlugin ( { localesDirs : [ './public/locales' ] , root : '/root' } ) ;
105+ const mockServer = triggerHotUpdateWith (
106+ { file : '/root/public/locales/namespace/en.json' } ,
107+ plugin
108+ ) ;
102109
103- expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
104- changedFiles : [ 'namespace/en' ] ,
110+ expect ( mockServer . ws . send ) . toHaveBeenCalledWith ( 'i18next-hmr:locale-changed' , {
111+ changedFiles : [ 'namespace/en' ] ,
112+ } ) ;
105113 } ) ;
106- } ) ;
114+ }
107115} ) ;
0 commit comments