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
97cd61a9
Commit
97cd61a9
authored
Nov 07, 2016
by
xzyfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary require.cache munging in runtime test
parent
d569bd9b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
27 deletions
+8
-27
runtime.js
test/runtime.js
+8
-27
No files found.
test/runtime.js
View file @
97cd61a9
var
assert
=
require
(
'assert'
),
var
assert
=
require
(
'assert'
),
extensionsPath
=
process
.
env
.
NODESASS_COV
sass
=
process
.
env
.
NODESASS_COV
?
require
.
resolve
(
'../lib-cov/extensions'
)
?
require
(
'../lib-cov/extensions'
)
:
require
.
resolve
(
'../lib/extensions'
);
:
require
(
'../lib/extensions'
);
describe
(
'runtime parameters'
,
function
()
{
describe
(
'runtime parameters'
,
function
()
{
var
p
ackagePath
=
require
.
resolv
e
(
'../package'
),
var
p
kg
=
requir
e
(
'../package'
),
// Let's use JSON to fake a deep copy
// Let's use JSON to fake a deep copy
savedArgv
=
JSON
.
stringify
(
process
.
argv
),
savedArgv
=
JSON
.
stringify
(
process
.
argv
),
savedEnv
=
JSON
.
stringify
(
process
.
env
);
savedEnv
=
JSON
.
stringify
(
process
.
env
);
beforeEach
(
function
()
{
require
(
packagePath
);
delete
require
.
cache
[
extensionsPath
];
});
afterEach
(
function
()
{
afterEach
(
function
()
{
delete
require
.
cache
[
packagePath
];
delete
require
.
cache
[
extensionsPath
];
process
.
argv
=
JSON
.
parse
(
savedArgv
);
process
.
argv
=
JSON
.
parse
(
savedArgv
);
process
.
env
=
JSON
.
parse
(
savedEnv
);
process
.
env
=
JSON
.
parse
(
savedEnv
);
require
(
packagePath
)
;
delete
pkg
.
nodeSassConfig
;
});
});
describe
(
'configuration precedence should be respected'
,
function
()
{
describe
(
'configuration precedence should be respected'
,
function
()
{
...
@@ -29,24 +22,21 @@ describe('runtime parameters', function() {
...
@@ -29,24 +22,21 @@ describe('runtime parameters', function() {
process
.
argv
.
push
(
'--sass-binary-name'
,
'aaa'
);
process
.
argv
.
push
(
'--sass-binary-name'
,
'aaa'
);
process
.
env
.
SASS_BINARY_NAME
=
'bbb'
;
process
.
env
.
SASS_BINARY_NAME
=
'bbb'
;
process
.
env
.
npm_config_sass_binary_name
=
'ccc'
;
process
.
env
.
npm_config_sass_binary_name
=
'ccc'
;
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryName
:
'ddd'
};
pkg
.
nodeSassConfig
=
{
binaryName
:
'ddd'
};
});
});
it
(
'command line argument'
,
function
()
{
it
(
'command line argument'
,
function
()
{
var
sass
=
require
(
extensionsPath
);
assert
.
equal
(
sass
.
getBinaryName
(),
'aaa_binding.node'
);
assert
.
equal
(
sass
.
getBinaryName
(),
'aaa_binding.node'
);
});
});
it
(
'environment variable'
,
function
()
{
it
(
'environment variable'
,
function
()
{
process
.
argv
=
[];
process
.
argv
=
[];
var
sass
=
require
(
extensionsPath
);
assert
.
equal
(
sass
.
getBinaryName
(),
'bbb_binding.node'
);
assert
.
equal
(
sass
.
getBinaryName
(),
'bbb_binding.node'
);
});
});
it
(
'npm config variable'
,
function
()
{
it
(
'npm config variable'
,
function
()
{
process
.
argv
=
[];
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_NAME
=
null
;
process
.
env
.
SASS_BINARY_NAME
=
null
;
var
sass
=
require
(
extensionsPath
);
assert
.
equal
(
sass
.
getBinaryName
(),
'ccc_binding.node'
);
assert
.
equal
(
sass
.
getBinaryName
(),
'ccc_binding.node'
);
});
});
...
@@ -54,7 +44,6 @@ describe('runtime parameters', function() {
...
@@ -54,7 +44,6 @@ describe('runtime parameters', function() {
process
.
argv
=
[];
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_NAME
=
null
;
process
.
env
.
SASS_BINARY_NAME
=
null
;
process
.
env
.
npm_config_sass_binary_name
=
null
;
process
.
env
.
npm_config_sass_binary_name
=
null
;
var
sass
=
require
(
extensionsPath
);
assert
.
equal
(
sass
.
getBinaryName
(),
'ddd_binding.node'
);
assert
.
equal
(
sass
.
getBinaryName
(),
'ddd_binding.node'
);
});
});
});
});
...
@@ -64,18 +53,16 @@ describe('runtime parameters', function() {
...
@@ -64,18 +53,16 @@ describe('runtime parameters', function() {
process
.
argv
.
push
(
'--sass-binary-site'
,
'http://aaa.example.com:9999'
);
process
.
argv
.
push
(
'--sass-binary-site'
,
'http://aaa.example.com:9999'
);
process
.
env
.
SASS_BINARY_SITE
=
'http://bbb.example.com:8888'
;
process
.
env
.
SASS_BINARY_SITE
=
'http://bbb.example.com:8888'
;
process
.
env
.
npm_config_sass_binary_site
=
'http://ccc.example.com:7777'
;
process
.
env
.
npm_config_sass_binary_site
=
'http://ccc.example.com:7777'
;
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binarySite
:
'http://ddd.example.com:6666'
};
pkg
.
nodeSassConfig
=
{
binarySite
:
'http://ddd.example.com:6666'
};
});
});
it
(
'command line argument'
,
function
()
{
it
(
'command line argument'
,
function
()
{
var
sass
=
require
(
extensionsPath
);
var
URL
=
'http://aaa.example.com:9999'
;
var
URL
=
'http://aaa.example.com:9999'
;
assert
.
equal
(
sass
.
getBinaryUrl
().
substr
(
0
,
URL
.
length
),
URL
);
assert
.
equal
(
sass
.
getBinaryUrl
().
substr
(
0
,
URL
.
length
),
URL
);
});
});
it
(
'environment variable'
,
function
()
{
it
(
'environment variable'
,
function
()
{
process
.
argv
=
[];
process
.
argv
=
[];
var
sass
=
require
(
extensionsPath
);
var
URL
=
'http://bbb.example.com:8888'
;
var
URL
=
'http://bbb.example.com:8888'
;
assert
.
equal
(
sass
.
getBinaryUrl
().
substr
(
0
,
URL
.
length
),
URL
);
assert
.
equal
(
sass
.
getBinaryUrl
().
substr
(
0
,
URL
.
length
),
URL
);
});
});
...
@@ -83,7 +70,6 @@ describe('runtime parameters', function() {
...
@@ -83,7 +70,6 @@ describe('runtime parameters', function() {
it
(
'npm config variable'
,
function
()
{
it
(
'npm config variable'
,
function
()
{
process
.
argv
=
[];
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_SITE
=
null
;
process
.
env
.
SASS_BINARY_SITE
=
null
;
var
sass
=
require
(
extensionsPath
);
var
URL
=
'http://ccc.example.com:7777'
;
var
URL
=
'http://ccc.example.com:7777'
;
assert
.
equal
(
sass
.
getBinaryUrl
().
substr
(
0
,
URL
.
length
),
URL
);
assert
.
equal
(
sass
.
getBinaryUrl
().
substr
(
0
,
URL
.
length
),
URL
);
});
});
...
@@ -92,7 +78,6 @@ describe('runtime parameters', function() {
...
@@ -92,7 +78,6 @@ describe('runtime parameters', function() {
process
.
argv
=
[];
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_SITE
=
null
;
process
.
env
.
SASS_BINARY_SITE
=
null
;
process
.
env
.
npm_config_sass_binary_site
=
null
;
process
.
env
.
npm_config_sass_binary_site
=
null
;
var
sass
=
require
(
extensionsPath
);
var
URL
=
'http://ddd.example.com:6666'
;
var
URL
=
'http://ddd.example.com:6666'
;
assert
.
equal
(
sass
.
getBinaryUrl
().
substr
(
0
,
URL
.
length
),
URL
);
assert
.
equal
(
sass
.
getBinaryUrl
().
substr
(
0
,
URL
.
length
),
URL
);
});
});
...
@@ -103,24 +88,21 @@ describe('runtime parameters', function() {
...
@@ -103,24 +88,21 @@ describe('runtime parameters', function() {
process
.
argv
.
push
(
'--sass-binary-path'
,
'aaa_binding.node'
);
process
.
argv
.
push
(
'--sass-binary-path'
,
'aaa_binding.node'
);
process
.
env
.
SASS_BINARY_PATH
=
'bbb_binding.node'
;
process
.
env
.
SASS_BINARY_PATH
=
'bbb_binding.node'
;
process
.
env
.
npm_config_sass_binary_path
=
'ccc_binding.node'
;
process
.
env
.
npm_config_sass_binary_path
=
'ccc_binding.node'
;
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryPath
:
'ddd_binding.node'
};
pkg
.
nodeSassConfig
=
{
binaryPath
:
'ddd_binding.node'
};
});
});
it
(
'command line argument'
,
function
()
{
it
(
'command line argument'
,
function
()
{
var
sass
=
require
(
extensionsPath
);
assert
.
equal
(
sass
.
getBinaryPath
(),
'aaa_binding.node'
);
assert
.
equal
(
sass
.
getBinaryPath
(),
'aaa_binding.node'
);
});
});
it
(
'environment variable'
,
function
()
{
it
(
'environment variable'
,
function
()
{
process
.
argv
=
[];
process
.
argv
=
[];
var
sass
=
require
(
extensionsPath
);
assert
.
equal
(
sass
.
getBinaryPath
(),
'bbb_binding.node'
);
assert
.
equal
(
sass
.
getBinaryPath
(),
'bbb_binding.node'
);
});
});
it
(
'npm config variable'
,
function
()
{
it
(
'npm config variable'
,
function
()
{
process
.
argv
=
[];
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_PATH
=
null
;
process
.
env
.
SASS_BINARY_PATH
=
null
;
var
sass
=
require
(
extensionsPath
);
assert
.
equal
(
sass
.
getBinaryPath
(),
'ccc_binding.node'
);
assert
.
equal
(
sass
.
getBinaryPath
(),
'ccc_binding.node'
);
});
});
...
@@ -128,7 +110,6 @@ describe('runtime parameters', function() {
...
@@ -128,7 +110,6 @@ describe('runtime parameters', function() {
process
.
argv
=
[];
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_PATH
=
null
;
process
.
env
.
SASS_BINARY_PATH
=
null
;
process
.
env
.
npm_config_sass_binary_path
=
null
;
process
.
env
.
npm_config_sass_binary_path
=
null
;
var
sass
=
require
(
extensionsPath
);
assert
.
equal
(
sass
.
getBinaryPath
(),
'ddd_binding.node'
);
assert
.
equal
(
sass
.
getBinaryPath
(),
'ddd_binding.node'
);
});
});
});
});
...
...
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