Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Yoann HOUPERT
hublot
Commits
8f10465f
Commit
8f10465f
authored
May 16, 2017
by
Tom JORQUERA
Browse files
Merge branch 'issue-12' into 'master'
lib/controller: ignore test files Closes
#12
See merge request
!11
parents
f90399fa
1b7a292f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
lib/controller.js
lib/controller.js
+3
-0
lib/controller.test.js
lib/controller.test.js
+5
-3
No files found.
lib/controller.js
View file @
8f10465f
...
...
@@ -14,6 +14,9 @@ module.exports = root => {
// Remove the file we already read
files
.
splice
(
files
.
indexOf
(
module
+
'
.js
'
),
1
);
// Ignore test files
files
=
files
.
filter
(
filename
=>
!
filename
.
endsWith
(
'
.test.js
'
));
Promise
.
all
(
files
.
map
(
f
=>
fs
.
readFile
(
root
+
'
/
'
+
module
+
'
/
'
+
f
,
'
utf8
'
)
))
...
...
lib/controller.test.js
View file @
8f10465f
...
...
@@ -5,10 +5,12 @@ jest.mock('mz/fs');
describe
(
'
loadModules
'
,
()
=>
{
const
MOCK_FILES
=
{
'
/test/controller/controller.js
'
:
'
1
'
,
'
/test/controller/test.js
'
:
'
2
'
,
'
/test/controller/controller.test.js
'
:
'
sometest
'
,
'
/test/controller/file.js
'
:
'
2
'
,
'
/test/controller/file.test.js
'
:
'
sometest
'
,
'
/test/lib/lib.js
'
:
'
3
'
,
'
/test/robot/robot.js
'
:
'
4
'
,
'
/test/notavalidmodule/
test
.js
'
:
'
5
'
'
/test/notavalidmodule/
file
.js
'
:
'
5
'
};
beforeEach
(()
=>
{
...
...
@@ -16,7 +18,7 @@ describe('loadModules', () => {
});
describe
(
'
loading a module
'
,
()
=>
{
test
(
'
should include all (and only) files in its dir.
'
,
done
=>
{
test
(
'
should include all (and only)
non-test
files in its dir.
'
,
done
=>
{
const
controller
=
require
(
'
./controller.js
'
)(
'
/test
'
);
controller
.
load
(
'
controller
'
)
...
...
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