@@ -122,31 +122,25 @@ describe('cli', function() {
122
122
123
123
describe ( 'node-sass in.scss' , function ( ) {
124
124
it ( 'should compile a scss file' , function ( done ) {
125
- process . chdir ( fixture ( 'simple' ) ) ;
126
-
127
125
var src = fixture ( 'simple/index.scss' ) ;
128
126
var dest = fixture ( 'simple/index.css' ) ;
129
127
var bin = spawn ( cli , [ src , dest ] ) ;
130
128
131
129
bin . once ( 'close' , function ( ) {
132
130
assert ( fs . existsSync ( dest ) ) ;
133
131
fs . unlinkSync ( dest ) ;
134
- process . chdir ( __dirname ) ;
135
132
done ( ) ;
136
133
} ) ;
137
134
} ) ;
138
135
139
136
it ( 'should compile a scss file to custom destination' , function ( done ) {
140
- process . chdir ( fixture ( 'simple' ) ) ;
141
-
142
137
var src = fixture ( 'simple/index.scss' ) ;
143
138
var dest = fixture ( 'simple/index-custom.css' ) ;
144
139
var bin = spawn ( cli , [ src , dest ] ) ;
145
140
146
141
bin . once ( 'close' , function ( ) {
147
142
assert ( fs . existsSync ( dest ) ) ;
148
143
fs . unlinkSync ( dest ) ;
149
- process . chdir ( __dirname ) ;
150
144
done ( ) ;
151
145
} ) ;
152
146
} ) ;
@@ -169,8 +163,6 @@ describe('cli', function() {
169
163
} ) ;
170
164
171
165
it ( 'should compile silently using the --quiet option' , function ( done ) {
172
- process . chdir ( fixture ( 'simple' ) ) ;
173
-
174
166
var src = fixture ( 'simple/index.scss' ) ;
175
167
var dest = fixture ( 'simple/index.css' ) ;
176
168
var bin = spawn ( cli , [ src , dest , '--quiet' ] ) ;
@@ -183,14 +175,11 @@ describe('cli', function() {
183
175
bin . once ( 'close' , function ( ) {
184
176
assert . equal ( didEmit , false ) ;
185
177
fs . unlinkSync ( dest ) ;
186
- process . chdir ( __dirname ) ;
187
178
done ( ) ;
188
179
} ) ;
189
180
} ) ;
190
181
191
182
it ( 'should still report errors with the --quiet option' , function ( done ) {
192
- process . chdir ( fixture ( 'invalid' ) ) ;
193
-
194
183
var src = fixture ( 'invalid/index.scss' ) ;
195
184
var dest = fixture ( 'invalid/index.css' ) ;
196
185
var bin = spawn ( cli , [ src , dest , '--quiet' ] ) ;
@@ -202,7 +191,6 @@ describe('cli', function() {
202
191
203
192
bin . once ( 'close' , function ( ) {
204
193
assert . equal ( didEmit , true ) ;
205
- process . chdir ( __dirname ) ;
206
194
done ( ) ;
207
195
} ) ;
208
196
} ) ;
@@ -644,7 +632,8 @@ describe('cli', function() {
644
632
describe ( 'importer' , function ( ) {
645
633
var dest = fixture ( 'include-files/index.css' ) ;
646
634
var src = fixture ( 'include-files/index.scss' ) ;
647
- var expected = read ( fixture ( 'include-files/expected-importer.css' ) , 'utf8' ) . trim ( ) . replace ( / \r \n / g, '\n' ) ;
635
+ var expectedData = read ( fixture ( 'include-files/expected-data-importer.css' ) , 'utf8' ) . trim ( ) . replace ( / \r \n / g, '\n' ) ;
636
+ var expectedFile = read ( fixture ( 'include-files/expected-file-importer.css' ) , 'utf8' ) . trim ( ) . replace ( / \r \n / g, '\n' ) ;
648
637
649
638
it ( 'should override imports and fire callback with file and contents' , function ( done ) {
650
639
var bin = spawn ( cli , [
@@ -653,7 +642,7 @@ describe('cli', function() {
653
642
] ) ;
654
643
655
644
bin . once ( 'close' , function ( ) {
656
- assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expected ) ;
645
+ assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expectedData ) ;
657
646
fs . unlinkSync ( dest ) ;
658
647
done ( ) ;
659
648
} ) ;
@@ -667,7 +656,7 @@ describe('cli', function() {
667
656
668
657
bin . once ( 'close' , function ( ) {
669
658
if ( fs . existsSync ( dest ) ) {
670
- assert . equal ( read ( dest , 'utf8' ) . trim ( ) , '' ) ;
659
+ assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expectedFile ) ;
671
660
fs . unlinkSync ( dest ) ;
672
661
}
673
662
@@ -682,7 +671,7 @@ describe('cli', function() {
682
671
] ) ;
683
672
684
673
bin . once ( 'close' , function ( ) {
685
- assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expected ) ;
674
+ assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expectedData ) ;
686
675
fs . unlinkSync ( dest ) ;
687
676
done ( ) ;
688
677
} ) ;
@@ -695,7 +684,7 @@ describe('cli', function() {
695
684
] ) ;
696
685
697
686
bin . once ( 'close' , function ( ) {
698
- assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expected ) ;
687
+ assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expectedData ) ;
699
688
fs . unlinkSync ( dest ) ;
700
689
done ( ) ;
701
690
} ) ;
@@ -709,7 +698,7 @@ describe('cli', function() {
709
698
710
699
bin . once ( 'close' , function ( ) {
711
700
if ( fs . existsSync ( dest ) ) {
712
- assert . equal ( read ( dest , 'utf8' ) . trim ( ) , '' ) ;
701
+ assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expectedFile ) ;
713
702
fs . unlinkSync ( dest ) ;
714
703
}
715
704
@@ -724,7 +713,7 @@ describe('cli', function() {
724
713
] ) ;
725
714
726
715
bin . once ( 'close' , function ( ) {
727
- assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expected ) ;
716
+ assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expectedData ) ;
728
717
fs . unlinkSync ( dest ) ;
729
718
done ( ) ;
730
719
} ) ;
@@ -737,7 +726,7 @@ describe('cli', function() {
737
726
] ) ;
738
727
739
728
bin . once ( 'close' , function ( ) {
740
- assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expected ) ;
729
+ assert . equal ( read ( dest , 'utf8' ) . trim ( ) , expectedData ) ;
741
730
fs . unlinkSync ( dest ) ;
742
731
done ( ) ;
743
732
} ) ;
0 commit comments