Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
c3a53e01
Commit
c3a53e01
authored
Oct 30, 2014
by
Kevin Martensson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further Windows fixes
parent
e905e624
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
30 deletions
+45
-30
api.js
test/api.js
+31
-16
cli.js
test/cli.js
+14
-14
No files found.
test/api.js
View file @
c3a53e01
...
@@ -14,7 +14,7 @@ describe('api (deprecated)', function() {
...
@@ -14,7 +14,7 @@ describe('api (deprecated)', function() {
sass
.
render
(
src
,
function
(
err
,
css
)
{
sass
.
render
(
src
,
function
(
err
,
css
)
{
assert
(
!
err
);
assert
(
!
err
);
assert
.
equal
(
css
.
trim
(),
expected
);
assert
.
equal
(
css
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
)
);
done
();
done
();
});
});
});
});
...
@@ -32,7 +32,7 @@ describe('api (deprecated)', function() {
...
@@ -32,7 +32,7 @@ describe('api (deprecated)', function() {
var
src
=
read
(
fixture
(
'simple/index.scss'
),
'utf8'
);
var
src
=
read
(
fixture
(
'simple/index.scss'
),
'utf8'
);
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
assert
.
equal
(
sass
.
renderSync
(
src
).
trim
(),
expected
);
assert
.
equal
(
sass
.
renderSync
(
src
).
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
)
);
done
();
done
();
});
});
...
@@ -55,7 +55,7 @@ describe('api', function() {
...
@@ -55,7 +55,7 @@ describe('api', function() {
sass
.
render
({
sass
.
render
({
data
:
src
,
data
:
src
,
success
:
function
(
css
)
{
success
:
function
(
css
)
{
assert
.
equal
(
css
.
trim
(),
expected
);
assert
.
equal
(
css
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
)
);
done
();
done
();
}
}
});
});
...
@@ -83,7 +83,7 @@ describe('api', function() {
...
@@ -83,7 +83,7 @@ describe('api', function() {
fixture
(
'include-path/lib'
)
fixture
(
'include-path/lib'
)
],
],
success
:
function
(
css
)
{
success
:
function
(
css
)
{
assert
.
equal
(
css
.
trim
(),
expected
);
assert
.
equal
(
css
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
)
);
done
();
done
();
}
}
});
});
...
@@ -97,7 +97,7 @@ describe('api', function() {
...
@@ -97,7 +97,7 @@ describe('api', function() {
data
:
src
,
data
:
src
,
imagePath
:
'/path/to/images'
,
imagePath
:
'/path/to/images'
,
success
:
function
(
css
)
{
success
:
function
(
css
)
{
assert
.
equal
(
css
.
trim
(),
expected
);
assert
.
equal
(
css
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
)
);
done
();
done
();
}
}
});
});
...
@@ -124,7 +124,7 @@ describe('api', function() {
...
@@ -124,7 +124,7 @@ describe('api', function() {
data
:
src
,
data
:
src
,
precision
:
10
,
precision
:
10
,
success
:
function
(
css
)
{
success
:
function
(
css
)
{
assert
.
equal
(
css
.
trim
(),
expected
);
assert
.
equal
(
css
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
)
);
done
();
done
();
}
}
});
});
...
@@ -151,7 +151,7 @@ describe('api', function() {
...
@@ -151,7 +151,7 @@ describe('api', function() {
var
src
=
read
(
fixture
(
'simple/index.scss'
),
'utf8'
);
var
src
=
read
(
fixture
(
'simple/index.scss'
),
'utf8'
);
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
();
assert
.
equal
(
sass
.
renderSync
({
data
:
src
}).
trim
(),
expected
);
assert
.
equal
(
sass
.
renderSync
({
data
:
src
}).
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
)
);
done
();
done
();
});
});
...
@@ -174,7 +174,7 @@ describe('api', function() {
...
@@ -174,7 +174,7 @@ describe('api', function() {
data
:
src
,
data
:
src
,
outFile
:
dest
,
outFile
:
dest
,
success
:
function
()
{
success
:
function
()
{
assert
.
equal
(
read
(
dest
,
'utf8'
).
trim
(),
expected
);
assert
.
equal
(
read
(
dest
,
'utf8'
).
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
)
);
fs
.
unlinkSync
(
dest
);
fs
.
unlinkSync
(
dest
);
done
();
done
();
}
}
...
@@ -283,18 +283,26 @@ describe('api', function() {
...
@@ -283,18 +283,26 @@ describe('api', function() {
});
});
it
(
'should contain an array of all included files'
,
function
(
done
)
{
it
(
'should contain an array of all included files'
,
function
(
done
)
{
assert
.
equal
(
stats
.
includedFiles
[
0
],
resolveFixture
(
'include-files/bar.scss'
));
var
expected
=
[
assert
.
equal
(
stats
.
includedFiles
[
1
],
resolveFixture
(
'include-files/foo.scss'
));
fixture
(
'include-files/bar.scss'
).
replace
(
/
\\
/g
,
'/'
),
assert
.
equal
(
stats
.
includedFiles
[
2
],
resolveFixture
(
'include-files/index.scss'
));
fixture
(
'include-files/foo.scss'
).
replace
(
/
\\
/g
,
'/'
),
fixture
(
'include-files/index.scss'
).
replace
(
/
\\
/g
,
'/'
)
];
assert
.
equal
(
stats
.
includedFiles
[
0
],
expected
[
0
]);
assert
.
equal
(
stats
.
includedFiles
[
1
],
expected
[
1
]);
assert
.
equal
(
stats
.
includedFiles
[
2
],
expected
[
2
]);
done
();
done
();
});
});
it
(
'should contain array with the entry if there are no import statements'
,
function
(
done
)
{
it
(
'should contain array with the entry if there are no import statements'
,
function
(
done
)
{
var
expected
=
fixture
(
'simple/index.scss'
).
replace
(
/
\\
/g
,
'/'
);
sass
.
render
({
sass
.
render
({
file
:
fixture
(
'simple/index.scss'
),
file
:
fixture
(
'simple/index.scss'
),
stats
:
stats
,
stats
:
stats
,
success
:
function
()
{
success
:
function
()
{
assert
.
deepEqual
(
stats
.
includedFiles
,
[
resolveFixture
(
'simple/index.scss'
)
]);
assert
.
deepEqual
(
stats
.
includedFiles
,
[
expected
]);
done
();
done
();
}
}
});
});
...
@@ -358,19 +366,26 @@ describe('api', function() {
...
@@ -358,19 +366,26 @@ describe('api', function() {
});
});
it
(
'should contain an array of all included files'
,
function
(
done
)
{
it
(
'should contain an array of all included files'
,
function
(
done
)
{
assert
.
equal
(
stats
.
includedFiles
[
0
],
resolveFixture
(
'include-files/bar.scss'
));
var
expected
=
[
assert
.
equal
(
stats
.
includedFiles
[
1
],
resolveFixture
(
'include-files/foo.scss'
));
fixture
(
'include-files/bar.scss'
).
replace
(
/
\\
/g
,
'/'
),
assert
.
equal
(
stats
.
includedFiles
[
2
],
resolveFixture
(
'include-files/index.scss'
));
fixture
(
'include-files/foo.scss'
).
replace
(
/
\\
/g
,
'/'
),
fixture
(
'include-files/index.scss'
).
replace
(
/
\\
/g
,
'/'
)
];
assert
.
equal
(
stats
.
includedFiles
[
0
],
expected
[
0
]);
assert
.
equal
(
stats
.
includedFiles
[
1
],
expected
[
1
]);
assert
.
equal
(
stats
.
includedFiles
[
2
],
expected
[
2
]);
done
();
done
();
});
});
it
(
'should contain array with the entry if there are no import statements'
,
function
(
done
)
{
it
(
'should contain array with the entry if there are no import statements'
,
function
(
done
)
{
var
expected
=
fixture
(
'simple/index.scss'
).
replace
(
/
\\
/g
,
'/'
);
sass
.
renderSync
({
sass
.
renderSync
({
file
:
fixture
(
'simple/index.scss'
),
file
:
fixture
(
'simple/index.scss'
),
stats
:
stats
stats
:
stats
});
});
assert
.
deepEqual
(
stats
.
includedFiles
,
[
fixture
(
'simple/index.scss'
)
]);
assert
.
deepEqual
(
stats
.
includedFiles
,
[
expected
]);
done
();
done
();
});
});
...
...
test/cli.js
View file @
c3a53e01
...
@@ -10,12 +10,12 @@ describe('cli', function() {
...
@@ -10,12 +10,12 @@ describe('cli', function() {
describe
(
'node-sass < in.scss'
,
function
()
{
describe
(
'node-sass < in.scss'
,
function
()
{
it
(
'should read data from stdin'
,
function
(
done
)
{
it
(
'should read data from stdin'
,
function
(
done
)
{
var
src
=
fs
.
createReadStream
(
fixture
(
'simple/index.scss'
));
var
src
=
fs
.
createReadStream
(
fixture
(
'simple/index.scss'
));
var
expected
=
fixture
(
'simple/expected.css'
);
var
expected
=
read
(
fixture
(
'simple/expected.css'
),
'utf8'
).
trim
(
);
var
bin
=
spawn
(
cli
,
[
'--stdout'
]);
var
bin
=
spawn
(
cli
,
[
'--stdout'
]);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
.
equal
(
data
.
trim
(),
read
(
expected
,
'utf8'
).
trim
(
));
assert
.
equal
(
data
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
done
();
});
});
...
@@ -38,12 +38,12 @@ describe('cli', function() {
...
@@ -38,12 +38,12 @@ describe('cli', function() {
it
(
'should compile sass using the --indented-syntax option'
,
function
(
done
)
{
it
(
'should compile sass using the --indented-syntax option'
,
function
(
done
)
{
var
src
=
fs
.
createReadStream
(
fixture
(
'indent/index.sass'
));
var
src
=
fs
.
createReadStream
(
fixture
(
'indent/index.sass'
));
var
expected
=
fixture
(
'indent/expected.css'
);
var
expected
=
read
(
fixture
(
'indent/expected.css'
),
'utf8'
).
trim
(
);
var
bin
=
spawn
(
cli
,
[
'--stdout'
,
'--indented-syntax'
]);
var
bin
=
spawn
(
cli
,
[
'--stdout'
,
'--indented-syntax'
]);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
.
equal
(
data
.
trim
(),
read
(
expected
,
'utf8'
).
trim
(
));
assert
.
equal
(
data
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
done
();
});
});
...
@@ -52,12 +52,12 @@ describe('cli', function() {
...
@@ -52,12 +52,12 @@ describe('cli', function() {
it
(
'should compile with the --output-style option'
,
function
(
done
)
{
it
(
'should compile with the --output-style option'
,
function
(
done
)
{
var
src
=
fs
.
createReadStream
(
fixture
(
'compressed/index.scss'
));
var
src
=
fs
.
createReadStream
(
fixture
(
'compressed/index.scss'
));
var
expected
=
fixture
(
'compressed/expected.css'
);
var
expected
=
read
(
fixture
(
'compressed/expected.css'
),
'utf8'
).
trim
(
);
var
bin
=
spawn
(
cli
,
[
'--stdout'
,
'--output-style'
,
'compressed'
]);
var
bin
=
spawn
(
cli
,
[
'--stdout'
,
'--output-style'
,
'compressed'
]);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
.
equal
(
data
.
trim
(),
read
(
expected
,
'utf8'
).
trim
(
));
assert
.
equal
(
data
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
done
();
});
});
...
@@ -66,12 +66,12 @@ describe('cli', function() {
...
@@ -66,12 +66,12 @@ describe('cli', function() {
it
(
'should compile with the --source-comments option'
,
function
(
done
)
{
it
(
'should compile with the --source-comments option'
,
function
(
done
)
{
var
src
=
fs
.
createReadStream
(
fixture
(
'source-comments/index.scss'
));
var
src
=
fs
.
createReadStream
(
fixture
(
'source-comments/index.scss'
));
var
expected
=
fixture
(
'source-comments/expected.css'
);
var
expected
=
read
(
fixture
(
'source-comments/expected.css'
),
'utf8'
).
trim
(
);
var
bin
=
spawn
(
cli
,
[
'--stdout'
,
'--source-comments'
]);
var
bin
=
spawn
(
cli
,
[
'--stdout'
,
'--source-comments'
]);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
.
equal
(
data
.
trim
(),
read
(
expected
,
'utf8'
).
trim
(
));
assert
.
equal
(
data
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
done
();
});
});
...
@@ -80,12 +80,12 @@ describe('cli', function() {
...
@@ -80,12 +80,12 @@ describe('cli', function() {
it
(
'should compile with the --image-path option'
,
function
(
done
)
{
it
(
'should compile with the --image-path option'
,
function
(
done
)
{
var
src
=
fs
.
createReadStream
(
fixture
(
'image-path/index.scss'
));
var
src
=
fs
.
createReadStream
(
fixture
(
'image-path/index.scss'
));
var
expected
=
fixture
(
'image-path/expected.css'
);
var
expected
=
read
(
fixture
(
'image-path/expected.css'
),
'utf8'
).
trim
(
);
var
bin
=
spawn
(
cli
,
[
'--stdout'
,
'--image-path'
,
'/path/to/images'
]);
var
bin
=
spawn
(
cli
,
[
'--stdout'
,
'--image-path'
,
'/path/to/images'
]);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
.
equal
(
data
.
trim
(),
read
(
expected
,
'utf8'
).
trim
(
));
assert
.
equal
(
data
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
done
();
});
});
...
@@ -116,12 +116,12 @@ describe('cli', function() {
...
@@ -116,12 +116,12 @@ describe('cli', function() {
];
];
var
src
=
fixture
(
'include-path/index.scss'
);
var
src
=
fixture
(
'include-path/index.scss'
);
var
expected
=
fixture
(
'include-path/expected.css'
);
var
expected
=
read
(
fixture
(
'include-path/expected.css'
),
'utf8'
).
trim
(
);
var
bin
=
spawn
(
cli
,
[
src
,
'--stdout'
].
concat
(
includePaths
));
var
bin
=
spawn
(
cli
,
[
src
,
'--stdout'
].
concat
(
includePaths
));
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
.
equal
(
data
.
trim
(),
read
(
expected
,
'utf8'
).
trim
(
));
assert
.
equal
(
data
.
trim
(),
expected
.
replace
(
/
\r\n
/g
,
'
\
n'
));
done
();
done
();
});
});
});
});
...
@@ -162,12 +162,12 @@ describe('cli', function() {
...
@@ -162,12 +162,12 @@ describe('cli', function() {
it
(
'should compile with the --source-map option'
,
function
(
done
)
{
it
(
'should compile with the --source-map option'
,
function
(
done
)
{
var
src
=
fixture
(
'source-map/index.scss'
);
var
src
=
fixture
(
'source-map/index.scss'
);
var
dest
=
fixture
(
'source-map/build.css'
);
var
dest
=
fixture
(
'source-map/build.css'
);
var
expected
=
fixture
(
'source-map/expected.css'
);
var
expected
=
read
(
fixture
(
'source-map/expected.css'
),
'utf8'
).
trim
(
);
var
map
=
fixture
(
'source-map/index.map'
);
var
map
=
fixture
(
'source-map/index.map'
);
var
bin
=
spawn
(
cli
,
[
src
,
'--output'
,
dest
,
'--source-map'
,
map
]);
var
bin
=
spawn
(
cli
,
[
src
,
'--output'
,
dest
,
'--source-map'
,
map
]);
bin
.
on
(
'close'
,
function
()
{
bin
.
on
(
'close'
,
function
()
{
assert
.
equal
(
read
(
dest
,
'utf8'
).
trim
(),
read
(
expected
,
'utf8'
).
trim
()
);
assert
.
equal
(
read
(
dest
,
'utf8'
).
trim
(),
expected
);
assert
(
fs
.
existsSync
(
map
));
assert
(
fs
.
existsSync
(
map
));
fs
.
unlinkSync
(
map
);
fs
.
unlinkSync
(
map
);
fs
.
unlinkSync
(
dest
);
fs
.
unlinkSync
(
dest
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment