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
6cc2b695
Commit
6cc2b695
authored
Sep 05, 2013
by
Arian Stolwijk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve cli tests, fs.exists should be checked after writing the file
parent
4ad2e739
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
23 deletions
+14
-23
render.js
lib/render.js
+1
-0
cli.js
test/cli.js
+13
-23
No files found.
lib/render.js
View file @
6cc2b695
...
...
@@ -19,6 +19,7 @@ function render(options, emitter) {
fs
.
writeFile
(
options
.
outFile
,
css
,
function
(
err
)
{
if
(
err
)
return
emitter
.
emit
(
'error'
,
(
'Error: '
+
err
).
red
);
emitter
.
emit
(
'warn'
,
(
'Wrote CSS to '
+
options
.
outFile
).
green
);
emitter
.
emit
(
'write'
,
err
,
options
.
outFile
,
css
);
});
if
(
options
.
stdout
)
{
...
...
test/cli.js
View file @
6cc2b695
...
...
@@ -40,9 +40,8 @@ describe('cli', function() {
},
function
(
err
,
stdout
,
stderr
)
{
fs
.
exists
(
resultPath
,
function
(
exists
)
{
done
(
assert
(
exists
));
fs
.
unlink
(
resultPath
,
function
()
{});
assert
(
exists
);
fs
.
unlink
(
resultPath
,
done
);
});
});
});
...
...
@@ -55,53 +54,44 @@ describe('cli', function() {
},
function
(
err
,
stdout
,
stderr
)
{
fs
.
exists
(
resultPath
,
function
(
exists
)
{
done
(
assert
(
exists
));
fs
.
unlink
(
resultPath
,
function
()
{});
assert
(
exists
);
fs
.
unlink
(
resultPath
,
done
);
});
});
});
it
(
'should compile with --include-paths option'
,
function
(
done
){
var
emitter
=
cli
([
'--include-paths'
,
__dirname
+
'/lib'
,
__dirname
+
'/include_path.scss'
]);
emitter
.
on
(
'error'
,
function
(
err
){
done
(
err
);
});
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'render'
,
function
(
css
){
assert
.
equal
(
css
.
trim
(),
'body {
\
n background: red; }'
);
done
(
);
fs
.
unlink
(
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'
]);
emitter
.
on
(
'error'
,
function
(
err
){
done
(
err
);
});
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'render'
,
function
(
css
){
assert
.
equal
(
css
,
expectedSampleCompressed
);
done
(
);
fs
.
unlink
(
process
.
cwd
()
+
'/sample.css'
,
done
);
});
});
it
(
'should compile with the --source-comments option'
,
function
(
done
){
var
emitter
=
cli
([
'--source-comments'
,
'none'
,
__dirname
+
'/sample.scss'
]);
emitter
.
on
(
'error'
,
function
(
err
){
done
(
err
);
});
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'render'
,
function
(
css
){
assert
.
equal
(
css
,
expectedSampleNoComments
);
done
(
);
fs
.
unlink
(
process
.
cwd
()
+
'/sample.css'
,
done
);
});
});
it
(
'should write the output to the file specified with the --output option'
,
function
(
done
){
var
resultPath
=
path
.
resolve
(
__dirname
,
'..'
,
'output.css'
);
var
emitter
=
cli
([
'--output'
,
resultPath
,
__dirname
+
'/sample.scss'
]);
emitter
.
on
(
'error'
,
function
(
err
){
done
(
err
);
});
emitter
.
on
(
'render'
,
function
(
css
){
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'write'
,
function
(
css
){
fs
.
exists
(
resultPath
,
function
(
exists
)
{
assert
(
exists
);
fs
.
unlink
(
resultPath
,
done
);
...
...
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