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
1a43930d
Commit
1a43930d
authored
Sep 16, 2015
by
Fabio Huser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added runtime tests for .npmrc parameters
parent
8efaac28
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
124 deletions
+65
-124
runtime.js
test/runtime.js
+65
-124
No files found.
test/runtime.js
View file @
1a43930d
...
...
@@ -24,176 +24,117 @@ describe('runtime parameters', function() {
require
(
extensionsPath
);
});
describe
(
'in package.json'
,
function
()
{
it
(
'should use the binary path'
,
function
()
{
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryPath
:
'ccc'
};
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'ccc'
);
});
describe
(
'configuration precedence should be respected'
,
function
()
{
it
(
'should use the binary file name'
,
function
()
{
describe
(
'SASS_BINARY_NAME'
,
function
()
{
beforeEach
(
function
()
{
process
.
argv
.
push
(
'--sass-binary-name'
,
'aaa'
);
process
.
env
.
SASS_BINARY_NAME
=
'bbb'
;
process
.
env
.
npm_config_sass_binary_name
=
'ccc'
;
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryName
:
'ddd'
};
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'ddd_binding.node'
);
});
it
(
'should use both the binary path and the file name'
,
function
()
{
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryName
:
'foo'
,
binaryPath
:
'bar'
};
it
(
'command line argument'
,
function
()
{
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'foo_binding.node'
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'bar'
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'aaa_binding.node'
);
});
it
(
'should use both the binary path and the file nam
e'
,
function
()
{
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryName
:
'foo'
,
binaryPath
:
'bar'
}
;
it
(
'environment variabl
e'
,
function
()
{
process
.
argv
=
[]
;
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'foo_binding.node'
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'bar'
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'bbb_binding.node'
);
});
it
(
'should use the distribution site URL'
,
function
()
{
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binarySite
:
'http://foo.example.com:9999'
};
it
(
'npm config variable'
,
function
()
{
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_NAME
=
null
;
require
(
extensionsPath
);
var
URL
=
'http://foo.example.com:9999/v'
;
assert
.
equal
(
process
.
sass
.
binaryUrl
.
substr
(
0
,
URL
.
length
),
URL
);
});
assert
.
equal
(
process
.
sass
.
binaryName
,
'ccc_binding.node'
);
});
describe
(
'in the process environment variables'
,
function
()
{
it
(
'should use the binary path'
,
function
()
{
process
.
env
.
SASS_BINARY_PATH
=
'xxx'
;
it
(
'package.json'
,
function
()
{
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_NAME
=
null
;
process
.
env
.
npm_config_sass_binary_name
=
null
;
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'xxx'
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'ddd_binding.node'
);
});
it
(
'should use the binary file name'
,
function
()
{
process
.
env
.
SASS_BINARY_NAME
=
'foo'
;
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'foo_binding.node'
);
});
it
(
'should use both the binary path and the file name'
,
function
()
{
process
.
env
.
SASS_BINARY_NAME
=
'foo'
;
process
.
env
.
SASS_BINARY_PATH
=
'bar'
;
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'foo_binding.node'
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'bar'
);
describe
(
'SASS_BINARY_SITE'
,
function
()
{
beforeEach
(
function
()
{
process
.
argv
.
push
(
'--sass-binary-site'
,
'http://aaa.example.com:9999'
);
process
.
env
.
SASS_BINARY_SITE
=
'http://bbb.example.com:8888'
;
process
.
env
.
npm_config_sass_binary_site
=
'http://ccc.example.com:7777'
;
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binarySite
:
'http://ddd.example.com:6666'
};
});
it
(
'should use the distribution site URL'
,
function
()
{
process
.
env
.
SASS_BINARY_SITE
=
'http://bar.example.com:9988'
;
it
(
'command line argument'
,
function
()
{
require
(
extensionsPath
);
var
URL
=
'http://bar.example.com:9988/v'
;
var
URL
=
'http://aaa.example.com:9999'
;
assert
.
equal
(
process
.
sass
.
binaryUrl
.
substr
(
0
,
URL
.
length
),
URL
);
});
});
describe
(
'using command line parameters'
,
function
()
{
it
(
'should use the binary path'
,
function
()
{
process
.
argv
.
push
(
'--sass-binary-path'
,
'aaa'
);
it
(
'environment variable'
,
function
()
{
process
.
argv
=
[];
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'aaa'
);
});
it
(
'should use the binary file name'
,
function
()
{
process
.
argv
.
push
(
'--sass-binary-name'
,
'bbb'
);
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'bbb_binding.node'
);
var
URL
=
'http://bbb.example.com:8888'
;
assert
.
equal
(
process
.
sass
.
binaryUrl
.
substr
(
0
,
URL
.
length
),
URL
);
});
it
(
'should use both the binary path and the file name'
,
function
()
{
process
.
argv
.
push
(
'--sass-binary-name'
,
'foo'
,
'--sass-binary-path'
,
'bar'
);
it
(
'npm config variable'
,
function
()
{
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_SITE
=
null
;
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'foo_binding.node'
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'bar'
);
var
URL
=
'http://ccc.example.com:7777'
;
assert
.
equal
(
process
.
sass
.
binaryUrl
.
substr
(
0
,
URL
.
length
),
URL
);
});
it
(
'should use the distribution site URL'
,
function
()
{
process
.
argv
.
push
(
'--sass-binary-site'
,
'http://qqq.example.com:9977'
);
it
(
'package.json'
,
function
()
{
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_SITE
=
null
;
process
.
env
.
npm_config_sass_binary_site
=
null
;
require
(
extensionsPath
);
var
URL
=
'http://qqq.example.com:9977/v'
;
var
URL
=
'http://ddd.example.com:6666'
;
assert
.
equal
(
process
.
sass
.
binaryUrl
.
substr
(
0
,
URL
.
length
),
URL
);
});
});
describe
(
'checking if the command line parameter overrides environment'
,
function
()
{
it
(
'binary path'
,
function
()
{
process
.
argv
.
push
(
'--sass-binary-path'
,
'bbb'
);
process
.
env
.
SASS_BINARY_PATH
=
'xxx'
;
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'bbb'
);
describe
(
'SASS_BINARY_PATH'
,
function
()
{
beforeEach
(
function
()
{
process
.
argv
.
push
(
'--sass-binary-path'
,
'aaa_binding.node'
);
process
.
env
.
SASS_BINARY_PATH
=
'bbb_binding.node'
;
process
.
env
.
npm_config_sass_binary_path
=
'ccc_binding.node'
;
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryPath
:
'ddd_binding.node'
};
});
it
(
'binary name'
,
function
()
{
process
.
argv
.
push
(
'--sass-binary-name'
,
'ccc'
);
process
.
env
.
SASS_BINARY_NAME
=
'yyy'
;
it
(
'command line argument'
,
function
()
{
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'ccc
_binding.node'
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'aaa
_binding.node'
);
});
it
(
'distribution site URL'
,
function
()
{
process
.
argv
.
push
(
'--sass-binary-site'
,
'http://qqq.example.com:9977'
);
process
.
env
.
SASS_BINARY_SITE
=
'http://www.example.com:9988'
;
require
(
extensionsPath
);
var
URL
=
'http://qqq.example.com:9977/v'
;
assert
.
equal
(
process
.
sass
.
binaryUrl
.
substr
(
0
,
URL
.
length
),
URL
);
});
});
describe
(
'checking if the command line parameter overrides package.json'
,
function
()
{
it
(
'binary path'
,
function
()
{
process
.
argv
.
push
(
'--sass-binary-path'
,
'ddd'
);
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryPath
:
'yyy'
};
it
(
'environment variable'
,
function
()
{
process
.
argv
=
[];
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'ddd
'
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'bbb_binding.node
'
);
});
it
(
'binary name'
,
function
()
{
process
.
argv
.
push
(
'--sass-binary-name'
,
'eee'
);
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryName
:
'zzz'
};
it
(
'npm config variable'
,
function
()
{
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_PATH
=
null
;
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'eee
_binding.node'
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'ccc
_binding.node'
);
});
it
(
'distribution site URL'
,
function
()
{
process
.
argv
.
push
(
'--sass-binary-site'
,
'http://yyy.example.com:9977'
);
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binarySite
:
'http://ddd.example.com:8888'
};
require
(
extensionsPath
);
var
URL
=
'http://yyy.example.com:9977/v'
;
assert
.
equal
(
process
.
sass
.
binaryUrl
.
substr
(
0
,
URL
.
length
),
URL
);
});
});
describe
(
'checking if environment variable overrides package.json'
,
function
()
{
it
(
'binary path'
,
function
()
{
process
.
env
.
SASS_BINARY_PATH
=
'ggg'
;
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryPath
:
'qqq'
};
it
(
'package.json'
,
function
()
{
process
.
argv
=
[];
process
.
env
.
SASS_BINARY_PATH
=
null
;
process
.
env
.
npm_config_sass_binary_path
=
null
;
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'ggg
'
);
assert
.
equal
(
process
.
sass
.
binaryPath
,
'ddd_binding.node
'
);
});
it
(
'binary name'
,
function
()
{
process
.
env
.
SASS_BINARY_NAME
=
'hhh'
;
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binaryName
:
'uuu'
};
require
(
extensionsPath
);
assert
.
equal
(
process
.
sass
.
binaryName
,
'hhh_binding.node'
);
});
it
(
'distribution site URL'
,
function
()
{
require
.
cache
[
packagePath
].
exports
.
nodeSassConfig
=
{
binarySite
:
'http://ddd.example.com:8888'
};
process
.
env
.
SASS_BINARY_SITE
=
'http://iii.example.com:9988'
;
require
(
extensionsPath
);
var
URL
=
'http://iii.example.com:9988/v'
;
assert
.
equal
(
process
.
sass
.
binaryUrl
.
substr
(
0
,
URL
.
length
),
URL
);
});
});
});
...
...
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