support for JavaScript imports
This commit is contained in:
parent
bc1d847e39
commit
a212d48c57
17 changed files with 176 additions and 109 deletions
0
tests/samples/codefiles/empty.ts
Normal file
0
tests/samples/codefiles/empty.ts
Normal file
37
tests/samples/codefiles/es6.js
Normal file
37
tests/samples/codefiles/es6.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
import Alpha from './bravo';
|
||||
import { charlie, delta } from '../../echo/foxtrot';
|
||||
import golf from './hotel/india.js';
|
||||
import juliett from 'kilo';
|
||||
import {
|
||||
lima,
|
||||
mike,
|
||||
} from './november';
|
||||
import * from '/modules/oscar';
|
||||
import * as papa from 'quebec';
|
||||
import {romeo as sierra} from from 'tango.jsx';
|
||||
import 'uniform.js';
|
||||
import victorDefault, * as victorModule from '/modules/victor.js';
|
||||
import whiskeyDefault, {whiskeyOne, whiskeyTwo} from 'whiskey';
|
||||
|
||||
const propTypes = {};
|
||||
|
||||
const defaultProps = {};
|
||||
|
||||
class Link extends Alpha.Component {
|
||||
static method() {
|
||||
return true;
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<a href={this.props.url} data-id={this.props.id}>
|
||||
{this.props.text}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Link.propTypes = propTypes;
|
||||
Link.defaultProps = defaultProps;
|
||||
|
||||
export default Link;
|
|
@ -1,3 +0,0 @@
|
|||
/**
|
||||
* A Comment
|
||||
*/
|
|
@ -188,6 +188,28 @@ class DependenciesTestCase(TestCase):
|
|||
entity='python.py',
|
||||
)
|
||||
|
||||
def test_dependencies_still_detected_when_alternate_language_used(self):
|
||||
with mock.patch('wakatime.stats.smart_guess_lexer') as mock_guess_lexer:
|
||||
mock_guess_lexer.return_value = None
|
||||
|
||||
self.shared(
|
||||
expected_dependencies=[
|
||||
'app',
|
||||
'django',
|
||||
'flask',
|
||||
'jinja',
|
||||
'mock',
|
||||
'pygments',
|
||||
'simplejson',
|
||||
'sqlalchemy',
|
||||
'unittest',
|
||||
],
|
||||
expected_language='Python',
|
||||
expected_lines=37,
|
||||
entity='python.py',
|
||||
extra_args=['--alternate-language', 'PYTHON'],
|
||||
)
|
||||
|
||||
def test_python_dependencies_detected(self):
|
||||
self.shared(
|
||||
expected_dependencies=[
|
||||
|
@ -302,7 +324,7 @@ class DependenciesTestCase(TestCase):
|
|||
expected_dependencies=[
|
||||
'"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"',
|
||||
],
|
||||
expected_language='HTML+PHP',
|
||||
expected_language='HTML',
|
||||
expected_lines=22,
|
||||
entity='html-with-php.html',
|
||||
)
|
||||
|
@ -312,7 +334,7 @@ class DependenciesTestCase(TestCase):
|
|||
expected_dependencies=[
|
||||
'"libs/json2.js"',
|
||||
],
|
||||
expected_language='HTML+Django/Jinja',
|
||||
expected_language='HTML',
|
||||
expected_lines=40,
|
||||
entity='html-django.html',
|
||||
)
|
||||
|
@ -336,24 +358,22 @@ class DependenciesTestCase(TestCase):
|
|||
entity='go.go',
|
||||
)
|
||||
|
||||
def test_dependencies_still_detected_when_alternate_language_used(self):
|
||||
with mock.patch('wakatime.stats.smart_guess_lexer') as mock_guess_lexer:
|
||||
mock_guess_lexer.return_value = None
|
||||
|
||||
self.shared(
|
||||
expected_dependencies=[
|
||||
'app',
|
||||
'django',
|
||||
'flask',
|
||||
'jinja',
|
||||
'mock',
|
||||
'pygments',
|
||||
'simplejson',
|
||||
'sqlalchemy',
|
||||
'unittest',
|
||||
],
|
||||
expected_language='Python',
|
||||
expected_lines=37,
|
||||
entity='python.py',
|
||||
extra_args=['--alternate-language', 'PYTHON'],
|
||||
)
|
||||
def test_es6_dependencies_detected(self):
|
||||
self.shared(
|
||||
expected_dependencies=[
|
||||
'bravo',
|
||||
'foxtrot',
|
||||
'india',
|
||||
'kilo',
|
||||
'november',
|
||||
'oscar',
|
||||
'quebec',
|
||||
'tango',
|
||||
'uniform',
|
||||
'victor',
|
||||
'whiskey',
|
||||
],
|
||||
expected_language='JavaScript',
|
||||
expected_lines=37,
|
||||
entity='es6.js',
|
||||
)
|
||||
|
|
|
@ -141,7 +141,7 @@ class LanguagesTestCase(utils.TestCase):
|
|||
def test_typescript_detected_over_typoscript(self):
|
||||
self.shared(
|
||||
expected_language='TypeScript',
|
||||
entity='typescript.ts',
|
||||
entity='empty.ts',
|
||||
extra_args=['--language', 'foo', '--plugin', 'NeoVim/703 vim-wakatime/4.0.9']
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue