This repository was archived by the owner on Dec 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ function cssnext(string, options) {
145145 if ( options . import !== false ) {
146146 postcssInstance . use ( require ( "postcss-import" ) (
147147 typeof options . import === "object"
148- ? options . import
148+ ? assign ( { } , options . import )
149149 : undefined
150150 )
151151 )
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ test("cssnext import option", function(t) {
1414 options : utils . readFixture ( "import.options.expected" ) . trim ( ) ,
1515 }
1616 var opts = { from : "test/fixtures/here" }
17+ function transformFn ( c ) {
18+ return c + "\n new {}"
19+ }
1720 t . equal (
1821 cssnext ( input , opts ) . trim ( ) ,
1922 expected . default ,
@@ -23,9 +26,7 @@ test("cssnext import option", function(t) {
2326 cssnext ( input , {
2427 from : opts . from ,
2528 import : {
26- transform : function ( c ) {
27- return c + "\n new {}"
28- } ,
29+ transform : transformFn ,
2930 } ,
3031 } ) . trim ( ) ,
3132 expected . options ,
@@ -36,6 +37,18 @@ test("cssnext import option", function(t) {
3637 expected . default ,
3738 "should be able to import even as a postcss plugin"
3839 )
39-
40+ var importOpt = {
41+ transform : transformFn ,
42+ }
43+ Object . freeze ( importOpt )
44+ t . doesNotThrow ( function ( ) {
45+ cssnext ( input , {
46+ from : opts . from ,
47+ import : importOpt ,
48+ } ) . trim ( )
49+ } ,
50+ expected . options ,
51+ "should not use original object as option"
52+ )
4053 t . end ( )
4154} )
You can’t perform that action at this time.
0 commit comments