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
7128b45e
Commit
7128b45e
authored
Dec 22, 2015
by
Michael Mifsud
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1307 from saper/strict-equal
Use assert.strictEqual in tests for better error output
parents
2ff29a95
093b9126
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
37 deletions
+36
-37
api.js
test/api.js
+27
-28
cli.js
test/cli.js
+9
-9
No files found.
test/api.js
View file @
7128b45e
...
@@ -956,26 +956,25 @@ describe('api', function() {
...
@@ -956,26 +956,25 @@ describe('api', function() {
data
:
'div { color: foo(bar(null)); background-color: baz("foo" == "bar"); }'
,
data
:
'div { color: foo(bar(null)); background-color: baz("foo" == "bar"); }'
,
functions
:
{
functions
:
{
foo
:
function
(
a
)
{
foo
:
function
(
a
)
{
assert
.
ok
(
assert
.
strictEqual
(
a
,
sass
.
TRUE
,
'Supplied value should be the same instance as sass.TRUE'
,
'Supplied value should be the same instance as sass.TRUE'
a
===
sass
.
TRUE
);
);
assert
.
ok
(
assert
.
strictEqual
(
'sass.types.Boolean(true) should return a singleton'
,
sass
.
types
.
Boolean
(
true
),
sass
.
types
.
Boolean
(
true
),
sass
.
types
.
Boolean
(
true
)
===
sass
.
types
.
Boolean
(
true
)
&&
'sass.types.Boolean(true) should return a singleton'
);
sass
.
types
.
Boolean
(
true
)
===
sass
.
TRUE
);
assert
.
strictEqual
(
sass
.
types
.
Boolean
(
true
),
sass
.
TRUE
,
'sass.types.Boolean(true) should be the same instance as sass.TRUE'
);
counter
++
;
counter
++
;
return
sass
.
types
.
String
(
'foo'
);
return
sass
.
types
.
String
(
'foo'
);
},
},
bar
:
function
(
a
)
{
bar
:
function
(
a
)
{
assert
.
ok
(
assert
.
strictEqual
(
a
,
sass
.
NULL
,
'Supplied value should be the same instance as sass.NULL'
,
'Supplied value should be the same instance as sass.NULL'
);
a
===
sass
.
NULL
);
assert
.
throws
(
function
()
{
assert
.
throws
(
function
()
{
return
new
sass
.
types
.
Null
();
return
new
sass
.
types
.
Null
();
...
@@ -986,20 +985,20 @@ describe('api', function() {
...
@@ -986,20 +985,20 @@ describe('api', function() {
return
sass
.
TRUE
;
return
sass
.
TRUE
;
},
},
baz
:
function
(
a
)
{
baz
:
function
(
a
)
{
assert
.
ok
(
assert
.
strictEqual
(
a
,
sass
.
FALSE
,
'Supplied value should be the same instance as sass.FALSE'
,
'Supplied value should be the same instance as sass.FALSE'
);
a
===
sass
.
FALSE
);
assert
.
throws
(
function
()
{
assert
.
throws
(
function
()
{
return
new
sass
.
types
.
Boolean
(
false
);
return
new
sass
.
types
.
Boolean
(
false
);
},
/Cannot instantiate SassBoolean/
);
},
/Cannot instantiate SassBoolean/
);
assert
.
ok
(
assert
.
strictEqual
(
'sass.types.Boolean(false) should return a singleton'
,
sass
.
types
.
Boolean
(
false
),
sass
.
types
.
Boolean
(
false
),
sass
.
types
.
Boolean
(
false
)
===
sass
.
types
.
Boolean
(
false
)
&&
'sass.types.Boolean(false) should return a singleton'
);
sass
.
types
.
Boolean
(
false
)
===
sass
.
FALSE
);
assert
.
strictEqual
(
sass
.
types
.
Boolean
(
false
),
sass
.
FALSE
,
'sass.types.Boolean(false) should return singleton identical to sass.FALSE'
);
counter
++
;
counter
++
;
...
@@ -1007,7 +1006,7 @@ describe('api', function() {
...
@@ -1007,7 +1006,7 @@ describe('api', function() {
}
}
}
}
},
function
()
{
},
function
()
{
assert
.
ok
(
counter
===
3
);
assert
.
strictEqual
(
counter
,
3
);
done
();
done
();
});
});
});
});
...
@@ -1021,7 +1020,7 @@ describe('api', function() {
...
@@ -1021,7 +1020,7 @@ describe('api', function() {
file
:
fixture
(
'include-files/index.scss'
)
file
:
fixture
(
'include-files/index.scss'
)
},
function
(
error
,
result
)
{
},
function
(
error
,
result
)
{
assert
(
!
error
);
assert
(
!
error
);
assert
(
typeof
result
.
stats
.
start
===
'number'
);
assert
.
strictEqual
(
typeof
result
.
stats
.
start
,
'number'
);
assert
(
result
.
stats
.
start
>=
start
);
assert
(
result
.
stats
.
start
>=
start
);
done
();
done
();
});
});
...
@@ -1032,7 +1031,7 @@ describe('api', function() {
...
@@ -1032,7 +1031,7 @@ describe('api', function() {
file
:
fixture
(
'include-files/index.scss'
)
file
:
fixture
(
'include-files/index.scss'
)
},
function
(
error
,
result
)
{
},
function
(
error
,
result
)
{
assert
(
!
error
);
assert
(
!
error
);
assert
(
typeof
result
.
stats
.
end
===
'number'
);
assert
.
strictEqual
(
typeof
result
.
stats
.
end
,
'number'
);
assert
(
result
.
stats
.
end
>=
result
.
stats
.
start
);
assert
(
result
.
stats
.
end
>=
result
.
stats
.
start
);
done
();
done
();
});
});
...
@@ -1043,7 +1042,7 @@ describe('api', function() {
...
@@ -1043,7 +1042,7 @@ describe('api', function() {
file
:
fixture
(
'include-files/index.scss'
)
file
:
fixture
(
'include-files/index.scss'
)
},
function
(
error
,
result
)
{
},
function
(
error
,
result
)
{
assert
(
!
error
);
assert
(
!
error
);
assert
(
typeof
result
.
stats
.
duration
===
'number'
);
assert
.
strictEqual
(
typeof
result
.
stats
.
duration
,
'number'
);
assert
.
equal
(
result
.
stats
.
end
-
result
.
stats
.
start
,
result
.
stats
.
duration
);
assert
.
equal
(
result
.
stats
.
end
-
result
.
stats
.
start
,
result
.
stats
.
duration
);
done
();
done
();
});
});
...
@@ -1504,19 +1503,19 @@ describe('api', function() {
...
@@ -1504,19 +1503,19 @@ describe('api', function() {
});
});
it
(
'should provide a start timestamp'
,
function
(
done
)
{
it
(
'should provide a start timestamp'
,
function
(
done
)
{
assert
(
typeof
result
.
stats
.
start
===
'number'
);
assert
.
strictEqual
(
typeof
result
.
stats
.
start
,
'number'
);
assert
(
result
.
stats
.
start
>=
start
);
assert
(
result
.
stats
.
start
>=
start
);
done
();
done
();
});
});
it
(
'should provide an end timestamp'
,
function
(
done
)
{
it
(
'should provide an end timestamp'
,
function
(
done
)
{
assert
(
typeof
result
.
stats
.
end
===
'number'
);
assert
.
strictEqual
(
typeof
result
.
stats
.
end
,
'number'
);
assert
(
result
.
stats
.
end
>=
result
.
stats
.
start
);
assert
(
result
.
stats
.
end
>=
result
.
stats
.
start
);
done
();
done
();
});
});
it
(
'should provide a duration'
,
function
(
done
)
{
it
(
'should provide a duration'
,
function
(
done
)
{
assert
(
typeof
result
.
stats
.
duration
===
'number'
);
assert
.
strictEqual
(
typeof
result
.
stats
.
duration
,
'number'
);
assert
.
equal
(
result
.
stats
.
end
-
result
.
stats
.
start
,
result
.
stats
.
duration
);
assert
.
equal
(
result
.
stats
.
end
-
result
.
stats
.
start
,
result
.
stats
.
duration
);
done
();
done
();
});
});
...
...
test/cli.js
View file @
7128b45e
...
@@ -244,7 +244,7 @@ describe('cli', function() {
...
@@ -244,7 +244,7 @@ describe('cli', function() {
bin
.
stderr
.
setEncoding
(
'utf8'
);
bin
.
stderr
.
setEncoding
(
'utf8'
);
bin
.
stderr
.
once
(
'data'
,
function
(
data
)
{
bin
.
stderr
.
once
(
'data'
,
function
(
data
)
{
assert
(
data
.
trim
()
===
'=> changed: '
+
src
);
assert
.
strictEqual
(
data
.
trim
(),
'=> changed: '
+
src
);
fs
.
unlinkSync
(
src
);
fs
.
unlinkSync
(
src
);
bin
.
kill
();
bin
.
kill
();
done
();
done
();
...
@@ -290,7 +290,7 @@ describe('cli', function() {
...
@@ -290,7 +290,7 @@ describe('cli', function() {
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
(
data
.
trim
()
===
'body{background:white}'
);
assert
.
strictEqual
(
data
.
trim
(),
'body{background:white}'
);
fs
.
unlinkSync
(
src
);
fs
.
unlinkSync
(
src
);
bin
.
kill
();
bin
.
kill
();
done
();
done
();
...
@@ -314,7 +314,7 @@ describe('cli', function() {
...
@@ -314,7 +314,7 @@ describe('cli', function() {
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
.
e
qual
(
data
.
trim
(),
'body{background:blue}'
);
assert
.
strictE
qual
(
data
.
trim
(),
'body{background:blue}'
);
bin
.
kill
();
bin
.
kill
();
done
();
done
();
});
});
...
@@ -337,7 +337,7 @@ describe('cli', function() {
...
@@ -337,7 +337,7 @@ describe('cli', function() {
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
setEncoding
(
'utf8'
);
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
bin
.
stdout
.
once
(
'data'
,
function
(
data
)
{
assert
.
e
qual
(
data
.
trim
(),
'body{background:red}'
);
assert
.
strictE
qual
(
data
.
trim
(),
'body{background:red}'
);
bin
.
kill
();
bin
.
kill
();
done
();
done
();
});
});
...
@@ -442,7 +442,7 @@ describe('cli', function() {
...
@@ -442,7 +442,7 @@ describe('cli', function() {
]);
]);
bin
.
once
(
'close'
,
function
()
{
bin
.
once
(
'close'
,
function
()
{
assert
(
read
(
dest
,
'utf8'
).
indexOf
(
'sourceMappingURL'
)
===
-
1
);
assert
.
strictEqual
(
read
(
dest
,
'utf8'
).
indexOf
(
'sourceMappingURL'
),
-
1
);
assert
(
fs
.
existsSync
(
map
));
assert
(
fs
.
existsSync
(
map
));
fs
.
unlinkSync
(
map
);
fs
.
unlinkSync
(
map
);
fs
.
unlinkSync
(
dest
);
fs
.
unlinkSync
(
dest
);
...
@@ -570,8 +570,8 @@ describe('cli', function() {
...
@@ -570,8 +570,8 @@ describe('cli', function() {
var
bin
=
spawn
(
cli
,
[
src
]);
var
bin
=
spawn
(
cli
,
[
src
]);
bin
.
once
(
'close'
,
function
(
code
)
{
bin
.
once
(
'close'
,
function
(
code
)
{
assert
(
code
!==
0
);
assert
.
notStrictEqual
(
code
,
0
);
assert
.
e
qual
(
glob
.
sync
(
fixture
(
'input-directory/**/*.css'
)).
length
,
0
);
assert
.
strictE
qual
(
glob
.
sync
(
fixture
(
'input-directory/**/*.css'
)).
length
,
0
);
done
();
done
();
});
});
});
});
...
@@ -582,7 +582,7 @@ describe('cli', function() {
...
@@ -582,7 +582,7 @@ describe('cli', function() {
var
bin
=
spawn
(
cli
,
[
src
,
'--output'
,
dest
]);
var
bin
=
spawn
(
cli
,
[
src
,
'--output'
,
dest
]);
bin
.
once
(
'close'
,
function
(
code
)
{
bin
.
once
(
'close'
,
function
(
code
)
{
assert
(
code
!==
0
);
assert
.
notStrictEqual
(
code
,
0
);
assert
.
equal
(
glob
.
sync
(
fixture
(
'input-directory/**/*.css'
)).
length
,
0
);
assert
.
equal
(
glob
.
sync
(
fixture
(
'input-directory/**/*.css'
)).
length
,
0
);
done
();
done
();
});
});
...
@@ -745,7 +745,7 @@ describe('cli', function() {
...
@@ -745,7 +745,7 @@ describe('cli', function() {
]);
]);
bin
.
once
(
'close'
,
function
(
code
)
{
bin
.
once
(
'close'
,
function
(
code
)
{
assert
(
code
!==
0
);
assert
.
notStrictEqual
(
code
,
0
);
done
();
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