Skip to content

Commit aef1342

Browse files
TehShrikegoto-bus-stop
authored andcommitted
Requires with backtick strings (#136)
* Failing tests for requires with backtick strings * Bump the detective dependency This fixes the failing test for different quote styles
1 parent f219f5a commit aef1342

File tree

6 files changed

+49
-1
lines changed

6 files changed

+49
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"cached-path-relative": "^1.0.0",
1313
"concat-stream": "~1.5.0",
1414
"defined": "^1.0.0",
15-
"detective": "^4.0.0",
15+
"detective": "^4.7.1",
1616
"duplexer2": "^0.1.2",
1717
"inherits": "^2.0.1",
1818
"parents": "^1.0.0",

test/files/quotes/bar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'success';

test/files/quotes/baz.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'success';

test/files/quotes/foo.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'success';

test/files/quotes/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var foo = require('./foo');
2+
var bar = require("./bar");
3+
var baz = require(`./baz`);

test/quotes.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
var parser = require('../');
2+
var test = require('tap').test;
3+
var fs = require('fs');
4+
var path = require('path');
5+
6+
var files = {
7+
main: path.join(__dirname, '/files/quotes/main.js'),
8+
foo: path.join(__dirname, '/files/quotes/foo.js'),
9+
bar: path.join(__dirname, '/files/quotes/bar.js'),
10+
baz: path.join(__dirname, '/files/quotes/baz.js')
11+
};
12+
13+
var sources = Object.keys(files).reduce(function (acc, file) {
14+
acc[file] = fs.readFileSync(files[file], 'utf8');
15+
return acc;
16+
}, {});
17+
18+
test('different quote styles', function (t) {
19+
t.plan(1);
20+
var p = parser();
21+
p.end(files.main);
22+
var main = null
23+
24+
p.on('data', function (row) {
25+
if (row.id === files.main) {
26+
main = row
27+
}
28+
});
29+
p.on('end', function () {
30+
t.same(main, {
31+
id: files.main,
32+
file: files.main,
33+
source: sources.main,
34+
entry: true,
35+
deps: {
36+
'./foo': files.foo,
37+
'./bar': files.bar,
38+
'./baz': files.baz
39+
}
40+
});
41+
});
42+
});

0 commit comments

Comments
 (0)