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
24f0725a
Commit
24f0725a
authored
Oct 01, 2013
by
Andrew Nesbitt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #160 from LaurentGoderre/fix-tests-windows
Fixed the test suite in Windows
parents
a3c1124c
45acd4e0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
23 deletions
+21
-23
render.js
lib/render.js
+4
-6
cli.js
test/cli.js
+17
-17
No files found.
lib/render.js
View file @
24f0725a
...
@@ -20,13 +20,11 @@ function render(options, emitter) {
...
@@ -20,13 +20,11 @@ function render(options, emitter) {
if
(
err
)
return
emitter
.
emit
(
'error'
,
(
'Error: '
+
err
).
red
);
if
(
err
)
return
emitter
.
emit
(
'error'
,
(
'Error: '
+
err
).
red
);
emitter
.
emit
(
'warn'
,
(
'Wrote CSS to '
+
options
.
outFile
).
green
);
emitter
.
emit
(
'warn'
,
(
'Wrote CSS to '
+
options
.
outFile
).
green
);
emitter
.
emit
(
'write'
,
err
,
options
.
outFile
,
css
);
emitter
.
emit
(
'write'
,
err
,
options
.
outFile
,
css
);
if
(
options
.
stdout
)
{
emitter
.
emit
(
'log'
,
css
);
}
emitter
.
emit
(
'render'
,
css
);
});
});
if
(
options
.
stdout
)
{
emitter
.
emit
(
'log'
,
css
);
}
emitter
.
emit
(
'render'
,
css
);
},
},
error
:
function
(
error
)
{
error
:
function
(
error
)
{
emitter
.
emit
(
'error'
,
error
);
emitter
.
emit
(
'error'
,
error
);
...
...
test/cli.js
View file @
24f0725a
...
@@ -2,10 +2,10 @@ var path = require('path'),
...
@@ -2,10 +2,10 @@ var path = require('path'),
assert
=
require
(
'assert'
),
assert
=
require
(
'assert'
),
fs
=
require
(
'fs'
),
fs
=
require
(
'fs'
),
exec
=
require
(
'child_process'
).
exec
,
exec
=
require
(
'child_process'
).
exec
,
sass
=
require
(
path
.
join
(
__dirname
,
'..'
,
'sass'
)
),
sass
=
require
(
'../sass'
),
cli
=
require
(
path
.
join
(
__dirname
,
'..'
,
'lib'
,
'cli'
)
),
cli
=
require
(
'../lib/cli'
),
cliPath
=
path
.
resolve
(
__dirname
,
'..
'
,
'bin'
,
'
node-sass'
),
cliPath
=
path
.
resolve
(
__dirname
,
'..
/bin/
node-sass'
),
sampleFilename
=
path
.
resolve
(
__dirname
,
'sample.scss'
);
sampleFilename
=
path
.
resolve
(
__dirname
,
'sample.scss'
);
var
expectedSampleCompressed
=
'#navbar {width:80%;height:23px;}
\
var
expectedSampleCompressed
=
'#navbar {width:80%;height:23px;}
\
...
@@ -27,7 +27,7 @@ var expectedSampleNoComments = '#navbar {\n\
...
@@ -27,7 +27,7 @@ var expectedSampleNoComments = '#navbar {\n\
describe
(
'cli'
,
function
()
{
describe
(
'cli'
,
function
()
{
it
(
'should print help when run with no arguments'
,
function
(
done
)
{
it
(
'should print help when run with no arguments'
,
function
(
done
)
{
exec
(
cliPath
,
function
(
err
,
stdout
,
stderr
)
{
exec
(
'node '
+
cliPath
,
function
(
err
,
stdout
,
stderr
)
{
done
(
assert
(
stderr
.
indexOf
(
'Compile .scss files with node-sass'
)
===
0
));
done
(
assert
(
stderr
.
indexOf
(
'Compile .scss files with node-sass'
)
===
0
));
});
});
});
});
...
@@ -35,7 +35,7 @@ describe('cli', function() {
...
@@ -35,7 +35,7 @@ describe('cli', function() {
it
(
'should compile sample.scss as sample.css'
,
function
(
done
)
{
it
(
'should compile sample.scss as sample.css'
,
function
(
done
)
{
var
resultPath
=
path
.
join
(
__dirname
,
'sample.css'
);
var
resultPath
=
path
.
join
(
__dirname
,
'sample.css'
);
exec
(
cliPath
+
' '
+
sampleFilename
,
{
exec
(
'node '
+
cliPath
+
' '
+
sampleFilename
,
{
cwd
:
__dirname
cwd
:
__dirname
},
function
(
err
,
stdout
,
stderr
)
{
},
function
(
err
,
stdout
,
stderr
)
{
...
@@ -47,9 +47,9 @@ describe('cli', function() {
...
@@ -47,9 +47,9 @@ describe('cli', function() {
});
});
it
(
'should compile sample.scss to ../out.css'
,
function
(
done
)
{
it
(
'should compile sample.scss to ../out.css'
,
function
(
done
)
{
var
resultPath
=
path
.
resolve
(
__dirname
,
'..
'
,
'
out.css'
);
var
resultPath
=
path
.
resolve
(
__dirname
,
'..
/
out.css'
);
exec
(
cliPath
+
' '
+
sampleFilename
+
' ../out.css'
,
{
exec
(
'node '
+
cliPath
+
' '
+
sampleFilename
+
' ../out.css'
,
{
cwd
:
__dirname
cwd
:
__dirname
},
function
(
err
,
stdout
,
stderr
)
{
},
function
(
err
,
stdout
,
stderr
)
{
...
@@ -62,38 +62,38 @@ describe('cli', function() {
...
@@ -62,38 +62,38 @@ describe('cli', function() {
it
(
'should compile with --include-path option'
,
function
(
done
){
it
(
'should compile with --include-path option'
,
function
(
done
){
var
emitter
=
cli
([
var
emitter
=
cli
([
'--include-path'
,
path
.
join
(
__dirname
,
'
/
lib'
),
'--include-path'
,
path
.
join
(
__dirname
,
'lib'
),
'--include-path'
,
path
.
join
(
__dirname
,
'
/
functions'
),
'--include-path'
,
path
.
join
(
__dirname
,
'functions'
),
path
.
join
(
__dirname
,
'
/
include_path.scss'
)
path
.
join
(
__dirname
,
'include_path.scss'
)
]);
]);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'render'
,
function
(
css
){
emitter
.
on
(
'render'
,
function
(
css
){
assert
.
equal
(
css
.
trim
(),
'body {
\
n background: red;
\
n color: blue; }'
);
assert
.
equal
(
css
.
trim
(),
'body {
\
n background: red;
\
n color: blue; }'
);
fs
.
unlink
(
p
rocess
.
cwd
()
+
'/include_path.css'
,
done
);
fs
.
unlink
(
p
ath
.
resolve
(
process
.
cwd
(),
'include_path.css'
)
,
done
);
});
});
});
});
it
(
'should compile with the --output-style'
,
function
(
done
){
it
(
'should compile with the --output-style'
,
function
(
done
){
var
emitter
=
cli
([
'--output-style'
,
'compressed'
,
__dirname
+
'/sample.scss'
]);
var
emitter
=
cli
([
'--output-style'
,
'compressed'
,
path
.
join
(
__dirname
,
'sample.scss'
)
]);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'render'
,
function
(
css
){
emitter
.
on
(
'render'
,
function
(
css
){
assert
.
equal
(
css
,
expectedSampleCompressed
);
assert
.
equal
(
css
,
expectedSampleCompressed
);
fs
.
unlink
(
p
rocess
.
cwd
()
+
'/sample.css'
,
done
);
fs
.
unlink
(
p
ath
.
resolve
(
process
.
cwd
(),
'sample.css'
)
,
done
);
});
});
});
});
it
(
'should compile with the --source-comments option'
,
function
(
done
){
it
(
'should compile with the --source-comments option'
,
function
(
done
){
var
emitter
=
cli
([
'--source-comments'
,
'none'
,
__dirname
+
'/sample.scss'
]);
var
emitter
=
cli
([
'--source-comments'
,
'none'
,
path
.
join
(
__dirname
,
'sample.scss'
)
]);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'render'
,
function
(
css
){
emitter
.
on
(
'render'
,
function
(
css
){
assert
.
equal
(
css
,
expectedSampleNoComments
);
assert
.
equal
(
css
,
expectedSampleNoComments
);
fs
.
unlink
(
p
rocess
.
cwd
()
+
'/sample.css'
,
done
);
fs
.
unlink
(
p
ath
.
resolve
(
process
.
cwd
(),
'sample.css'
)
,
done
);
});
});
});
});
it
(
'should write the output to the file specified with the --output option'
,
function
(
done
){
it
(
'should write the output to the file specified with the --output option'
,
function
(
done
){
var
resultPath
=
path
.
resolve
(
__dirname
,
'..'
,
'
output.css'
);
var
resultPath
=
path
.
join
(
__dirname
,
'../
output.css'
);
var
emitter
=
cli
([
'--output'
,
resultPath
,
__dirname
+
'/sample.scss'
]);
var
emitter
=
cli
([
'--output'
,
resultPath
,
path
.
join
(
__dirname
,
'sample.scss'
)
]);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'write'
,
function
(
css
){
emitter
.
on
(
'write'
,
function
(
css
){
fs
.
exists
(
resultPath
,
function
(
exists
)
{
fs
.
exists
(
resultPath
,
function
(
exists
)
{
...
...
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