Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node testing #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions node-tests/runner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var path = require('path');

var testrunner = require('qunit');
var walkSync = require('walk-sync');

var units = path.join(__dirname, 'unit');
walkSync(units, { globs: ['**/*-test.js'] }).forEach(function(file) {
var code = path.join(__dirname, '..', file.replace(/-test\.js$/, '.js'));
var test = path.join(__dirname, 'unit', file);

testrunner.run({
code: code,
tests: test
}, function(error/*, report */) {
if (error) { throw error; }
});
});
33 changes: 33 additions & 0 deletions node-tests/unit/lib/resolver-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
var Resolver = require('../../../lib/resolver');

QUnit.module('resolver.baseComponentFor');

test('does not resolve for a base component', function () {
var resolver = new Resolver({
moduleNamespace: 'modules',
stylesNamespace: 'styles',
componentsNamespace: 'components',
templatesNamespace: 'templates'
});

var contexts = {
'ui-base-theme': {
name: 'ui-base-theme',
scss: [
'modules/ui-base-theme/styles/components/ui-button--base.scss'
],
js: [
'modules/ui-base-theme/components/ui-kind.js'
],
hbs: [
'modules/ui-base-theme/templates/components/ui-kind.hbs'
]
}
};

var scssFile = 'modules/ui-base-theme/styles/components/ui-button--base.scss';

var context = contexts['ui-base-theme'];

equal(resolver.baseComponentFor(scssFile, context, contexts), false, 'resolved to something other than false');
});
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember try:each"
"test": "npm run node-tests && npm run ember-tests",
"node-tests": "node node-tests/runner.js",
"ember-tests": "ember try:each"
},
"repository": "",
"engines": {
Expand Down Expand Up @@ -45,7 +47,8 @@
"ember-load-initializers": "^0.5.1",
"ember-resolver": "^2.0.3",
"flexi": "1.1.7",
"loader.js": "^4.0.1"
"loader.js": "^4.0.1",
"qunit": "^0.9.1"
},
"keywords": [
"ember-addon"
Expand Down